-
Notifications
You must be signed in to change notification settings - Fork 3
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
Combine map default with cmdmap? #7
Comments
Hey! Somehow I'd not seen a mcrouter config like that before. I might have to do a little C work to support this, let me think it through. Do you have a more complete mcrouter config I can reference? Right now the |
Yeah this'll definitely take a little C but it looks easy. might take a day or two to get it written/tested/merged. Fwiw I've been trying to not "kitchen sink" the proxy and add some features as-needed. most mcrouter users I've talked to barely used its featureset. So requests like this a very valuable to me, thank you! |
Hi again.
It's mission is two parts - differ between a "write to all"/"read only from some" (nearest), and also do the same for "large keys" but with a different pools. And thanks to you! I'll really appreciate the fix whenever it's ready. |
That looks totally reasonable to me. Will update here when it's ready. If you run into any other issues (memory/performance/etc) please just let us know asap. The proxy gets a lot of usage now but the total number of users is low so I expect some small undiscovered issues in specific use cases (like this one). Been mostly focusing on polish and usability this year. |
@sevrob any chance you could try out some branches? Run this memcached PR: memcached/memcached#1148 ... and let me know if this solves your problem? I'll probably merge the proxy PR in a day or two (I self-review after letting things sit), but will merge the routelib change after the next tarball release so I can bump the minimum version requirement at the same time. Either way if you try it and give a thumbs up that helps a lot in my confidence of the change :) |
Fwiw with this change your config could be a tiny bit shorter. Set all three of map, cmap and default, but only override the ones you need to. So something like:
|
Found a couple bugs just now. force pushed the routelib branch. I also added some aliases to make the command maps less gross:
|
Absolutety, I'll have a try and report back later today! |
So, I have done a bit of testing. The new config is so much cleaner! The cmap part seem to work fine, as when I try to GET values I have SET through proxy, it only returns the ones that are stored on the "read" backend.
|
The proxy thinks in “pools”, not backends, which is a little different than mcrouter. if you want to write to two servers, you have to define two pools with one backend in each, then specify both of those named pools as children in the route arguments. in the most common use cases a set would be copied to multiple pools, so that’s the shorthand here. ie: if you have two pools of 3 backend each in different datacenters, it will copy that key once in each datacenter. might be nice to get shorthand for “use this list of backends to iterate over” but it’s not planned right now |
Hmm OK, I see. Changing the write_all pool to two pools like this:
and changing the default like this
seems to work perfectly! For my setup the "pools" part is actually redundant then. Thank you so much! |
Cool! Yeah; fundamentally memcached's value is adding servers to the cluster increases your memory storage capacity. So just having single servers with everything copied to all of them is usually an antipattern. That said there are still definitely perfectly valid use cases to do so. Though I've been seeing some mcrouter users copy everything to 20+ servers which is pretty bad for performance :) Splitting the pool up into like 5 servers per pool would cut CPU/bandwidth for sets way down and improve hit ratio. There is one more trick you can use to keep your config simplified in this case. Also noting this since you have to do the same change for your The trick is pool sets:
It's not quite perfect since it loses the order. The feature is mostly meant for Since you're doing a shuffled failover it'll probably work just fine and help keep the config size down. You could also build the pool_set with a for loop over an array of backends and pass it in; or load from json and do that or etc. depending on how much lua you want to do and how often your config changes. |
Just to report back - I deployed memcached proxy with this setup in one of our dev environment last week as a drop in for mcrouter. Noone have noticed yet, that must be a good sign. |
@sevrinrobstad awesome! Thanks for the update. Fwiw I haven't done a performance head-to-head with mcrouter in a long time. Let me know if you notice anything there. I'll get a new release out with the cmap changes this week. |
Fwiw: 1.6.29 is out and I've merged the routelib branch so you shouldn't need to deploy branches anymore. |
Hi.
I'm trying to test memcached proxy to substitute mcrouter.
Copying our routes setup from mcrouter, I have hit a snag...
What I want to achieve is to map commands to different pools (and route logics) for both special case prefix, AND for default (but to different pools),
for example to send
SET's to route-allfastest, and
GET's to route_failover on another pool.
The code block below shows a non-complete example:
But this gives
ERROR: Failed to execute mcp_config_pools: /files/routelib.lua:304: bad argument #1 to 'for iterator' (table expected, got nil)
With the commented out default block (without cmdmap) it works.
Am I doing something wrong, or is there any other way to achieve this config?
The text was updated successfully, but these errors were encountered: