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.

Comments

Peter Bengtsson

Test comment. Please ignore

Your email will never ever be published.

Previous:
This site is now 100% inline CSS and no bytes are wasted March 5, 2013 Python, Web development, Django
Next:
HTML whitespace "compression" - don't bother! March 11, 2013 Web development
Related by category:
How I run standalone Python in 2025 January 14, 2025 Python
get in JavaScript is the same as property in Python February 13, 2025 Python
How to resolve a git conflict in poetry.lock February 7, 2020 Python
Best practice with retries with requests April 19, 2017 Python
Related by keyword:
Benchmark compare Highlight.js vs. Prism May 19, 2020 Node, JavaScript
Fastest way to uniqify a list in Python August 14, 2006 Python
The ideal number of workers in Jest October 8, 2018 Python, React
Fastest cache backend possible for Django April 7, 2017 Python, Linux, Web development