Links for more, along with default config and others, that I either came across and rejected, or came across and am pondering.
Start with this, it's default for a reason.
-server
- there are client and server compilers in the JDK. Client is about fast start-up, server is about long running (simplification). Since JDK 7 though we have-XX:+TieredCompilation
, so...-Xms128m
- 128 MB for initial heap size.-Xmx512m
- 512 MB for maximum heap size.-XX:ReservedCodeCacheSize=240m
- sets JIT compiler code cache, to avoid "CodeCache is full. Compiler has been disabled." cases.-XX:+UseConcMarkSweepGC
- mostly concurrent GC algorithm for old space. Since I want responsiveness, let's keep it in.-XX:SoftRefLRUPolicyMSPerMB=50
- soft refs are flushed 50ms per free MB in-Xmx
/-Xms
(-client
/-server
) after last touch.-ea
enables assert from JDK 4. While rarely used, it's part of the JDK. Perf effects for on/off are unknown (to me).-Dsun.io.useCanonCaches=false
- disable cache for canonical paths (simplification: symlinks now up to date)-Djava.net.preferIPv4Stack=true
- even when IPv6 is available, use v4 when networking.-XX:+HeapDumpOnOutOfMemoryError
- if OOM happens, dump the heap as binary in default location (OS dependent, but look in IDE dir or wherever you launched it, if launched from console)-XX:-OmitStackTraceInFastThrow
- when you develop, you want your stack known-Dawt.useSystemAAFontSettings=lcd
- uses system anti-aliasing settings for font, adjusted to LCD. Other interesting option is-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
While Peter Lawrey said Idea is mostly file based, GC logging can verify this and is a must have either way.
-Xloggc:/home/tammo/.IntelliJIdea2017.1/gc.log
- log to file (with path)-XX:+UseGCLogFileRotation
- rotate log daily-XX:NumberOfGCLogFiles=10
- log-rotation requires >0 number here-XX:+PrintGCTimeStamps
- in ms since app started-XX:+PrintGCDateStamps
- with dates (human readable)-XX:+PrintGCDetails
- main logging flag-XX:+PrintReferenceGC
- times for weak, JNI, etc. refs processing-XX:+PrintGCCause
- why GC happened (alloc fail, System.gc() call...)-XX:+PrintPromotionFailure
- if it happens, prints more info
Logging to file instead of console, with log rotation and minimum details. Refs are a must since I changed their setting from default. Promotion failure to see if sizing of heap needs adjustments, same with GC details and causes.
- Code Cache: https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm
- HotSpot VM Options: http://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html
- Client and Server compilers: http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#compiler_types
- Fast throw stack trace optimization: http://jawspeak.com/2010/05/26/hotspot-caused-exceptions-to-lose-their-stack-traces-in-production-and-the-fix/
Good for caches, they are cleared some time (default: 1 second) after they are touched last. Their clearance happens before OOM (OOM won't be thrown if you have soft refs to clear). Flag for their clearing silently depends on whether C1 or C2 compilers are in use (client is C1, IIRC
:check: how are things with tiered compilation on?
- Soft refs flushing: http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#gc_softrefs
- Jeremy Manson about flushing algo: http://jeremymanson.blogspot.com/2009/07/how-hotspot-decides-to-clear_07.html
- Question (answered) about it: https://community.oracle.com/thread/1543565
- JVM code researched in SO answer: http://stackoverflow.com/questions/9932398/how-are-softreferences-collected-by-jvms-in-practice
One of the two system properties for enabling/disabling performance optimisation for file names canonicalization.
See this puzzler: http://konigsberg.blogspot.com/2009/10/symbolic-puzzler.html
The test success or failure depend on JVM starting flag, our useCanonCache
exactly. It either stores first call result for 30 seconds or it doesn't. If you update symlink, you won't get fresh data, but cached one instead (if default value is used).
- Puzzler: http://konigsberg.blogspot.com/2009/10/symbolic-puzzler.html
- It's answer: http://konigsberg.blogspot.com/2009/10/answer-to-symbolic-puzzler.html
- SO user stumbled upon this problem: http://stackoverflow.com/questions/7479198/canonical-file-path-in-java-optimization-problem
- NetBeans FAQ on it: http://wiki.netbeans.org/FaqFontRendering
- Piotr Wittchen makes a wrapper runner to make Intellij look better on Ubuntu: http://wiki.netbeans.org/FaqFontRenderinghttp://blog.wittchen.biz.pl/adjusting-look-feel-of-intellij-idea-and-android-studio-on-ubuntu/
- Oracle Trails on anti-aliasing: http://docs.oracle.com/javase/tutorial/2d/text/renderinghints.html
https://gist.github.com/P7h/4388881 https://gist.github.com/EdwardBeckett/4bbb1bcaad3f900e7305 https://gist.github.com/zafarella/43bc260c3c0cdc34f109
https://www.jetbrains.com/help/idea/2017.1/tuning-intellij-idea.html#d427984e92