Python Forum

Full Version: WSGI Multi processing.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am using WSGI module for running a RESTful interface application. Application is running fine. When i use a multiple requests simultaneously , from the Run-Console i see these requests are served sequentially causing too long wait times for the requests.
My REST request program(Simulator of 3~5 REST requests) is multi-threaded and i see all the threads are initiated at the same time. I am not sure whether WSGI is doing multi-threading or multiprocessing and need help in steps to find the same.
I use Pycharm IDE over windows operating system.

Currently i have :
from wsgiref.simple_server import make_server

def Main(environ, start_response):
status = '200 OK'
headers = [('Content-Type', 'application/json')]
start_response(status, headers)
<Application Code>

if __name__ == '__main__':
with make_server('', 8000, Main) as server:
print("Serving on port 8000...\nVisit http://localhost:8000\nTo kill the server Ctrol + C..\n")
server.serve_forever()

My reference to WSGI documentation mentions a configuration file like "wsgi.ini" and entries like wsgi.processes = <number> . Not sure whether i have to manually create this file and store in a specific directory to initiate a multiprocessing or threading.

Appreciate your help.

Regards,
Simbha
Please use proper code tags while posting your thread.