JVM Learning (Four) JVM tuning

A, tuning command

  Sun JDK monitoring and troubleshooting commands have jps, jstat, jmap, jhat, jstack, jinfo

  • JPS , the JVM Process Status Tool, to display all the HotSpot virtual machine process within the specified system.
  • jstat- , the JVM statistics Monitoring state information is a command for monitoring the virtual machine is running, it can show a virtual machine in the process of class loading, memory, garbage collection, and other operating data of the JIT compiler.
  • jmap , the JVM Memory the Map command is used to generate a heap dump file
  • the jhat , the JVM Heap using the Analysis Tool command jmap match, to analyze the dump jmap generated, the jhat built a miniature HTTP / HTML server, generates the analysis result after the dump, can be viewed in a browser
  • jstack , used to generate the java virtual machine snapshot of the current moment thread.
  • jinfo , the JVM command role in the Configuration info is viewed in real time and adjust virtual machine operating parameters.

Second, the tuning tools

  Common tuning tools fall into two categories, jdk own monitoring tools: jconsole and jvisualvm, third parties: MAT (Memory Analyzer Tool), GChisto.

  • JConsole , the Java Monitoring and Management Console is java5 from the beginning, that comes in the JDK java monitoring and management console for monitoring the memory, threads, and JVM classes, etc.
  • jvisualvm , the JDK comes with versatile tool that can analyze memory snapshots, snapshot thread; monitoring changes in memory, GC change.
  • MAT , Memory Analyzer Tool, a memory analysis tool based on Eclipse, is a fast, feature-rich Java heap analysis tool that can help us find memory leaks and reduce memory consumption
  • GChisto , a professional gc log analysis tool

Three, Minor Full GC and GC respectively when did it happen?

  When the new generation of memory is not enough when the MGC occurs also called YGC, JVM is not enough memory occurs FGC

Fourth, you know what JVM tuning

Set heap memory size

  The -Xmx : maximum heap memory limit.

Set the size of the new generation

  The new generation should not be too small, otherwise there will be a large number of objects influx of years old

  • -XX: NewSize : the size of the new generation
  • -XX: NewRatio : the new generation and the old generation accounted for
  • -XX: SurvivorRatio : accounting Eden space and survivors space

Setting garbage collector

  • Young substitute  -XX: + UseParNewGC
  • Old substitute  -XX: + UseConcMarkSweepGC

Guess you like

Origin www.cnblogs.com/riches/p/11912516.html