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

share deaduntils between hosts #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

octupszhang
Copy link

This will help avoid many socket timeout especially when we use
python-memcached with eventlet.

For example,When use eventlet,for each greenlet we call client.get
first time,the client will be rebuild,and client.servers[*].deaduntil
will be 0.For each http request,we will have one greenlet.So we get
a socket timeout for each request.
This could be fixed in application,but i believe it's better to fix
it in python-memcached.

@octupszhang octupszhang force-pushed the shareHostDeadUntils branch from 52c4c91 to f64c7f9 Compare June 11, 2016 04:22
This will help avoid many socket timeout especially when we use
python-memcached with eventlet.

For example,When use eventlet,for each greenlet we call client.get
first time,the client will be rebuild,and client.servers[*].deaduntil
will be 0.For each http request,we will have one greenlet.So we get
a socket timeout for each request.
This could be fixed in application,but i believe it's better to fix
it in python-memcached.
@octupszhang octupszhang force-pushed the shareHostDeadUntils branch 2 times, most recently from 39591e3 to 0d5281e Compare June 14, 2016 03:15
@@ -1330,6 +1330,9 @@ def check_key(self, key, key_extra_len=0):
"Control/space characters not allowed (key=%r)" % key)


_host_last_deaduntils = {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never gets reset, once a host becomes alive should there be a "del _host_list_deaduntils[self.ip)"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to get your response, how about the new patch, I think maybe "_host_list_deaduntils[self.ip]=0" is better, which avoids KeyError.

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

Successfully merging this pull request may close these issues.

2 participants