Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clarification: Does Heroku Run Python Apps Behind Nginx or Not?

TL/DR: My primary question: Is it worth my time to try to add NGinx to my Django/Gunicorn/Cedar/PostgresSql app or does Heroku do this type of performance improvement for me?

In the Cedar documentation (https://devcenter.heroku.com/articles/cedar), it clearly states that cedar does not support a reverse-proxy. "Cedar does not include a reverse proxy cache such as Varnish, preferring to empower developers to choose the CDN solution that best serves their needs."

Again in the Routing article (https://devcenter.heroku.com/articles/http-routing#gzipped-responses), it is specified that nginx is not done automatically: 'Since requests to Cedar apps are made directly to the application server – not proxied through an HTTP server like nginx – any compression of responses must be done within your application."

However, in the Python Faq, it says otherwise: https://devcenter.heroku.com/articles/python-faq#do-python-applications-run-behind-nginx "No. There is no need for using a reverse proxy on Heroku because the Heroku Cloud Platform takes care of everything those servers normally do for you.

Your application simply provides a Python server to respond to HTTP requests.Gunicorn, Gevent, and Eventlet are excellent options.

Because the web server is embedded in your application, you can easily test and debug the exact same code in any environment. This development and production parity makes it easy to troubleshoot problems during your development cycle."

It seems to me like Heroku takes care of some of the benefits of reverse proxies, but not compression. Is that true?

like image 843
BFar Avatar asked Oct 10 '12 00:10

BFar


People also ask

Does Heroku use nginx?

Installing Nginx on Heroku You can run multiple processes and applications in your Dyno by using the Heroku Multi Buildpack in combination with the Heroku Runit Buildpack. This allows you to specify any amount of buildpacks to run on one Dyno.

What does Heroku run on?

Heroku runs your apps inside dynos — smart containers on a reliable, fully managed runtime environment. Developers deploy their code written in Node, Ruby, Java, PHP, Python, Go, Scala, or Clojure to a build system which produces an app that's ready for execution.

Does Heroku work with Python?

Heroku runs your app in a dyno — a smart, secure container with your choice of Python version. Dynos come in different types, ranging from free dynos for getting started, to dynos at $7 per month for hobby projects, all the way to dedicated types for your highest-traffic apps.

What server does Heroku use?

The Heroku platform uses Git as the primary means for deploying applications (there are other ways to transport your source code to Heroku, including via an API).


1 Answers

Heard back from Heroku Support:

We do not recommend trying to add nginx to your stack, nor does Heroku provide that layer. But you are correct that if you wish to gzip responses, your application must gzip the responses - this is often handled in application framework (e.g. Ruby's Rack) as a middleware layer. gzip is extremely fast and this should not add any significant latency to your requests.

This confirms that you do not need to run Nginx for its reverse proxy feature on Heroku.

like image 188
BFar Avatar answered Nov 09 '22 10:11

BFar