etianen / aiohttp-wsgi

WSGI adapter for aiohttp.
https://aiohttp-wsgi.readthedocs.io
BSD 3-Clause "New" or "Revised" License
232 stars 20 forks source link

Running under multiple processes? #9

Closed jared-mackey closed 8 years ago

jared-mackey commented 8 years ago

Is it possible to run this under multiple processes using a ProcessPoolExecutor to allow scaling past a single process? I have tried to replace the default executor with the ProcessPoolExecutor but get some pickling errors.

If not, is there a way to expose the whole app to apache/nginx/gunicorn?

This looks interesting but I have no idea how to implement it into a project.

jared-mackey commented 8 years ago

After reading more of aiohttp's docs I see I can run it under gunicorn. ❤️

etianen commented 8 years ago

Running it under gunicorn will run multiple aiohttp instances, each of which will have a thread pool for aiohttp-wsgi. Which is probably a nice way to utilise multi-code.

Running under a ProcessPoolExecutor would be relatively easy to accomplish, but would involve removing some of the aiohttp and asyncio keys that were added to the wsgi environ if a process pool executor is detected.

On Tue, 9 Aug 2016 at 05:26 Jared Mackey notifications@github.com wrote:

After reading more of aiohttp's docs I see I can run it under gunicorn. ❤️

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/aiohttp-wsgi/issues/9#issuecomment-238450163, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCNrWouJj8HrU2MQYo-AvQOQjH9W3ks5qeAF0gaJpZM4JfshU .

jared-mackey commented 8 years ago

Yes, using gunicorn was the easiest way to go. With -w4 I get 4 loops running individually of each other and it is working great.