famzah/langs-performance

Java JVM configuration

archenroot opened this issue · 4 comments

You should in minimum calculate heap and offheap space and configure it via Xms=Xmx=3G for example and also configure MetaSpace.

Additionally there is common set of JVM PRODUCTION grade configuration settings which affect performnce a lot.

Something like:
Java >= 8
-server
-Xms[g|m|k] -Xmx[g|m|k]
-XX:MaxMetaspaceSize=[g|m|k]
-Xmn[g|m|k]
-XX:SurvivorRatio=
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=
-XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark
-XX:+PrintGCDateStamps -verbose:gc -XX:+PrintGCDetails -Xloggc:""
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M
-Dsun.net.inetaddr.ttl=
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=date.hprof
-Djava.rmi.server.hostname=
-Dcom.sun.management.jmxremote.port=
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

Lastly, what is causing the delay in these synthetic tests usually is the JVM startup itself. I am curious about JVM preloaded into memory based results by using:
https://github.com/martylamb/nailgun

If you are not interested or don't have time to do this, I will as I think Java will win finally :-)

Hi, this has been discussed already. Hinting Java about the needed memory usage isn't fair. You can review the following: https://github.com/famzah/langs-performance/tree/master/java-optimizations

It's not the JVM startup delay which is being accounted here. The tests run for 90 wall-clock seconds and the startup time is a negligible part.

Feel free to do your own tests and to prove me wrong. But don't do any JVM optimizations which are tightly coupled with this task like memory/heap size and GC tuning.

If those config options are such a silver bullet for performance, why aren't they defaults for JVM?

Well, each system is different and meant for different load, I like the idea to tune it for specific purpose. It is not big deal when you get in.

Anyway I think one of biggest improvement (out of JVM tuning) is to use non-builtin data structures to prevent unboxing/boxing as I see you described it in the tuning docs. I really wonder why those are not included in JDK class set.

Thanks for your work - similar to https://benchmarksgame.alioth.debian.org/ approach.