I did some profiling for this issue and found the time spent on the
accept method of socket is doubled in v .31. what's the cause?
v .31 profiling stats:
126384 function calls (125084 primitive calls) in 29.613 CPU
seconds
Ordered by: cumulative time
List reduced from 552 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno
(function)
1 0.000 0.000 29.613 29.613 <string>:1(<module>)
1 0.000 0.000 29.613 29.613 {execfile}
1 0.000 0.000 29.613 29.613 ./hello2.py:3(<module>)
1 0.000 0.000 29.440 29.440 /home/worker/test//lib/
python/web/application.py:279(run)
1 0.000 0.000 29.440 29.440 /home/worker/test//lib/
python/web/wsgi.py:24(runwsgi)
1 0.001 0.001 29.440 29.440 /home/worker/test//lib/
python/web/httpserver.py:130(runsimple)
1 0.019 0.019 29.414 29.414 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:1540(start)
2011 0.156 0.000 29.289 0.015 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:1635(tick)
2011 0.050 0.000 27.723 0.014 /usr/local/lib/python2.5/
socket.py:166(accept)
2011 27.564 0.014 27.564 0.014 {method 'accept' of
'_socket.socket' objects}
126384 function calls (125084 primitive calls) in 29.613 CPU
seconds
Ordered by: internal time
List reduced from 552 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno
(function)
2011 27.564 0.014 27.564 0.014 {method 'accept' of
'_socket.socket' objects}
2002 0.672 0.000 0.672 0.000 <string>:1(settimeout)
4002 0.177 0.000 0.177 0.000 {fcntl.fcntl}
4037 0.174 0.000 0.174 0.000 {built-in method
acquire}
2011 0.156 0.000 29.289 0.015 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:1635(tick)
12 0.101 0.008 0.101 0.008 {time.sleep}
2002 0.065 0.000 0.110 0.000 /usr/local/lib/python2.5/
socket.py:152(__init__)
2010 0.065 0.000 0.327 0.000 /usr/local/lib/python2.5/
Queue.py:105(put)
2001 0.062 0.000 0.248 0.000 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:1408(prevent_socket_inheritance)
2000 0.062 0.000 0.125 0.000 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:1134(__init__)
v .23 Stats:
146593 function calls (144969 primitive calls) in 16.003 CPU
seconds
Ordered by: cumulative time
List reduced from 395 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno
(function)
1 0.000 0.000 16.003 16.003 <string>:1(<module>)
1 0.000 0.000 16.003 16.003 {execfile}
1 0.000 0.000 16.003 16.003 ./hello1.py:2(<module>)
1 0.000 0.000 15.653 15.653 /home/worker/test//lib/
python/web/request.py:136(run)
1 0.000 0.000 15.653 15.653 /home/worker/test//lib/
python/web/wsgi.py:24(runwsgi)
1 0.001 0.001 15.653 15.653 /home/worker/test//lib/
python/web/httpserver.py:129(runsimple)
1 0.022 0.022 15.626 15.626 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:794(start)
2053 0.070 0.000 15.499 0.008 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:893(tick)
2053 0.040 0.000 13.816 0.007 /usr/local/lib/python2.5/
socket.py:166(accept)
2053 13.665 0.007 13.665 0.007 {method 'accept' of
'_socket.socket' objects}
146593 function calls (144969 primitive calls) in 16.003 CPU
seconds
Ordered by: internal time
List reduced from 395 to 10 due to restriction <10>
ncalls tottime percall cumtime percall filename:lineno
(function)
2053 13.665 0.007 13.665 0.007 {method 'accept' of
'_socket.socket' objects}
2043 0.976 0.000 0.976 0.000 <string>:1(settimeout)
4127 0.280 0.000 0.280 0.000 {built-in method
acquire}
2041 0.111 0.000 0.184 0.000 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:574(__init__)
11 0.099 0.009 0.099 0.009 {time.sleep}
2053 0.070 0.000 15.499 0.008 /home/worker/test//lib/
python/web/wsgiserver/__init__.py:893(tick)
2043 0.068 0.000 0.111 0.000 /usr/local/lib/python2.5/
socket.py:152(__init__)
2051 0.063 0.000 0.450 0.000 /usr/local/lib/python2.5/
Queue.py:105(put)
2051 0.046 0.000 0.100 0.000 /usr/local/lib/python2.5/
threading.py:249(notify)
2053 0.040 0.000 13.816 0.007 /usr/local/lib/python2.5/
socket.py:166(accept)
On Feb 17, 10:50 am, Aaron Swartz <
m...@aaronsw.com> wrote:
> anand, can you repeat this?
>
> /usr/sbin/ab -c 100 -n 1000
http://localhost:8000/