Absolutely unscientific comparison of django performance with different caching backends

November 8, 2008 – 02:21

A daily graph of a web server's load, indicati...Image via WikipediaSetup: dead simple django application, returning a template stored in a file as a root page. Template has no executable code.

The server is started as FastCGI (10 children) and server through nginx.

Hardware – IBM T42 with 1GB under linux, kde, firefox, thunderbird, emacs, openoffice and bunch of other everyday application open.

Performance is measured with /usr/sbin/ab -n 10000 -c 10 http://localhost:81/

Results are below.

No cache: (dummy:///)

Requests per second:    219.26 [#/sec] (mean)
Time per request:       45.61 [ms] (mean)
Time per request:       4.56 [ms] (mean, across all concurrent requests)

locmem:///

Requests per second:    302.55 [#/sec] (mean)
Time per request:       33.05 [ms] (mean)
Time per request:       3.31 [ms] (mean, across all concurrent requests)

db://cache

Requests per second:    168.21 [#/sec] (mean)
Time per request:       59.45 [ms] (mean)
Time per request:       5.94 [ms] (mean, across all concurrent requests)

file:///tmp

Requests per second:    12.36 [#/sec] (mean)
Time per request:       808.84 [ms] (mean)
Time per request:       80.88 [ms] (mean, across all concurrent requests)

local memcached with 64Mb

Requests per second:    221.29 [#/sec] (mean)
Time per request:       45.19 [ms] (mean)
Time per request:       4.52 [ms] (mean, across all concurrent requests)
Transfer rate:          81.44 [Kbytes/sec] received

I’ll do no analysis, butwhat surprised me most was the (mis)performance of file:/// backend.