memcache performance

Pavel Kolla pavelk at ganz.com
Tue Jan 24 20:37:47 UTC 2006


Hello,  i  have  relatively  busy  site  at  my  hands  with a lot of DB
activity,  so  i  decided to offload some session specific realtime data
to memcached...

the setup is
lighttpd + spawn-fcgi + fastcgi + php4-cgi (eAccelerator & PECL/memcache)

Before memcache all requests were handled as follows:

PHP gets encrypted request.
PHP figures out user token from the request.
PHP  through  permanent fcgi's connection to MySQL4 DB runs query to get
 encryption key from DB using given token.
PHP decrypts request.
PHP  premutates  encryption  key and runs query to update DB with it for
 given user token.
PHP validates requests.
PHP executes request (few queries and some php work).
PHP encrypts response and send it back to client.


After memcache has been introduced it got replaced with following:

PHP gets encrypted request.
PHP figures out user token from the request.
PHP through permanent fcgi's connection to memcached gets encryption key
 using token as search key.
PHP decrypts request
PHP  premutates encryption key and sets memcached with it for given user
 token used as key.
PHP validates requests.
PHP executes request (few queries and some php work).
PHP encrypts response and send it back to client.

memcache  daemon  used is 1.1.12-r2 (latest stable available from gentoo
as net-misc/memcached)

PECL   version   is   2.0.0   (latest   stable   available  from  gentoo
dev-php4/pecl-memcache)

basically,  I  use  memcache  to  take  care  of frequently accessed and
modified  authentication  data. As I loadtested with siege for 5 minutes
with  200  concurrent  emulated  users doing random different requests -
there  is  practically no difference in overall performance. I see about
20-25%  drop in DB activity with memcache but that doesn't affect number
of handled requests per second. During the test load times on web server
(dual  Xeon  2.8  HT)  are ~8-9 in both cases, and DB (quad Xeon MP 1.5)
load is ~2 in both cases.

I  figure  i  must  be  doing  something wrong but can't really see what
exactly, so i'm looking for suggestions here...

-- 
Best regards,
 Pavel                            mailto:pavelk at ganz.com



More information about the memcached mailing list