django-fancy-cache with or without stats

11 March 2013   1 comment   Python, Django

Powered by Fusion×

If you use django-fancy-cache you can either run with stats or without. With stats, you can get a number of how many times a cache key "hits" and how many times it "misses". Keeping stats incurs a small performance slowdown. But how much?

I created a simple page that either keeps stats or ignores it. I ran the benchmark over Nginx and Gunicorn with 4 workers. The cache server is a memcached running on the same host (my OSX 10.7 laptop).

With stats:

Average: 768.6 requests/second
Median: 773.5 requests/second
Standard deviation: 14.0

Without stats:

Average: 808.4 requests/second
Median: 816.4 requests/second
Standard deviation: 30.0

That means, roughly that running with stats incurs a 6% slower performance.

The stats is completely useless to your users. The stats tool is purely for your own curiousity and something you can switch on and off easily.

Note: This benchmark assumes that the memcached server is running on the same host as the Nginx and the Gunicorn server. If there was more network in between, obviously all the .incr() commands would cause more performance slowdown.


Peter Bengtsson
Test comment. Please ignore
Thank you for posting a comment

Your email will never ever be published

Related posts

This site is now 100% inline CSS and no bytes are wasted 05 March 2013
HTML whitespace "compression" - don't bother! 11 March 2013
Related by keywords:
Fastest way to uniqify a list in Python 14 August 2006
Local Django development with Nginx 11 October 2010
Fastest database for Tornado 09 October 2013
Optimization of getting random rows out of a PostgreSQL in Django 23 February 2011
Date formatting in python or in PostgreSQL 20 July 2004
This site is now 100% inline CSS and no bytes are wasted 05 March 2013
PostgreSQL, MySQL or SQLite 04 April 2004
Welcome to the world django-fancy-cache! 01 March 2013
Gzip and Slimmer optimization anecdote 30 January 2007
Custom CacheMiddleware that tells Javascript a page is cached in Django 24 August 2009
To $('#foo p') or to $('p', $('#foo')) 24 February 2009
rfc822() vs. rfc1123_date() 16 August 2007