You are viewing william_os4y

Thu, Jun. 8th, 2006, 09:04 pm
Django stress tests

To stay aligned with my previous post about python web framework performance, I've decided to validate Django through a simple wiki application: DjangoWiki.

As reminder, the tests consist to execute the famous ApacheBenchmark tool with 100 concurrent requests.

To be comparable (if we can), the tests are running on the same machine (Kernel, SQLite-3.2.1, python-2.4.2, ...) as for the Axiom+Nevow+Twisted tests. Specific tools required here are flup-0.5 and lighttpd-1.4.11

I've made tests with an empty SQLite DB (just 2 records). The results here after shows that:

  • The webserver (lighttpd+flup/scgi+django) resists quite well to 100 concurrent ab2 requests.

  • The webserver can accept 85 requests per second without caching

  • The server can accept 209 (!!!) requests per second with the cache enabled



Here after the raw results, I let you judge.




Appendix: Django WSGIServer results


wi@linuxhome ~ $ nice -n 20 ab2 -n1000 -c100 http://localhost:8000/wiki/FrontPage/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Server Software:        WSGIServer/0.1
Server Hostname:        localhost
Server Port:            8000

Document Path:          /wiki/FrontPage/
Document Length:        609 bytes

Concurrency Level:      100
Time taken for tests:   20.340463 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      754004 bytes
HTML transferred:       611436 bytes
Requests per second:    49.16 [#/sec] (mean)
Time per request:       2034.046 [ms] (mean)
Time per request:       20.340 [ms] (mean, across all concurrent requests)
Transfer rate:          36.18 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  506 1429.0     47    9096
Processing:    12  260 1150.8     69   13290
Waiting:        0  243 1152.6     48   13288
Total:         82  767 2131.9    108   16288

Percentage of the requests served within a certain time (ms)
  50%    108
  66%    116
  75%    134
  80%    140
  90%   3194
  95%   3963
  98%   9181
  99%  11976
 100%  16288 (longest request)




Appendix: Django SCGI server (via flup) integrated with lighttpd-1.4.11


wi@linuxhome ~ $ nice -n 20 ab2 -n1000 -c100 http://test/wiki/FrontPage/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Server Software:        lighttpd/1.4.11
Server Hostname:        test
Server Port:            80

Document Path:          /wiki/FrontPage/
Document Length:        609 bytes

Concurrency Level:      100
Time taken for tests:   11.700603 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      798845 bytes
HTML transferred:       609000 bytes
Requests per second:    85.47 [#/sec] (mean)
Time per request:       1170.060 [ms] (mean)
Time per request:       11.701 [ms] (mean, across all concurrent requests)
Transfer rate:          66.66 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       17  573 327.6    580    1167
Processing:    31  593 328.1    589    1182
Waiting:        2  570 334.2    567    1167
Total:       1152 1167  15.6   1161    1203

Percentage of the requests served within a certain time (ms)
  50%   1161
  66%   1164
  75%   1178
  80%   1182
  90%   1201
  95%   1201
  98%   1201
  99%   1201
 100%   1203 (longest request)




Appendix: Django SCGI server (same as before), but with cache enabled (300 seconds)


vi@linuxhome ~/Documents/livejournal $ nice -n 20 ab2 -n1000 -c100 http://test/wiki/FrontPage/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Server Software:        lighttpd/1.4.11
Server Hostname:        test
Server Port:            80

Document Path:          /wiki/FrontPage/
Document Length:        609 bytes

Concurrency Level:      100
Time taken for tests:   4.771269 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      952509 bytes
HTML transferred:       609000 bytes
Requests per second:    209.59 [#/sec] (mean)
Time per request:       477.127 [ms] (mean)
Time per request:       4.771 [ms] (mean, across all concurrent requests)
Transfer rate:          194.92 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       16  235 117.9    239     440
Processing:    24  238 117.8    234     447
Waiting:        2  219 126.7    219     440
Total:        460  473   6.0    474     490

Percentage of the requests served within a certain time (ms)
  50%    474
  66%    476
  75%    476
  80%    477
  90%    482
  95%    483
  98%    490
  99%    490
 100%    490 (longest request)