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

What's the benefit for aiohttp-wsgi + django? #11

Closed gera2ld closed 7 years ago

gera2ld commented 7 years ago

It seems that aiohttp-wsgi just runs an application in an executor, which by default is just a thread pool, with a default pool size of 5 threads.

So if the application is designed with blocking APIs, such as flask and django, it will actually be executed via multi-threading and could not take advantage of co-routines. Then what's the benefit for using aiohttp-wsgi?

etianen commented 7 years ago

An excellent question!

If you're only going to use Django, then there's no real advantage over using any other wsgi server. A few minor advantages include:

However, the main reason this library exists is that it allows you you run Django alongside an aiohttp application, allowing you to implement critical pieces of your app as async, but keep most of it inside Django.

On Sat, 15 Oct 2016 at 14:16, Gerald notifications@github.com wrote:

It seems that aiohttp-wsgi just runs an application in an executor, which by default is just a thread pool https://docs.python.org/3/library/asyncio-eventloop.html#executor, with a default pool size of 5 threads.

So if the application is designed with blocking APIs, such as flask and django, it will actually be executed via multi-threading and could not take advantage of co-routines. Then what's the benefit for using aiohttp-wsgi?

— 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/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCDxLwZi0_YdWNARG7C2o-stjDM4Aks5q0NIzgaJpZM4KXtES .

gera2ld commented 7 years ago

That makes sense. Thanks a lot!