News for hackers. Stuff that matters.
Re:Optimizing Nginx, Node.js and networking for heavy workloads by zerop on Monday January 21, 2013 @01:56PM (#5093013)
should nginx be only used for serving static files. Does it have any advantage when used to serve plain data API. I want to expose REST api (django + uwsgi) over web, but not sure if should use nginx for it.
Re:Optimizing Nginx, Node.js and networking for heavy workloads by jiggy2011 on Monday January 21, 2013 @02:11PM (#5093118)
I think this basically boils down to: "are you likely to have many users connected concurrently at any one time"

If your API basically involves a client connecting, quickly getting a small JSON/XML response and then disconnecting again you are probably absolutely fine with Apache unless you have truly enormous numbers of users.

OTOH if the socket is likely to be held open for a while, because maybe the API responses can take some time to be returned or the client is likely to hold the connection open in order to get a stream of data over time then you may get more mileage out of nginx.

Re:Optimizing Nginx, Node.js and networking for heavy workloads by zerop on Tuesday January 22, 2013 @12:15AM (#5095660)
service returns quick & short JSON responses and huge number of users are going to hit it. So basically there are going to be enormous concurrent connections each returning quick and short json response. No heavy work by each connection, just that there are too many.
Re:Optimizing Nginx, Node.js and networking for heavy workloads by benesch on Monday January 21, 2013 @02:06PM (#5093076)
There's probably nothing inherently wrong or slow with running Django through nginx.

That said, one of the most common deployment strategies is gunicorn. It's better documented [1], and it's always good to separate your web app server from your static file server/CDN.

[1] https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/...

Re:Optimizing Nginx, Node.js and networking for heavy workloads by d0m on Monday January 21, 2013 @05:46PM (#5094212)
I've had great success with nginx as the main entry to serve static files and direct the traffic at a django w/ gunicorn. Add a small supervisor system and you've got a very simple but robust server.
Re:Optimizing Nginx, Node.js and networking for heavy workloads by robertfw on Monday January 21, 2013 @06:28PM (#5094401)
we use nginx - uwsgi - django and are quite pleased with the combination. between nginx/uwsgi, there are plenty of configuration options to let you optimize for your particular use case, and don't see any potential issues in terms of adding new capabilities to our setup (minus web sockets, but as mentioned in another comment that is coming soon / available with plugins)