Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How many node JS instances are you running on this machine? I am guessing 4? 1 per core and each one is aimed to handle 50k idle connections? And if you are running more then one, how are you load balancing them? Nginx?

Also I would like to note I saw your Tornado vs Node.JS hello world test and it made me curious because we use Tornado and we really believed that it was the fastest.

So I looked at your results and noticed Tornado had 100x more bytes transfered in your AB test. So I decided to run your same test on a raw Tornado HTTP server (not using the web.py framework) and these were the results of Hello World.

These tests were ran on an 3.66 i7

Tornado (single instance):

import tornado.httpserver import tornado.ioloop

def handle_request(request): message = 'Hello Word' request.write("HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\n%s" % ( len(message), message)) request.finish()

http_server = tornado.httpserver.HTTPServer(handle_request) http_server.listen(8009) tornado.ioloop.IOLoop.instance().start()

ab -c 100 -n 4000 http://127.0.0.1:8009/ Requests per second: 10037.84 [#/sec] (mean)

Node.js (single instance):

var sys = require('sys'), http = require('http'); http.createServer(function (req, res) { res.sendHeader(200, {'Content-Type': 'text/plain'}); res.sendBody('Hello World'); res.finish(); }).listen(8008);

ab -c 100 -n 4000 http://127.0.0.1:8008/ Requests per second: 9159.65 [#/sec] (mean)

However doing the test the way you did it did show the results you had with Tornado being 2x slower, however I don't believe that was a fair test at all.

Just my input.



Like noted in that benchmark it's non scientific and it should be taken with a grain of salt - - like any other benchmark. It should be said thought that I have evaluated both Twisted and Tornado on a lot of open connections in production and they did not scale (capped on CPU and used too much memory).

Also regarding node.js we run around 8 I think and we plan to introduce more as node.js does not have threads or processes and currently our CPU and memory usage is very low. They are load balanced from our Python servers, but nginx would be a good load balancer as it's non-blocking.

It should be said that I have coded a lot in Python and I love Python - - so I don't have any bias and I would gladly use Python if it could scale.


I think the speed you see as a difference may be coming from how you're writing the data, node requires multiple function calls to do the writing of data (unless you use a raw tcp socket), tornado appears to just take it all in one function call, which takes in a string.


My point was not to say that Tornado is faster, but that his test is far off from proper results.

His tested showed that Tornado was 2x slower the Node.jsbecause he did it wrong, I actually find Node.js rather impressive =)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: