Memcached modules behaviour

Pedro Mata-Mouros Fonseca pedro.matamouros at
Mon Nov 9 21:23:06 MSK 2009


I have a pool of two memcached servers that I use in nginx for  
querying (using Valery's eval module) and, in case of cache miss, for  
setting with the key/value pair in a PHP script. How does nginx/eval  
module query this memcached pool? Any kind of hashing is done? Round- 
robin? While we're at it, does eval module reuse the default nginx  
memcache module implementation?

The original problem is that I'm having memcached key/value sets in  
PHP being done to a specific server (some key hashing algorithm is  
used with the PECL memcache extension), while later on nginx appears  
to be querying both servers (causing a cache miss when contacting the  
wrong server).

Any suggestions on how to solve this? Right now, the options I'm  
seeing are:
1. extend either nginx or PECL's memcache (or memcached)
2. use only one server for memcached
3. have my PHP do a set for every server in the pool

#2 is of course the easiest, not necessarily the safer. Thanks in  


More information about the nginx mailing list