I'm running Django under Apache+mod_wsgi in daemon mode using the following config:

WSGIDaemonProcess myserver processes=2 threads=15

My application does some IO around the after sales, that could take several seconds.

def my_django_view:
    content=... # Do some processing on backend file
    return HttpResponse(content)

It seems that should i be processing a lot more than 2 http demands which are handling this type of IO, Django only will block until among the previous demands completes.

Is expected behavior? Should not threads help alleviate i.at the. should not I have the ability to process as much as 15 separate demands for any given WSGI process, before I check this out type of wait?

Or shall we be held missing something here?

When the processing is within python, then Global Interpreter Lock isn't being launched -- in one python process just one thread of python code could be performing at any given time. The GIL is generally launched inside C code though -- like the majority of I/O, for instance.

If the type of processing will happen a great deal, you may consider managing a second "worker" application like a deamon, reading through tasks in the database, carrying out the procedures and writing resulsts to the database. Apache might choose to kill processes that take too lengthy to reply.

+1 to Radomir Dopieralski's answer.

When the task takes lengthy you need to delegate it to some process outdoors the request-response cycle, either using a standard cron, or some distributed task queue like Celery