Why doesn't apache2 consistently load template fragments from memcached?
Posted
by Hobhouse
on Server Fault
See other posts from Server Fault
or by Hobhouse
Published on 2010-05-11T06:17:44Z
Indexed on
2010/05/11
6:25 UTC
Read the original article
Hit count: 452
I run a webserver on an ubuntu box in the rackspacecloud with django 1.0x, apache2/WSGI and memcached 1.2.2.
Some of my templates make use of template fragment caching:
{% load cache %}
{% cache 604800 keyname %}
<!-- cache: {% now "H:i, j. b" %} -->
{{ my_content }}
{% endcache %}
When I reload apache2 everything is fine. If keyname is not set, my_content is generated and keyname is set in memcached. After that, my_content is served from memcached.
My problem is that after some hours (notably less time than 604800 seconds ), apache2 seems to stop talking to memcached, and my_content is generated from scratch everytime.
When this happens I can still set and get keys from memcached from my python shell. Memcached also has more than enough memory to store keys.
But to get apache2 to start talking to memcached again I have to restart apache2, and then it will once again start to get the now several hours old keys from memcached.
What can be the reason for this behaviour, and how do I fix it?
© Server Fault or respective owner