I have a website that is being served by nginx and django.
My staging.py contains CACHE and middleware settings correctly. You can take a look at nginx.conf and the nginx conf file related to the site. I have confirmed that memcached is running through ngrep -d any port 11211
.
I turned on caching for the whole site, and wanted to see the performance by doing ab -n 1000 -c 10 http://site.com
With caching turned off, I get:
Concurrency Level: 10
Time taken for tests: 10.276 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 11695000 bytes
HTML transferred: 11559000 bytes
Requests per second: 97.32 [#/sec] (mean)
Time per request: 102.759 [ms] (mean)
Time per request: 10.276 [ms] (mean, across all concurrent requests)
Transfer rate: 1111.43 [Kbytes/sec] received
With caching turned on, I get:
Concurrency Level: 10
Time taken for tests: 12.277 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 11695000 bytes
HTML transferred: 11559000 bytes
Requests per second: 81.45 [#/sec] (mean)
Time per request: 122.771 [ms] (mean)
Time per request: 12.277 [ms] (mean, across all concurrent requests)
Transfer rate: 930.26 [Kbytes/sec] received
My website is a blog that is pulling posts from a database - nothing exotic.
I'd be grateful if someone could let me know why the site is actually slowing down with memcached. You can see that the "Requests per second" actually drops when I use memcached!
However, running memcached-top gave me no hits when I ran ab (though the read and write counters went up during the test). I have memory available and memcached is not hogging up memory.
EDIT
I ran memcached -vv
and got some results. You can see that the the memcached prints out a "STORED" the first time, and then does not seems to send it from the cache (not sure about this). Now I am even more confused. Perhaps the memcached & the django interface is working, but the end result is that it better off to not run memcached?