News for hackers. Stuff that matters.
Re:How to get C like performance in Java by sehugg on Wednesday July 20, 2011 @12:32PM (#2786330)
For servers, memory is usually the long tent pole. For me it boils down to:

* Use less memory.

* Don't use a lot of threads.

* Use fewer objects.

Worst-case GC is a big issue. For just a 2 GB heap you are looking at up to 7 second GC pauses with the Java 6 collector. You can use concurrent GC but it adds significant CPU and memory overhead. Direct buffers don't live in the heap so they don't contribute to GC time.

Threads in Java are extremely heavyweight in memory, if not in CPU. A rule of thumb is about 1 MB per thread. You can make it better by decreasing the stack size and/or using 32-bit addresses.

Re:How to get C like performance in Java by peter_lawrey on Thursday July 21, 2011 @05:06AM (#2788913)
If you create low enough garbage and your eden size is large enough, you can avoid having any minor collections at all. I have a full GC which is triggered once per night as maintainence.
Re:How to get C like performance in Java by gaius on Wednesday July 20, 2011 @04:33PM (#2787306)
So use JRockit with deterministic GC on.
Re:How to get C like performance in Java by uriel on Wednesday July 20, 2011 @12:45PM (#2786394)
This is one of the greatest efficiency advantages of Go over Java, for the same task, Go code uses only a tiny fraction of the memory of what Java uses.

http://shootout.alioth.debian.org/u64/benchmark.php?test=all...