memcache performance

Brian Moon brianm at dealnews.com
Wed Jan 25 17:18:54 UTC 2006


My guess is that your code is just slow.  Did you actually benchmark 
your queries?  Was that slowing you down?  Its a good idea to off load 
repetitive queries to memcache for the health for your db server, but if 
you are running 1000s of lines of PHP code, replacing the db with 
memcached is not likely to speed up your application.

Now, if you started caching whole pages, parts of pages, etc. that could 
speed up your application.

Brian Moon
dealnews.com
--------------
How to go broke saving money.
http://dealnews.com/

Pavel Kolla wrote:
> 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...
> 


More information about the memcached mailing list