Go vs Scala vs NodeJS
These test are run with:
ab -c 100 -n 50000 http://localhost:8000/
The memory usage is analyzed with : pmap $PID | tail -1 >> mem.txt; SLEEP 0.001
| Req/s | Mem | ||
|---|---|---|---|
| Go | 9428.90 | ~18.5M | |
| NodeJS | 5775.84 | ~646M | |
| Java(Netty) | 7086.34 | ~2 434M | (No flags) |
| " | 6931.62 | ~512M | (-server -Xmx128m -XX:+UseConcMarkSweepGC) |
| " | 9682.42 | ~577M | (after a couple of runs for JIT warmup ) |
Conclusion ?
The mem test takes into account all the libraries loaded by the process as this seemed to be the fairest comparison.
The Java version might be doing a bit more than the the others since it was an experience I had here... Without explicit JVM flags it gets very memory hungry and I bet that a -server flag without memory restrictions would be a huge mem hog. Fortunately the last tests show that with a memory usage similar to NodeJS's it does a whole lot better (I'm happy cause I can keep using Scala instead of Javascript :P)
NodeJS has a lot of hype around it and it definetly deserves it but without the web workers support it is not capable of taking full advantage of several cores and you'd have to go with a local pool and a load balancer in front of it. It's memory usage is not the best.
Finally Google's Go is surely the big winner here. With very little memory usage and good performance it is the undisputed champion. Also, I'm using the 6g compiler but have read somewhere that gccgo could bring a 50% improvement. The language's not great but it sure beats C, C++ and even Java in my book ;)