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

> For many types of common webserver workloads (i.e. lots of IO, relatively minor CPU usage), NodeJS can actually scale much better than Java with its thread-per-request model

Linux can handle a ginormous amount of threads quite well, would be interesting to see a deeper investigation to this theory.



The problem with doing it all native is that stack sizes are quite variable, especially in managed languages where modularity and code reuse works better, so it's common to have tons of libraries in a single project. The kernel won't object to lots of threads, but once those threads have been running for a while a lot of stack space will be paged in and used.

Loom solves this by moving stacks to and from the heap, where there's a compacting concurrent GC to clean up the unused space.


Java uses some memory for stack, about 1MB for each thread.


This is configurable, and 1MB is very generous. I think the JVM automatically grows the stack size as needed nowadays and starts low.


This doesn't in practice limit scaling though as it's linear and small in absolute terms vs what you can put in a server.




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

Search: