Currently trying to do a simple replication proxy by using a dns name that contains all the other memcached ip addresses
will look at more complicated hashing things later, for now, this is the simplest I can do
Using the dns name works kinda...
Setup
memcached contains 3 ips, order is randomized every time I invoke it
nslookup memcached
Name: memcached.test.local
Address: 10.0.0.12
Name: memcached.test.local
Address: 10.0.0.11
Name: memcached.test.local
Address: 10.0.0.10
memcached -vv --port=22122 -o proxy_config=test.lua
test.lua
package.loaded["simple"] = nil
local s = require("simple")
verbose(true)
router{
router_type = "flat",
log = true,
}
pool{
name = "default",
backends = {"memcached:11211"},
}
simple.lua is in the same dir with a small modification (changed the o to a c)
if c.r.log ~= nil then
top = logreq_factory(c.pool)
else
top = function(r) return c.pool(r) end
end
startup looks like:
router: overriding default for router_type
making backend for... memcached:11211
setting up a zoneless flat pool
setting up a zoneless flat pool
setting up a zoneless flat pool
setting up a zoneless flat pool
<43 server listening (proxy)
<44 server listening (proxy)
Results
Setting a unique key in each instance separately, I can kind of get them from the proxy, but it's inconsistent.
10.0.0.11 is the most consistent, request the key that's located here, I (almost) always get a response
10.0.010 is less consitent, i get about 40% to 50% of the time
Weirdly, 10.0.012 is never queried! The proxy never hits this one!
Also of note the 4 "setting up a zoneless flat pool" lines. I would expect it to only output 3 becuase there is only three ips, but it called mcp_config_routes 4 times?
Maybe there is a bad address in the list?
There is obviously some kind of resolution going on inside of memcached but it's not transferring correctly to the proxy, or my env is messing with the setup.
I don't mind digging into the lua myself, but if possible can you send me on the right track?
Where do I need to focus?
As a start I should probably install luasocket and then hack around the dns module, but if I can avoid that, it would be ideal.
Additionally I wonder about freshness. How does the resolution function?
Is it a one-and-done or does it query each time?
Currently trying to do a simple replication proxy by using a dns name that contains all the other memcached ip addresses
Using the dns name works kinda...
Setup
memcachedcontains 3 ips, order is randomized every time I invoke itnslookup memcachedmemcached -vv --port=22122 -o proxy_config=test.luatest.luasimple.luais in the same dir with a small modification (changed theoto ac)startup looks like:
Results
Setting a unique key in each instance separately, I can kind of
getthem from the proxy, but it's inconsistent.10.0.0.11 is the most consistent, request the key that's located here, I (almost) always get a response
10.0.010 is less consitent, i get about 40% to 50% of the time
Weirdly, 10.0.012 is never queried! The proxy never hits this one!
Also of note the 4 "setting up a zoneless flat pool" lines. I would expect it to only output 3 becuase there is only three ips, but it called
mcp_config_routes4 times?Maybe there is a bad address in the list?
There is obviously some kind of resolution going on inside of
memcachedbut it's not transferring correctly to the proxy, or my env is messing with the setup.I don't mind digging into the lua myself, but if possible can you send me on the right track?
Where do I need to focus?
As a start I should probably install
luasocketand then hack around the dns module, but if I can avoid that, it would be ideal.Additionally I wonder about freshness. How does the resolution function?
Is it a one-and-done or does it query each time?