drbrain at segment7.net
Tue Jan 24 20:52:49 UTC 2006
On Jan 24, 2006, at 12:37 PM, 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
> to memcached...
> the setup is
> lighttpd + spawn-fcgi + fastcgi + php4-cgi (eAccelerator & PECL/
$ diff -u mysql memcache
--- memcache 2006-01-24 12:46:26.000000000 -0800
+++ mysql 2006-01-24 12:46:04.000000000 -0800
@@ -1,8 +1,9 @@
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 through permanent fcgi's connection to memcached gets encryption
key using token as search key.
PHP decrypts request
-PHP premutates encryption key and runs query to update DB with it
for given user token
+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
> as net-misc/memcached)
> PECL version is 2.0.0 (latest stable available from
> basically, I use memcache to take care of frequently
> accessed and
> modified authentication data. As I loadtested with siege for 5
> with 200 concurrent emulated users doing random different
> requests -
> there is practically no difference in overall performance. I see
> 20-25% drop in DB activity with memcache but that doesn't affect
> of handled requests per second. During the test load times on web
> (dual Xeon 2.8 HT) are ~8-9 in both cases, and DB (quad Xeon MP
> load is ~2 in both cases.
> I figure i must be doing something wrong but can't really see
> exactly, so i'm looking for suggestions here...
How did you determine that memcached would really speed up your
Was the DB really your choke point? How long did the DB queries take?
How long do the tokens stay in memcached?
Eric Hodel - drbrain at segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant
More information about the memcached