Live data from Hacker News

Node.js Has 1 Gb Memory Limit

code.google.com

31–40 of 45 posts

Re: Node.js Has 1 Gb Memory Limit

#31

It would be more correct to say that V8 has a 1G memory limit. But node.js actually gives you these nice things called Buffers which, according to the node.js manual, are "similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap" (see http://nodejs.org/api/buffers.html ). Buffers are used all over the place in node, which should mitigate the degree to which this is actually a pro…

Sure, Node is a nice platform, did not imply otherwise.

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.

Re: Node.js Has 1 Gb Memory Limit

#32
It's probably worth mentioning that the GC cycles start to take upwards of one second at around 500mb of RAM usage with lots of small objects.

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.

Re: Node.js Has 1 Gb Memory Limit

#33
post #15

What rude and demanding bug reports.

Welcome to Web 2.0, where people that think they're programmers try to interact with people that are programmers. The results are often ... depressing.

It's like they don't know what horizontal scaling is or something.

Re: Node.js Has 1 Gb Memory Limit

#34
post #23

Earlier quoted context omitted.

Why? It's been a real bummer for me to find that out (the hard way). 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.

I've tried to explain it in another comment: > 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. (B…

Well, if your data set is big enough to hit that limit then you'll probably need to horizontally scale it out anyway...

Or rewrite in C

Re: Node.js Has 1 Gb Memory Limit

#35
This all boils down to using the right tool for the right task and knowing how to organize your code so you don't run in to limits in the platform components that you use.

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.

Re: Node.js Has 1 Gb Memory Limit

#36

It's probably worth mentioning that the GC cycles start to take upwards of one second at around 500mb of RAM usage with lots of small objects. 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…

Funny how all VMs go through this. Remember when JVM GC pauses killed websites - and how over the years this was fixed by better - non pausing - GC strategies.

Re: Node.js Has 1 Gb Memory Limit

#37

It's probably worth mentioning that the GC cycles start to take upwards of one second at around 500mb of RAM usage with lots of small objects. 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…

Funny how all VMs go through this. Remember when JVM GC pauses killed websites - and how over the years this was fixed by better - non pausing - GC strategies.

That's very easy to explain. A low-pause GC requires a concurrent garbage collector. Writing a correct concurrent garbage collector is VERY tricky, so you usually start with something much simpler. Concurrent GCs typically also add overhead to the mutator (the user program), so it tends to be a trade-off of high throughput vs. short maximum pause times. As an example Java's G1 collector ("Garbage First") took a team of experts about 5 years to get correct.

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.

Re: Node.js Has 1 Gb Memory Limit

#38
post #29
post #22

Earlier quoted context omitted.

A minor re-formatting. > 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.

Hope this helps: "[T]his distinction applies only to which and who . The alternative that is found with both human and non-human antecedents." http://en.wikipedia.org/wiki/English_relative_clauses#Human_...

That's news to me. Language follows speakers, especially influential speakers, and the list of speakers using that for human antecedents includes Shakespeare and Mark Twain, so I guess it's all right now, even if it were an error at some point(grammar isn't static - it has been changing ever since it came into being).

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.

Re: Node.js Has 1 Gb Memory Limit

#39
post #19
post #5

Relevant snippets: "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 don't understand why he has to stop the project just because ONE node.js process cannot handle more than 140K concurrent connections. If the goal is to handle millions of concurrent connections, spreading the connection load out to multiple servers is a must. 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 e…

If you have 140M active users, handling a fleet of 1000 servers is not an easy operation, considering you need to manage inter-cluster communications (i.e. when sender and receiver sockets fell on different servers).

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.

Re: Node.js Has 1 Gb Memory Limit

#40
post #19

Earlier quoted context omitted.

I don't understand why he has to stop the project just because ONE node.js process cannot handle more than 140K concurrent connections. If the goal is to handle millions of concurrent connections, spreading the connection load out to multiple servers is a must. 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 e…

If you have 140M active users, handling a fleet of 1000 servers is not an easy operation, considering you need to manage inter-cluster communications (i.e. when sender and receiver sockets fell on different servers). 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…

I'm a bit curious about this. If you have 140M concurrent users (since this was the original complaint) and you are NOT prepared or capable of servicing/monitoring/maintaining 1000 servers, that seems like a fatal flaw in your server management and analytics processes.

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.

Post reply on HN