Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use nginx to deploy tornado instead of its built-in server?

Tags:

nginx

tornado

I found out that we can run the tornado application from just firing something like python main.py. But everyone else says to deploy tornado with nginx. What are the benefits? I know it's a bit foolish, but I really am confused.

like image 421
Sabbir Avatar asked Apr 30 '14 17:04

Sabbir


People also ask

Is Nginx a WSGI server?

FastCGI is a widely used interface for PHP, Python, and other languages. However, a more popular choice for communication between Python and NGINX is the Web Server Gateway Interface (WSGI).

Does Nginx work with Python?

Nginx also functions well as a reverse proxy to handle requests and pass back responses for Python WSGI servers or even other web servers such as Apache.


1 Answers

See the notes on Nginx in the Tornado docs:

http://tornado.readthedocs.org/en/stable/guide/running.html

Since one Tornado process can only take advantage of one CPU core (Edit: See updated docs for a development on this), use Nginx to load-balance multiple Tornado processes to use multiple cores Additionally, Nginx is likely a more efficient static file handler than Tornado.

like image 172
A. Jesse Jiryu Davis Avatar answered Sep 28 '22 11:09

A. Jesse Jiryu Davis