Weitere ähnliche Inhalte Ähnlich wie PyCon HK 2015 - Monitoring the performance of python web applications (20) Mehr von Graham Dumpleton (13) Kürzlich hochgeladen (20) PyCon HK 2015 - Monitoring the performance of python web applications11. Why it matters
• Reduce transaction response times so users are
happier.
• Reduce costs by making better use of the
resources you have available.
25. 100% CPU burn
0%
40%
80%
120%
160%
0 secs
3 secs
6 secs
9 secs
12 secs
1 2 3 4 5 6 7 8 9 10
Request time CPU time (request) CPU burn (request)
CPU burn (process)
Concurrent requests
26. 25% CPU burn
0%
40%
80%
120%
160%
0 secs
0.75 secs
1.5 secs
2.25 secs
3 secs
1 2 3 4 5 6 7 8 9 10
Request time CPU time (request) CPU burn (request)
CPU burn (process)
Concurrent requests
29. 100% CPU burn
4 Processes / 1 Thread
0%
40%
80%
120%
160%
0 secs
0.25 secs
0.5 secs
0.75 secs
1 secs
1 2 3 4 5 6 7 8 9 10
Request time CPU time (request) CPU burn (request)
CPU burn (process)
Concurrent requests
30. 100% CPU burn + Queue time
4 Processes / 1 Thread
0%
40%
80%
120%
160%
0 secs
0.5 secs
1 secs
1.5 secs
2 secs
1 2 3 4 5 6 7 8 9 10
Request time CPU time (request) CPU burn (request)
CPU burn (process) Queue time (max)
Concurrent requests
32. 5 clients ==> 4 Processes / 1 Thread
Capacity reached
Delayed
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3 4
36. I/O vs CPU
• I/O bound request handlers.
• Okay to use multiple threads.
• CPU bound request handlers.
• Better to use multiple processes.
• Restrict processes to single threads, or at most
two if requests have very short response time.
37. I/O and CPU
• Use no more than 3 to 5 threads per process.
• Use a small number of processes.
• Watch the CPU utilisation of processes.
• Be prepared to scale out to more hosts.
40. Request Delegation
WSGIScriptAlias / /some/path/app.wsgi
application-group=%{GLOBAL}
<Location /io-tasks>
WSGIProcessGroup io
</Location>
<Location /cpu-tasks>
WSGIProcessGroup cpu
</Location>