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

aiohttp-wsgi on heroku #12

Closed codingjoe closed 7 years ago

codingjoe commented 7 years ago

Hi Dave,

if I remember correctly you wrote the article on why to use Waitress on Heroku. Now since you came up with this server, how does it do on heroku? Can you recommend using it? I'd love to hear your thoughts on this.

Cheers -Joe

etianen commented 7 years ago

aiohttp-wsgi should work fine on Heroku, as it acts as a buffering reverse proxy. The aiohttp-wsgi-serve command line interface should serve your needs just fine.

I'm not sure how performance compares with waitress. The only caveat is that aiohttp-wsgi does not support streaming responses. Streaming responses are generally not needed in Python wsgi apps, but your app my be different.

It's less mature than waitress, but it's static file server is better than serving files via the wsgi app.

On Wed, 14 Dec 2016 at 19:06 Johannes Hoppe notifications@github.com wrote:

Hi Dave,

if I remember correctly you wrote the article on why to use Waitress on Heroku. Now since you came up with this server, how does it do on heroku? Can you recommend using it? I'd love to hear your thoughts on this.

Cheers -Joe

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

codingjoe commented 7 years ago

Wait, so you want to server static files using, lets say, whitenoise and aiohttp-wsgi or just aiohttp? Anyways, thanks for the quick response. This project looks really interesting, especially if you are able to get all your IO on the event loop. I'll give this a shot sometime, I'll let you know about my findings.

etianen commented 7 years ago

Let me clarify:

Using whitenoise and waitress to serve static files means that the wsgi app serves static files. This means that a worker thread is used for static file download, which isn't great.

Using aiohttp-wsgi and the --static argument to the CLI serves static files directly from the event loop, bypassing the wsgi app altogether. It also supports using unix sendfile where available. Much better!

If you have any other questions, do no hesitate to ask!

codingjoe commented 7 years ago

thanks, since you offered. the --static: how does it handle HTTP caching/expiration? Are they any headers I need to be aware of?

etianen commented 7 years ago

The static handler supports:

It doesn't appear to support setting any cache-control headers on the response.