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

Open connections as needed instead of all at once #81

Closed
phette opened this issue May 4, 2018 · 1 comment
Closed

Open connections as needed instead of all at once #81

phette opened this issue May 4, 2018 · 1 comment

Comments

@phette
Copy link

phette commented May 4, 2018

The initial call to acquire a connection opens all connections up to the max size. For anyone requiring a larger connection pool this becomes a relatively slow operation. Depending on the efficiency of your application you may not need to have the max number of connections open anyways. For those reasons I believe connections should be opened as needed until the max number of connections are reached.

https://github.com/aio-libs/aiomcache/blob/master/aiomcache/pool.py#L40-L44

@asvetlov
Copy link
Member

asvetlov commented May 7, 2018

It is a tradeoff between startup time and operation response one.
Please take a note that the client has two parameters: minimal and maximum size.
Setting the minimum size to non-zero value is very useful: it raises an exception if memcache server is not available on application startup (misconfiguration error most likely).
It's better than a random failure on request processing.

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