To answer simply, yes the embedded Rocket server will handle 
multiple simultaneous requests. However, if you have long-running processes, 
they may force Rocket to wait until they are finished before responding to 
additional requests. This is easy to overcome by using Python's multiprocess 
module. For example, I have a script to batch insert a bunch of records into 
the database. The script takes about a minute to run and is started by an 
ajax call. So in web2py, I created a scripts.py module and imports 
multiprocessing, then subclasses the Process class.

When the ajax call comes in, web2py instantiates my script module, then 
calls run() to start a new process that does all the work. The moment that 
run() is called, execution continues so that other incoming requests can be 
handled and the script runs in the background. Just for fun, I also made my 
script report progress so that another ajax call could get the status of it.

Reply via email to