Node.js Has 1 Gb Memory Limit
code.google.com
code.google.com
Buffers are used all over the place in node, which should mitigate the degree to which this is actually a problem. Even if this bug report stays a wontfix, it won't affect my decision to use node because of Buffer support.
For a certain category of apps it helps to know the limits beforehand, though (I've described my use case in another comment). I think this particular limit deserves to be more widely known.
This limit doesn't stop you using NodeJS, but it's definitely something newcomers should be made aware of before they start writing database servers or making heavy use of a naive in-memory cache through an object literal.
Hopefully when the new GC gets rolled out we'll really be able to let loose with the RAM usage.
OTOH, writing a standard (single-threaded) Cheney-style copying GC can be done in a few days. Actually, the more time consuming part for me was to get all the pointer information to the GC.
"diego.ca...@gmail.com, Sep 19, 2010
... In my case, I've been forced to suddenly stop my work ... with node.js because it cannot handle more than ~140K websockets concurrent connections ..."
"erik.corry, Nov 2, 2010
The limit for 64 bit V8 is around 1.9Gbytes now. Start V8 with the --max-old-space-size=1900 flag."
I'm doing something similar with node.js now to handle millions of concurrent connections. I use multiple node.js servers to handle it. Not only it helps in even out the load, it has the nice failover property. One node down doesn't mean the whole app is down. Clients of the down node migrate their connections to the rest of the nodes.
I've built Erlang/OTP websockets clustered server, which can handle 3M per node (giving you have enough RAM). Here you handle all your users with "only" 47 servers.
There is a big operational and scaling difference between cluster of 1000 servers and cluster of 47 servers.
Certainly 47 servers vs. 1000 is far nicer. But at 140M concurrent users levels (there must only be a few handfuls of sites with these types of concerns), not having a team prepared to oversee 1000 servers seems like folly.
Nodes in the cluster need to communicate with each other and with other systems, like databases, message queues, monitoring servers, etc.
You can aggregate data per node, so the less servers in the front-end cluster you have, the less load on the back-end servers.
There is also financial problem: many organizations can afford 50 servers. But not many can afford 1000 servers.
In case you're wondering, here's a test case: https://gist.github.com/1148761
I was told by one of the V8 developers that the new GC is pretty usable now, so worth giving it a shot if you need more than 2 Gb.
> Welcome to Web 2.0, where people who think they're programmers try to interact with people who are programmers. The results are often ... depressing.
I was confused by your initial framing of the sentence, though my not being a native speaker would have played a part.
Now I am wondering about why I thought that isn't to be used for human antecedents. Was it an error earlier or it changed recently? If it was an error earlier, Shakespeare using it doesn't fit.
In this case, the obvious solutions are to either use 'buffers' (think of them as extended memory from the old days) or to use multiple instances on the same machine or spread over several machines.
If you write your code in such a way that you end up handling all your users in a single process then you will sooner or later run in to some limitation.
"Sorry, Google, but your open-source project is important to much more of the world than just >your browser< now; and while this may not be an issue for the zones of impact >you< care about (said browser.), it’s a >huge< issue for much of the area where V8 is important in general in the modern (post-Node) world."
You know Google is biting their tongue at what they really want to say to complainers like this. You really want it working for Node? Roll up your sleeves and get to refactoring. Hell, they even explained how to fix it.
And technically the memory issue has already been resolved if you read the comments in the bug posting. The next GC release won't have any of these drawbacks. So really the problem is isolated to any node projects currently in production.
Knowing about the limit is hurting you, or you have really faced this constraint in a project? As mentioned elsewhere, node has buffers which are allocated outside of v8 heap, and the user data will largely be unaffected by the memory limit if you are using buffers.
> To add my own perspective: I was running some analytics batch job on Node and hit this limit, had to add multi-stage processing to accommodate it. Using --max-old-space-size=1900 did help a bit.
So yeah, it did affect me, although not on a typical web project. It wouldn't be a problem at all if I knew about this limit from the start. Thus this is a warning for others.
(BTW another limit I was told about is that objects can't have more than a million keys. Thankfully I did not hit that one.)
Or rewrite in C