is it possible to connect to memcached and check in access phase?

Marcus Clyne eugaia at
Mon Feb 23 16:11:43 MSK 2009

Manlio Perillo wrote:
> Marcus Clyne ha scritto:
>>> However, if the memcached serve is on localhost, and since the data 
>>> you exchange is small, it should be safe to use socket in blocking 
>>> mode.
>> A few months ago I wrote a basic Nginx module using both the newer 
>> libmemcached library and the older libmemcache by Sean Chittenden to 
>> get a value from memcached and set an Nginx variable.  Both were 
>> blocking (i.e. didn't use an asynchronous approach), and I only 
>> tested them on a local installation of memcached.  The quicker of the 
>> two was the older libmemcache library (by quite a lot, actually), 
>> probably because the code itself is simpler.
> So, I suspect that a self written client should be even more quicker.
Yes, I would have thought so too, especially if you're only connecting 
to one memcached server.

> Did you use a persistent TCP connection?


 > And you can also use UDP.

I didn't try this.

Overall, the performance was clearly most affected by the fact that it 
was blocking.  An async version I think would show much better results 
and closer together, because while being blocking the performance hit is 
multiplicative but as async it would be linear.


More information about the nginx mailing list