Thanks for the suggestions, as well as helping with my somewhat
ambiguous question :). I'll try time.sleep, and moving to tornado, as
a belt-and-suspenders kind of approach. I am using rocket and didn't
realize the GIL was an issue.

Chris

On Mar 2, 7:37 pm, Ricardo Pedroso <[email protected]> wrote:
> On Fri, Mar 2, 2012 at 4:33 AM, Chris <[email protected]> wrote:
> > I've got a web2py app that processes an uploaded file. When I upload a big
> > file, it pushes the CPU to 100% and blocks out all other processes.
>
> > How do I limit this thread so that other things can go through? Any ideas
> > would be great.
>
> The info that you gave is not sufficient to give an accurate answer.
>
> What are the webserver?
> If it's the rocket webserver bundled with web2py than if you have a
> thread with CPU intensive task
> it will block the others threads. This is due to the python GIL.
>
> Probably you have some loops to process the file,
> so just use time.sleep inside those loops.
> Using time.sleep will release the GIL giving other threads a chance to run.
>
> time.sleep(.1) should do it.
>
> Ricardo

Reply via email to