pinterest/pymemcache

How to properly set the `timeout` and `connect_timeout` values?

yuanzhou opened this issue · 1 comments

I'm using a pooled connection client (uWSGI with multi-threading and multi-processing) against the Memcached cluster running on AWS and trying to understand how to properly set the timeout and connect_timeout values. The documentation doesn't say much about these two parameters.

Currently I have the below working client, but wanted to know if I should increase the timeout and connect_timeout values. I chose to use connect_timeout = 1 because any bigger value will result a delay when I start up the python app for the first time (causing a noticeable blocking). I don't know if the timeout setting is for creating a new connection when all the pooled connections are in use.

memcached_client_instance = PooledClient(app.config['MEMCACHED_SERVER'], 
                                         max_pool_size = 8,
                                         connect_timeout = 1,
                                         timeout = 30,
                                         ignore_exc = True, 
                                         no_delay = True,
                                         serde = serde.pickle_serde)

Any suggestions are greatly appreciated!

jogo commented

Posted a PR to include the right information in the docs, in this case this It's the docstrings fro the init function

connect_timeout: optional float, seconds to wait for a connection to