Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lack connection balancing in single threaded use #372

Open
jehiah opened this issue Sep 20, 2014 · 0 comments
Open

lack connection balancing in single threaded use #372

jehiah opened this issue Sep 20, 2014 · 0 comments

Comments

@jehiah
Copy link

jehiah commented Sep 20, 2014

The docs describe connection pooling as

The client maintains a connection pool behind the scenes, one for each protocol. Connections are opened as-needed; a random node is selected when a new connection is requested.

What isn't obvious from this is that in a single threaded use case you are pinned to a single host for the life of a client object until a connection fails and you need a new one. This can be less than ideal when you expect requests to be distributed to a full cluster to avoid hotspots.

I think it would be preferable if every time you perform a riak command on a client, that a new connection from a random node is used. (ie: you end up with at least one connection to each node in the pool, and requests are balanced among all nodes).

TL;DR; while client.init.py _choose_node() does pick a random node, it only ever does so once (for the life of that client object until BadResource is raised by some operation).

It would seem that the pool should be filled with a connection for each node initially, or some other handling happens in a single threaded environment to actually distribute requests not just to just connect once to a random node.

@lukebakken lukebakken modified the milestone: riak-python-client-2.7.1 Dec 16, 2016
@lukebakken lukebakken modified the milestones: riak-python-client-2.7.1, riak-python-client-3.0.0 Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants