nodejs ( experience / comments [closed]

Tag: node.js Author: LIHUIZHAO29 Date: 2010-09-20

Has anyone experience with nodeJS? how about performance? memory management?

I'm looking for a technology that allows me to create a real-time web app tracking system and a chat.

If you considered and decided to don't use it, what did you use?

Best Answer


Node.js' strengths come from its ability to keep a lot of connections open and idle. Where for instance Apache would need a connection limit (sometimes it's as low as 20 concurrent connections, depending on your server environment) because it allocates 2 MB of memory to each connection, Node.js doesn't need that. Apache also doesn't like keeping connections open because of this problem, and keeping connections open becomes a hassle.

A node app is programmed as a single thread (though in the background it uses threads for various blocking operations, but not on a per-connection basis). If you've programmed in Erlang you may know how liberating it is to not having to care about what the other agents (or connections) are doing, while still being able to share data between the (virtual) instances without any extra effort.

In theory Node can handle as many connections as the max number of file descriptors/sockets allowed on your system. In windows (using cygwin) this is about 65536, and on unix i bet more is possible, though unlimited in theory (with the server end on port 80, 65536 connections can be handled to each destination). In Apache this would cause a memory allocation problem long before hitting even 2000 users.

In reality these are just numbers, and they are affected by a bunch of other things, such as how much data can your app actually handle passing through to a given subset (or even all) of the connections. The more realistic estimate is that it can handle 20-25.000 users with average activity without any significant lag. The only pure single-server setup i know that can handle this many concurrent users is an IRC server programmed in C, though there are probably a few web servers too (like nginx) that could deal with it.


Node uses Google's V8 JavaScript engine, meaning that it's fast and getting even faster every week.

An advantage of Node is that it uses asynchronous I/O, so that when one user has to wait for a file to be read from disk or a database call, node puts that in the background (remember i said it uses threads in the background) and let's that wait, while in the main thread it moves on to the next task. This makes sure that it always keeps moving. Even if any given user may have a slight delay, the others aren't held up by it.

This is the library to use for your communication. You can find out more on

It also comes with a chat example that is so easy, you can't help feeling that it's awesome.

Oh, and remember to try Node for yourself and make a decision based on that. It's not great for everything, but it's a good choice for a lot of things.


thanks, this is very clear and focused. anybody else has an opinion on this?
Why does Apache needs 2 mb of memory?
@Jayram - it's for a lot of things, mainly it's buffers and processing (for instance php has to operate within that limit, if you run it as cgi)

Other Answer1

Other popular and high-performance options for custom web applications: Python -> Twisted Erlang -> Mochiweb -> Comet

node.js is fairly new, and doesn't have the depth of support libraries that something like Twisted or Erlang does. If you don't need all of those libraries, though, it seems like a reasonable option. Its threading behaviour is similar to that of Python, so it should scale similarly to Twisted. If gazillions of users on a single multi-core node is important to you, it seems as if Erlang has it beat, though.

Other Answer2

Performance benchmarking with node.js (also tornado and deft) is visualized in