Apacheの設定ファイル
LoadModule python_module modules/mod_python.so
<Location /django_with_mod_python>
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE django_with_mod_python.settings
PythonOption django.root /django_with_mod_python
#PythonDebug On
PythonPath "['/home/httpd/vhost/django'] + sys.path"
</Location>
$ cat hello/views.py
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. - Django with mod_python")
$ curl "http://localhost/django_with_mod_python/hello/"
Hello, world. - Django with mod_python
Apache Bench
$ ab -n 10000 -c 100 "http://localhost/django_with_mod_python/hello/"
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests
Server Software: Apache/2.2.9
Server Hostname: localhost
Server Port: 80
Document Path: /django_with_mod_python/hello/
Document Length: 39 bytes
Concurrency Level: 100
Time taken for tests: 17.360633 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2640000 bytes
HTML transferred: 390000 bytes
Requests per second: 576.02 [#/sec] (mean)
Time per request: 173.606 [ms] (mean)
Time per request: 1.736 [ms] (mean, across all concurrent requests)
Transfer rate: 148.50 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 4 11.0 0 130
Processing: 30 167 114.3 150 3860
Waiting: 10 150 38.1 150 600
Total: 80 172 114.9 150 3870
Percentage of the requests served within a certain time (ms)
50% 150
66% 160
75% 170
80% 170
90% 180
95% 230
98% 480
99% 620
100% 3870 (longest request)
メモリ使用状況
top - 15:41:52 up 2:35, 2 users, load average: 7.71, 2.64, 1.49
Tasks: 65 total, 13 running, 52 sleeping, 0 stopped, 0 zombie
Cpu(s): 83.8%us, 11.5%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 4.8%si, 0.0%st
Mem: 256400k total, 253500k used, 2900k free, 3544k buffers
Swap: 524280k total, 0k used, 524280k free, 40468k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4207 apache 15 0 22408 14m 2272 S 8.0 5.6 0:03.64 httpd
4210 apache 15 0 22408 14m 2272 R 7.3 5.6 0:01.61 httpd
4202 apache 15 0 22408 14m 2272 S 7.0 5.6 0:03.67 httpd
4217 apache 15 0 22408 14m 2272 S 6.1 5.6 0:01.51 httpd
4218 apache 15 0 22408 14m 2272 R 5.4 5.6 0:01.16 httpd
4186 apache 15 0 22408 14m 2272 S 4.8 5.6 0:01.27 httpd
4211 apache 16 0 22408 14m 2272 R 4.8 5.6 0:01.24 httpd
4185 apache 15 0 22408 14m 2272 S 4.5 5.6 0:02.52 httpd
4204 apache 15 0 22408 14m 2272 S 4.5 5.6 0:03.39 httpd
4213 apache 15 0 22408 14m 2272 S 4.5 5.6 0:01.28 httpd
4215 apache 16 0 22408 14m 2272 R 4.5 5.6 0:01.50 httpd
4220 apache 15 0 22408 14m 2272 S 4.1 5.6 0:00.53 httpd
4184 apache 15 0 22408 14m 2272 S 3.8 5.6 0:02.43 httpd
4201 apache 15 0 22408 14m 2272 S 3.8 5.6 0:03.73 httpd
4216 apache 16 0 22408 14m 2272 R 3.8 5.6 0:01.48 httpd
4182 apache 15 0 22408 14m 2272 S 3.5 5.6 0:03.31 httpd
4198 apache 15 0 22408 14m 2272 S 3.2 5.6 0:03.05 httpd
4214 apache 15 0 22408 14m 2272 S 3.2 5.6 0:01.33 httpd
4209 apache 15 0 22408 14m 2272 S 2.9 5.6 0:00.98 httpd
4212 apache 16 0 22408 14m 2272 R 2.9 5.6 0:01.39 httpd