Problem with memcached after many hits

7 views
Skip to first unread message

web-junkie

unread,
Oct 30, 2007, 4:51:14 AM10/30/07
to Django users
Hi,
I have a weird problem where I think memcached or caching in general
might be the cause. I discovered it during testing the site with
http_load. After a certain amount of fetches, or hits, to the server,
the site does not respond normally. It takes 30 seconds or so. Strange
thing is: Only for cached pages. Non cached pages still load fast
afterwards.
When I do the test on a not cached page it is normal, too. No
problems. But on cached page it seems the site is somehow off track.
Only fix is to do apache reload.
The problem is not only with http_test, but after some hours of
traffic, too! Seems like the cache thinks "That's enough for today",
until you reload apache.
Strange problem, maybe I did something wrong somewhere. Any ideas?
Help would be appreciated. Thanks.

Graham Dumpleton

unread,
Oct 30, 2007, 6:30:21 AM10/30/07
to Django users

Are you using Apache prefork MPM or worker MPM? If worker, how many
threads in each process? Also, what do you have for maximum number of
child processes in Apache configuration. Finally, how many Django
instances are you hosting?

There were a few comments recently about issues with using memcached
in worker MPM due to each thread creating a connection to memcached
servers. If this turns out to be the case, could be possible to
exhaust maximum number of connections that memcached servers will
accept. Still need to look into this to work out what is reality, but
your feedback on your setup might help in that.

BTW, does everyone use the pure Python memcached client module, ie.,
memcache. Have seen comments to the effect that C client is three
times faster, although if you then want object marshaling on top of
that it would slow down a bit.

Graham

Jarek Zgoda

unread,
Oct 30, 2007, 6:36:30 AM10/30/07
to django...@googlegroups.com
Graham Dumpleton napisał(a):

> BTW, does everyone use the pure Python memcached client module, ie.,
> memcache. Have seen comments to the effect that C client is three
> times faster, although if you then want object marshaling on top of
> that it would slow down a bit.

cmemcache still seems to segfault unacceptably (ie. when memcached goes
down).

--
Jarek Zgoda
Skype: jzgoda | GTalk: zg...@jabber.aster.pl | voice: +48228430101

"We read Knuth so you don't have to." (Tim Peters)

web-junkie

unread,
Oct 30, 2007, 6:47:21 AM10/30/07
to Django users
On Oct 30, 11:30 am, Graham Dumpleton <Graham.Dumple...@gmail.com>
wrote:

> Are you using Apache prefork MPM or worker MPM? If worker, how many
> threads in each process? Also, what do you have for maximum number of
> child processes in Apache configuration. Finally, how many Django
> instances are you hosting?

I'm using prefork, as recommended. Settings as follows:

StartServers 20
MinSpareServers 20
MaxSpareServers 40
ServerLimit 300
MaxClients 300
MaxRequestsPerChild 4000

web-junkie

unread,
Oct 30, 2007, 6:48:55 AM10/30/07
to Django users
Oh, and I'm running exactly one Django site on the server.

web-junkie

unread,
Oct 30, 2007, 10:45:02 AM10/30/07
to Django users
After further investigation I saw that memcached connections kept
adding up, until they reached the limit. From that point it got slow
and DB load jumped up. An Apache reload made everything fast again.
After googling for memcached connections or so, I found
http://groups.google.com/group/django-developers/browse_thread/thread/f83eb95f35c9d9a
which should be the same issue. The fix was to upgrade mod_python (had
to switch from a stable to testing on my Debian).
So, yeah, should be fixed now. Weird issue.
Reply all
Reply to author
Forward
0 new messages