JavaOne Notes: Java on Linux
I was hoping there would be a bit more about Linux tuning, problems, etc. in this presentation; though it had some useful tips that might come in handy given I've never actually deployed production scale Java app under Linux (soon!).
Lots of Threads
� Old systems have thread limit of 1024
� Don�t set LD_ASSUME_KERNEL
� Use small stack sizes (e.g. �Xss48k
� Use ulimit �s to change stack size for native threads
� Pay attention to /proc/sys/kernal/threads-max (automatically set by kernel based on memory available; different kernel versions compute differently)
cat /proc/self/maps
� determine max heap size on a given system
2.4 -> 2.6 kernel changes
� Overall transition is smooth
� Some caveats:
o HZ changed from 100 to 1000
� Thread.sleep(1) will wake up after 1ms vs 10ms!
� Max cause excessive context switches if in a loop
o Thread.yield() is more expensive
� �XX:+DontYieldALot
To run java inside gdb and valgrind
setenv LD_LIBRARY_PATH `java PrintLibraryPath`
public class PrintLibraryPath {
public static void main(String[] args) {
System.out.println(System.getProperty(�java.library.path�));
}
}
JDK Tools
� jstack: print stack trace
� jmap: print heap uisage, object histogram
� jjinfo: show command line flags & system properties
� jstat: performance stats about various JVM properties