https://habrahabr.ru/company/jugru/blog/338732/
https://habrahabr.ru/company/jugru/blog/338928/
https://habrahabr.ru/company/jugru/blog/324932/
http://www.ibm.com/developerworks/library/j-codetoheap/index.html
https://habrahabr.ru/company/jugru/blog/309118/
https://www.reddit.com/r/java/comments/5t4qbi/very_insightful_video_for_performant_java/
https://www.ctheu.com/2017/02/14/all-the-things-we-can-do-with-jmx/
Each Object reference occupies 4 bytes if the Java heap is under 32G and XX:+UseCompressedOopsis turned on (it is turned on by default in the recent Oracle JVM versions). Otherwise, Objectreferences occupy 8 bytes.
https://habrahabr.ru/post/324144/ memory leaks
https://habrahabr.ru/company/jugru/blog/309118/
https://srvaroa.github.io/java/jvm/zeroallocations/2016/12/06/frugal.html
https://srvaroa.github.io/talks/jvm/performance/java/2016/06/19/jBCNConf-2016.html
https://medium.com/@chrishantha/using-java-flight-recorder-2367c01deacf#.yhtow2w54
ps -auxww | grep java long command string
1) -Xms
This option is to specify starting heap size for JVM e.g. -Xms2048m means initial heap size of JVM is 2GB. When JVM will start the heap memory will be this big. This is done to prevent resizing during startup and improve the startup time of JVM.
2) -Xmx
This option is to specify maximum heap size of JVM e.g. -Xmx2048m means maximum heap size of JVM will be 2GB. You will almost always see -Xms and -Xmx together. Their ration is also important, the ration of 1:1 or 1:1.5 is found to be more efficient. You must specify sufficient heap space for your Java application to avoid java.lang.OutOfMemoryError: Java Heap space, which comes if there is not enough memory to create new objects or arrays.
3) -XX:PermSize
Earlier JVM options specify the size of heap memory but this one is to specify the size of PermGen space, where string pool and class metadata is stored. This option is very important for the web server like Tomcat which often loads classes of the web application during deployment. It's worth knowing that PermGen space is replaced by MetaSpace in Java 8 and this option is not relevant if you are running with JRE 8 JVM. See Java Performance Companion by Charlie Hunt to learn more about Java 8 changes and their performance impact. It is the most up-to-date book in Java performance till date and help you to squeeze the best performance with JDK 8 in any application.
4) -XX:MaxPermSize
This is the counterpart of earlier JVM option and used to specify the maximum size of permanent generation of JVM. The permgen will expand until it reaches this value, It cannot expand beyond this. If the permanent generation of JVM is full then you will get java.lang.OutOfMemoryError: PermGen space. So, this option is very important to avoid that error.
5) -verbose:gc
This JVM option is used to enable Garbage collection logging in your Java application. It will show you whether it's major or minor garbage collection, which kind of garbage collector is used, how much memory is reclaimed and how much time it took etc.
6) -XX:+PrintGCTimeStamps
This JVM option will prepend record with timestamp since Java application start, so you can see that at which state of your application GC activity peaks.
7) -XX:+PrintGCDetails
Prints some more garabage collections details
8) -Xloggc:[path to gc log file]
You can log all garbage collection details into a log file for future analysis using this JVM option. You can later use tools like GCViewer to analyze the logs files.
9) -Dsun.net.inetaddr.ttl=
This is an essential JVM option if your Java program connects to database or any other Java processor web server via a load balancer e.g. in which hostname can be routed to the different IP address in case of failover. This option specifies the number of seconds during which DNS record will be cached in JVM. This is even more important with Java 6 virtual machine which caches the IP address forever. In that case, you don't have other option but to restart your Java application if upstream or database switched to the secondary node, not the most elegant option.
10) -XX:+HeapDumpOnOutOfMemoryError
This JVM option creates a heap dump when your JVM dies with OutOfMemory Error. There is no overhead involved unless an OOM actually occurs. This flag is a must for production systems as it is often the only way to further analyze the problem. The heap dump will be generated in the "current directory" of the JVM by default. If you want to create heap dumps on specific directory then use -XX:HeapDumpPath=[path-to-heap-dump-directory] e.g. -XX:HeapDumpPath=/dsk3/dumps.
http://www.java67.com/2016/08/10-jvm-options-for-java-production-application.html
https://www.lektorium.tv/lecture/14257 million per seconds
https://shipilev.net/#performance-101
https://news.ycombinator.com/item?id=12051442
Book
https://leanpub.com/modernjava
https://habrahabr.ru/company/jugru/blog/280420/
https://blog.buoyant.io/2016/06/17/small-memory-jvm-techniques-for-microservice-sidecars/
https://advancedweb.hu/2016/05/27/jvm_jit_optimization_techniques/
https://www.youtube.com/watch?v=88-szpeNfrU C++ performance in Java
https://habrahabr.ru/company/getintent/blog/302910/
https://docs.oracle.com/javase/specs/jvms/se8/html/
https://library.oreilly.com/book/0636920028499/java-performance-the-definitive-guide/toc
http://www.cubrid.org/blog/dev-platform/understanding-jvm-internals/
https://github.com/raydac/Java-performance-mind-map JavaPerformance MindMap
http://www.infoq.com/presentations/java-profiling
http://www.toptal.com/java/hunting-memory-leaks-in-java
JVM internals
https://www.lektorium.tv/lecture/14532 Java memory model
http://blog.jamesdbloom.com/JVMInternals.html
https://advancedweb.hu/2016/05/27/jvm_jit_optimization_techniques/
http://nayefreza.blogspot.com/2013/01/command-line-options-for-java-garbage.html
http://blog.jamesdbloom.com/JVMInternals.html?gclid=CPzNqoOQk7oCFSU6QgodaTwAIA
https://www.youtube.com/watch?v=uL2D3qzHtqY
http://www.infoq.com/presentations/JVM-Mechanics
https://zeroturnaround.com/rebellabs/java-memory-model-pragmatics-by-aleksey-shipilev/
Garbage collection
http://habrahabr.ru/post/269707/
http://eivindw.github.io/2016/01/08/comparing-gc-collectors.html
https://plumbr.eu/java-garbage-collection-handbook
For the sake of Garbage collection Heap is divided into three main regions named as
1) New Generation where newly created object are stored,
2) Old or Tenured Generation many objects created and died but those remain live they got
moved to Old (Tenured) Generation by Java Garbage collecto
3) Perm space stores Meta data about classes and methods, String pool and Class level details
http://javarevisited.blogspot.com/2011/04/garbage-collection-in-java.html
New Generation is further divided into three parts known as
Eden space, Survivor 1 and Survivor 2 space.
When an object first created in heap its gets created in new generation inside Eden space and after subsequent
Minor Garbage collection if object survives its gets moved to survivor 1 and then Survivor 2
before Major Garbage collection moved that object to Old (Tenured) generation.
You can use "jmap" command to get java heap dump, this will create heap dump file and then you can use "jhat - Java Heap Analysis Tool" to analyze those heap dumps.
Before removing an object from memory Garbage collection thread invokes finalize() method of that object and gives an opportunity to perform any sort of cleanup required.
You can not force Garbage collection in Java; it will only trigger if JVM thinks it needs a garbage collection based on Java heap size.
There are methods like System.gc() and Runtime.gc() which is used to send request of Garbage collection to JVM but it’s not guaranteed that garbage collection will happen.
http://javarevisited.blogspot.com/2011/09/javalangoutofmemoryerror-permgen-space.html
Read more: http://javarevisited.blogspot.com/2011/05/java-heap-space-memory-size-jvm.html#ixzz2hGpaEfLY
in Java 1.5 default maximum heap size of JVM would be Physical Memory/4 and default initial heap size would be Physical Memory/16. Another way to find default heap size of JVM is to start an application with default heap parameters and monitor in using JConsole which is available on JDK 1.5 onwards, on VMSummary tab you will be able to see maximum heap size.
You can change size of heap space by using JVM options
-Xms and -Xmx. Xms denotes starting size of Heap while -Xmx denotes maximum size of Heap in Java.
There is another parameter called -Xmn which denotes Size of new generation of Java Heap Space
Performance
http://elizarov.livejournal.com/tag/performance
http://www.slideshare.net/shipilev
http://www.slideshare.net/ssakpi/java-performance
http://psy-lob-saw.blogspot.com/
https://wikis.oracle.com/display/HotSpotInternals/PerformanceTechniques
http://www.oracle.com/technetwork/java/javase/index-138283.html
http://docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html jconsole
http://www.infoq.com/articles/java-profiling-with-open-source
http://habrahabr.ru/users/TheShade/topics/
http://www.philipotoole.com/what-i-wish-id-been-told-about-the-jvm/
http://www.infoq.com/articles/Advanced-Java-Debugging-Techniques
http://javarevisited.blogspot.sg/2014/07/top-5-java-performance-tuning-books.html
http://habrahabr.ru/post/223401/ Garbage collection tuning
http://mechanical-sympathy.blogspot.com/2013/07/java-garbage-collection-distilled.html
http://www.infoq.com/minibooks/java-garbage-collection
http://java-performance.info/memory-consumption-of-java-data-types-2/
http://www.javaperformancetuning.com/
http://java.dzone.com/articles/principles-java-application
http://oreilly.com/catalog/javapt/chapter/ch04.html
http://www.youtube.com/playlist?list=PL5BFBFE156D50B07E
http://www.reddit.com/r/java/comments/1o315a/ask_rjava_what_java_profilers_do_you_use_is_there/
http://www.cubrid.org/blog/dev-platform/how-to-monitor-java-garbage-collection/
Debugging Tools http://java.sun.com/developer/technicalArticles/J2SE/monitoring/
http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
http://java.sun.com/developer/technicalArticles/Programming/HPROF.html
http://stacktips.com/tutorials/java/7-options-to-capture-the-thread-dumps
VisualVM is a resource profile tool that comes with JDK starting from 6 update 7. It has default memory and CPU monitoring. It can tell you which classes and methods are hit, but it will not show the flow through the application.
http://habrahabr.ru/post/61857/ VisualVM
Java Mission Control jmc
-Dcom.sun.management.jmxremote.rmi.port=7091 -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:+UnlockCommercialFeatures -XX:+FlightRecorder
Дальше можно зайти на сервер по ssh с перенаправлением портов:
ssh user@host -L7091:127.0.0.1:7091
Запускаем jmc и подключаемся к 127.0.0.1:7091
http://lagivan.blogspot.com/2012/06/still-looking-for-java-profiler.html
http://habrahabr.ru/post/143468/ Do-It-YourSelf Java Profiler
http://java.sun.com/javase/6/webnotes/trouble/other/matrix6-Unix.html
http://kenai.com/projects/btrace/pages/Home Btrace
http://findbugs.sourceforge.net/
http://java-performance.info/oracle-java-mission-control-overview/
in the JDK/bin directory there are many tools:
jcmd,
jconsole,
jhat,
jinfo,
jmap,
jmc, http://www.oracle.com/technetwork/java/javase/2col/jmc-relnotes-2004763.html
jps,
jsadebugd,
jstack,
jstat,
jstatd,
jvisualvm http://docs.oracle.com/javase/7/docs/technotes/guides/visualvm/profiler.html
Many of these have overlaps with each other, and I suspect there will be some retirement - in particular I expect jconsole to disappear as jmc provides all the functionality that jconsole presents, and a lot more.