Search code examples
djangomultithreadingapachedotcloud

concurrent requests on dotcloud with django


I have a django app I want to migrate to dotcloud. Many actions in Django internals and in my app are not asynchronous, i.e. they block the thread until they finish. When I was using Apache, that didn't pose a problem since a different thread is opened on every request. But it doesn't seem to be the case in nginx/uwsgi that dotcloud use. Seemingly, uwsgi has a --enable-threads and --threads options that can be used for multithreading, but:

  1. It is not clear what version of uwsgi dotcloud use, and if they support these features
  2. Since I have no one else asking about this, I was wondering if this is really the right way to get the concurrent requests running (using threads)

Solution

  • You could run Django with Gunicorn. Gunicorn, in turn, supports multiple worker classes, and people reported success running gunicorn+gevents+django together[1][2].

    To use that on dotCloud, you will probably have to use dotCloud's custom service. If that's something that you want to try, I would personally start with dotCloud's reimplementation of python service using the custom service, and replace uwsgi with gunicorn in it.