It's surprising how hard it is to find out when the GIL is actually locked. 
Just because some IO is blocking doesn't mean the GIL is locked, and if the 
GIL is not locked then other requests should be processed because other 
threads will be run. Your blocked thread waits, but as long as the GIL is 
not locked other threads will be executed in the meantime (which means 
other requests will be served). 
I actually don't understand what IO locks the GIL; most of the time IO is 
not supposed to lock the GIL. My previous reply implies that the GIL is 
locked but I doubt this is the case.


On Thursday, 4 December 2014 11:49:31 UTC+11, Tim Richardson wrote:
>
> Does your RPC call actually block other requests?
>
> Edit: Oh, it does because standard library is blocking here. I often 
> wondered if a non-blocking alternative would help here. (the requests 
> module has a non-blocking alternative which is easy to use but I haven't 
> tried it in a web2py request. I suppose if it releases the GIL it should 
> solve your problem). 
>
> Some webservers can handle requests in process pools, not just one process 
> running a thread pool. So the server won't block (I assume) if it can find 
> a non-blocked process to handle the next request. But it certainly won't 
> scale well because you would need a n+1 request-handling processes for n 
> blocked requests. 
>
> Leonel's suggestion is to make the client wait by doing the request on 
> their browser via javascript.
>
>
>
>
>
> On Tuesday, 2 December 2014 06:29:36 UTC+11, Matt Broadstone wrote:
>>
>> Hi,
>> We're making a number of rpc calls to other services using jsonrpc, and a 
>> few of them are particularly long running. I'd rather not use the 
>> scheduler, but instead was wondering if I could associate a jsonrpc 
>> httpclient in python to the current context so that longer tasks wouldn't 
>> block other incoming requests. I tried initially to just do a setattr on 
>> current (it's thread local storage as far as I understand), but that 
>> doesn't seem to work. Anyone have better ideas? Or am I just doing this 
>> completely wrong.
>>
>> Cheers,
>> Matt
>>
>

-- 
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