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 <[email protected]> wrote:
> anand, can you repeat this?
>
> On Jan 8, 2009 12:47 PM, "slav0nic" <[email protected]> wrote:
>
> why web.py 0.31 is slowly for hellow world app?
>
> v0.31
> import web
>
> urls = (
>    '/', 'hello'
> )
> app = web.application(urls, globals())
>
> class hello:
>    def GET(self):
>        return 'Hello, world!'
>
> if __name__ == "__main__":
>    app.run()
>
> v0.23
> import web
>
> urls = (
>    '/', 'hello'
> )
>
> class hello:
>    def GET(self, name):
>        return 'Hello, world!'
>
> if __name__ == "__main__":
>    web.run(urls, globals())
>
> -------------------------------
> python  test_webpy.py 8000 2> /dev/null
>
> /usr/sbin/ab -c 100 -n 1000http://localhost:8000/
>
> result :
> v0.31 Requests per second:    66.84 [#/sec] (mean)
>
> v0.23 Requests per second:    640.85 [#/sec] (mean)
>
> WTF?
>
> --~--~---------~--~----~------------~-------~--~----~ You received this
> message because you are sub...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to