3 ms·
Benchmarking node, tornado and django for concurrency
- netnichols 16y agoAm I missing something? Django isn't a server, it's a framework. Why was this included in the "benchmark"?
- Swizec 16y agoBecause node isn't a server either. It's a framework for handling requests. Also django has all the batteries needed to run as a server and it's interesting to note how much performance is affected when there are too many batteries included.
- piranha 16y agoThis has nothing to do with batteries, but rather with how it works. Comparing ability to process concurrent requests for django vs node is like comparing apples to buildings. They are a bit different.
- Swizec 16y agoYes, but at the end of the day, both django and node get used to handle concurrent requests. It pays off to know how they compare in this task.
- ominous_prime 16y agoNot to beat a dead horse, but django is a framework, the concurrency part is handled by another layer. You were testing how well django's test server handles concurrency; that's all.
- deleted 16y ago[deleted]
- mrud 16y agoThe really big and important difference is that node handles the requests directly and django is served via an additional server like apache/nginx/lighty.
- freyrs3 16y agoThey tested Django development sever which is not meant to be used in production, it's going to be incredibly slow at pretty much everything. A better concurrency benchmark would be running Django with asynchronous gevent workers.
- simonw 16y agoDid you run your benchmark against Django's ./manage.py runserver development server? If so, it's no wonder you got bad results: that server is single threaded and the documentation explicitly warns against ever running it in production.
- anthonyb 16y agoNot just that, but he didn't appear to switch DEBUG off: https://github.com/Swizec/random-coding/blob/master/serverbench/django_bench/settings.py https://github.com/Swizec/random-coding/blob/master/serverbe...
- jerf 16y ago"Also django has all the batteries needed to run as a server" Last I knew, this is not true, and glancing back at the docs for Django it appears to still not be true. It ships with all the batteries for a debug instance of a server, which is meant to help developers work with their Django apps without having to go through a full "deploy to Apache, restart" cycle every time they change anything, but the debug server is not at all intended for production use. Production use requires a dedicated webserver like Apache or nginx. If this benchmark used Django's internal webserver, it's entirely invalid. If it didn't, it ought to say what it did use.
- mrud 16y agoYou are right. node is a i/o framework. And because of that you can write easily servers, like http servers. Which you did. And Django is also a framework. But not for handling i/o requests or writing arbitrary network programs but for writing web applications. But comparing a web application framework with an i/o framework and an http server is comparing apples and oranges. Both are fruits but thats it. But comparing node with django, where the request is handled by another server like nginx/lighty/apache feels somehow really wrong. tl;dr don't just compare two things because both are a framework.
- 18pfsmt 16y agoI have the same question. This benchmark seem to be comparing apples and oranges. I'm just moving from sysops to dev, so I hope someone can explain, but here is how I see the three items being compared: Django- a python web framework Node.js- a javascript server framework Tornado- a non-blocking webserver
- Swizec 16y agoThe thing I was going for is that all three of these get used to handle concurrent requests so it pays to know how they compare in this task. All of them act as a server, often behind nginx or something, all of them take a request and pump out a response. They're not that different.
- lamby 16y ago> All of them act as a server Django is not a server. How did you even make it serve HTTP requests for your benchmark? (Please don't say "runserver")
- Swizec 16y ago./manage.py runfcgi The django docs recommended way of running it behind nginx.
- mrud 16y agoSo you compared nginx with django via fastcgi to node and tornado? JFTR, this benchmarks feels strange. Please describe next time how you setup django/tested it and describe the whole software stack. This is important while comparing and understanding benchmarks. You never provided details about your django setup.
- ericmoritz 16y agonginx+uwsgi FTW
- asolove 16y ago<snark>I was just asking myself: "Hmm, do I want an environment for writing network programs, an asynchronous web server, or a web application framework?" But now I can decide based on a statistically-naive comparison of their concurrency performance!</snark> Seriously, though, solve your problems by seriously looking at what the available tools provide, rather than benchmark numbers or "new hotness" stuff you see on HN. Each of these is a fantastic tool for an appropriate problem, but I don't think there is any problem where any two of these would be in competition.