On 15 Mar 2014, at 8:19 AM, Niphlod <niph...@gmail.com> wrote:
> @mcm: you got me worried. Your test function was clocking a hell lower than 
> the original script. But then I found out why; one order of magnitude less 
> (5000 vs 50000). Once that was corrected, you got the exact same clock times 
> as "my app" (i.e. function directly in the controller). I also stripped out 
> the logging part making the app just return the result and no visible changes 
> to the timings happened.
> 
> @hh: glad at least we got some grounds to hold on. 
> @mariano: compiled or not, it doesn't seem to "change" the mean. a compiled 
> app has just lower variance. 
> 
> @all: jlundell definitively hit something. Times are much more lower when 
> threads are 1.

In a normal web2py-wsgi installation, we'd expect all the threads to be idle, 
waiting for an incoming connection, right? So here's another test. IIRC, Rocket 
is built to run 10 threads minimum by default. So in the standalone test, fire 
off 10 threads that open a socket and wait for a connection, and then run the 
test loop. To make it easier, I'd first try having them just sleep until 
they're woken up and terminated by the test thread; it's not clear why waiting 
on a socket would be more overhead than being in any other idle state (OTOH 
it's not clear why idle threads should create overhead at all....)

And that suggests yet another simple test: raise Rockets minimum thread count 
from 10 to 100 and see what difference that makes.

> 
> BTW: if I change "originalscript.py" to 
> 
> # -*- coding: utf-8 -*-
> import time
> import threading
> 
> def test():
>     start = time.time()
>     x = 0.0
>     for i in range(1,50000):
>         x += (float(i+10)*(i+25)+175.0)/3.14
>     res = str(time.time()-start)
>     print "elapsed time: "+ res + '\n'
> 
> if __name__ == '__main__':
>     t = threading.Thread(target=test)
>     t.start()
>     t.join()
> 
> I'm getting really close timings to "wsgi environment, 1 thread only" tests, 
> i.e. 
> 0.23 min, 0.26 max, ~0.24 mean
> 
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to