UpstreamConsistentHash, is it wrong?

Hi,

I have a cluster with four memcache daemons and am using the current
UpstreamConsistentHash 1 module with the latest 0.7 stable Nginx to
balance
between the nodes. Thanks to Valery’s update on the eval module, i can
now
access two values in my location block. This works fine, hashing is
consistent
indeed but is not compatible with the current PHP (3.0.1-1) nor the
current
Python (1.40).

I have set up two small PHP and Python scripts that both have the same
pool
definition as Nginx configuration has and both seem to want to store my
two
pieces test data in the first node. The Nginx module, however, believes
the
data should reside in the first and third node.

The order of memcache nodes is the same for both the scripts and the
configuration, so at least that mistake is not the case. Also, searching
in
the ML archive wasn’t quite helpful either. In one topic 2 the issue
was
solved by using this module, it seems it doesn’t work for me that way.

Obviously i have no idea what’s going and would like some advice on how
to
procede in fixing this issue.

Thanks in advance, any help is appreciated!

Cheers,

Markus J. - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

hi

you use the php memcache module 3.0.1. i have never tested the
consisten hashing with memcache modules above 2.x yet. i can take a
look at it, maybe the hashing has changed.

mauro

Hi Mauro,

Indeed, but also Python’s library (1.40). Both behave equal.

Cheers,

hi

you use the php memcache module 3.0.1. i have never tested the
consisten hashing with memcache modules above 2.x yet. i can take a
look at it, maybe the hashing has changed.

mauro

Markus J. - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

could you please send me your nginx configs, the memcache server
ips/port, and the memcache keys you tested with?

just now i downloaded the nginx module from the wiki again, added some
debug statements to it, then i downloaded the latest memcache module
from pecl and compiled it with 5.3.0 and i tested with 4 memcache
servers. i haven’t found any problem. for me the two always connect to
the same memcache.

are you having some weights configured? i think this might cause
trouble maybe…

Hi,

I have no weights configured, just a simple upstream block with four
server
127.0.0.1:1234 lines.

Cheers,

just now i downloaded the nginx module from the wiki again, added some
debug statements to it, then i downloaded the latest memcache module
from pecl and compiled it with 5.3.0 and i tested with 4 memcache
servers. i haven’t found any problem. for me the two always connect to
the same memcache.

are you having some weights configured? i think this might cause
trouble maybe…

Markus J. - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

For your information:

I’ve sent Mauro the information a couple of days ago; it contained some
sensitive information that’s not suitable for the web.

Anyway, Mauro found the issue and can perhaps fix it some day, here is a
snippet from his reply mentioning the issue and a temporary work-around.

seems you found a real problem there… my nginx module creates the
hashring based on the ip’s of the upstreams that you defined in the
config, while the memcache module creates it based on the exact string
that you gave it as server. which means the nginx does the dns
resolution first, the memcache module does it afterwards. could you
try writing the ips instead of the dns in your php?

i will come up with a patch for this, but for now it should be ok by
writing just the ips.

In other words, for now we must use only IP addresses in Python/PHP
scripts as
well as in the upstream configuration block. The work-around has been
confirmed to work as Mauro says.

Markus J. - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

ok,

can yo send me the nginx config and the keys that you are using to test?

hi

the good news is, the consistent hash upstream module works with dns
now. the bad news is, it seems to be impossible to do this without
patching the nginx.

since i really don’t like patching the nginx, i created a fork of my
module on github, which includes the patches that you have to apply on
the nginx. here you can download the updated module and the patches
for your nginx version from the branch “dns”:

http://github.com/replay/ngx_http_consistent_hash/tree/dns

btw. do you have a setup where one dns entry points to multiple ips? i
implemented that it should balance between those ips, but didn’t have
the setup to test it at hand. if yes, please report if that works.

mauro

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs