-
Notifications
You must be signed in to change notification settings - Fork 201
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
Add Ketama Support #66
base: master
Are you sure you want to change the base?
Conversation
TODO: - Add more documentation - Way to test the client with multiple memcache servers.
- Used description from Richard's blog (with his permission) where appropriate - Fixed usage of crc32 function - Fixed issue with crc32 in python3 - Fixed _get_server() not handling (serverhash, key) tuple - Fixed usage of _Host class - Removed unused function add_server() - Ran tests using KetamaClass (not included in this commit) - Tested against multiple memcached servers
glad to see PR about ketama consistent hashing support. However with looking at the PR i have some thoughts.
|
Andyxning, |
@sergio97 , ok, i will check it out as soon as i have some spare time. |
Linear search often outperforms binary search on small data sets because of branch mispredictions. |
Maybe it it right. However, we can not assume that people using our ++++++ 2015-04-26 23:24 GMT+08:00 David Ehrmann [email protected]:
|
@andyxning You're completely right :) I wasn't sure the exact cause of the slowdown, which is why I didn't merge to master. If @ehrmann is correct (which seems very likely, I tested with only 4 servers), then I will merge the change. |
Hi, If this subject is still of any interest to you guys, I'd like to point out that I implemented a monkey patching of python-memcache on uhashring. uhashring is a ketama compatible, full featured consistent hashing python lib (and if you care more for performance, it comes with a faster hashing algo). My 2 cents (and subjective view) |
Nice, thank you @ultrabug. Your monkey patch is actually very simple. I'm almost jealous I didn't come up with it :p |
@sergio97 glad you like it. I've done a benchmark which you can see on the README. Feel free to comment / criticize and propose anything you'd see fit. Cheers |
Any updates on this? I'd love to see consistent hashing with this memcache client. |
@ehrmann will update this PR later. Would you like to make a review? |
Sure. It looks like it still needs some of the issues resolved (crc32, there's TODOs in the PR, etc) |
@andyxning please take over this work if you want to - I am no longer interested in completing this. |
Resolves issue #61. Based on haridas' implementation, I've made a few tweaks. This is tested against 1 and many servers, including failing servers and bringing them back up. As far as I can tell everything is working. All tests run without issue.
If you have any suggests for improvement I'd be happy to work on it.