(turn) JVM parameter tuning under Linux

Source: Internet
Author: User
Tags garbage collection time in milliseconds

1. Basic Concepts.
Java_mem_opts= "-server-xmx2g-xms2g-xmn512m-xx:permsize=128m-xss256k-xx:+disableexplicitgc-xx:+ Useconcmarksweepgc-xx:+cmsparallelremarkenabled-xx:+usecmscompactatfullcollection-xx:+usefastaccessormethods- Xx:+usecmsinitiatingoccupancyonly-xx:+usecompressedoops

-server enables compilers capable of performing optimizations.

-XSS a single thread stack size value.

-XMS the initial size value of the JVM heap space when the app is started.

-xmx the limit value of the JVM heap space in the application run.

The Cenozoic space size of the-xmn heap space.

-xx:permsize the size of the persistent storage area

2.VM Performance Diagnostic Tool

Basic tools: JPS, Jstat,jmap

Jstat ("Java Virtual machine Statistics monitoring Tool") is a lightweight gadget that comes with the JDK. Provides real-time command-line monitoring of Java application resources and performance, including monitoring of heap size and garbage collection status.
The syntax structure is as follows: Jstat [Options] vmid [interval] [count]
Options--We generally use-gcutil to view GC conditions
Vmid--The process number of the VM, which is the currently running Java process number
interval--interval time in milliseconds
Count--The number of prints, if the default is printed countless times

[Email protected] (none): ~# jstat-gcutil 595
S0 S1 E O P ygc ygct FGC fgct GCT
0.00 0.00 25.40 29.78 48.50 5 0.036 3 0.238 0.274

S0-Percentage of space already used in the Survivor space zone 0 on the heap
S1-Percentage of space already used in the Survivor space Zone 1 on the heap
E-Percentage of space used in Eden space on the heap
O-Percentage of space used in the old area on the heap
P--Percentage of space used in the Perm area
YGC-Number of young GC occurrences from application startup to sampling
ygct--the time (in seconds) used by the young GC when booting from the application to sampling
FGC-the number of full GC occurrences from application startup to sampling
fgct--time (in seconds) for full GC from application boot to sampling
GCT-Total time (in seconds) for garbage collection from application startup to sampling


Jstat-gccapacity Viewing memory usage
[Email protected] ~]$ jstat-gccapacity 10010

NGCMN ngcmx NGC s0c s1c EC ogcmn ogcmx OGC OC pgcmn pgcmx PGC PC YGC FGC
65536.0 524288.0 65536.0 6528.0 6528.0 52480.0 196608.0 1572864.0 450572.0 450572.0 21248.0 131072.0 72900.0 7 2900.0 93842 16790

Ngcmnminimum New Generation Capacity (KB).
NGCMX Maximum New Generation Capacity (KB).
NGC Current New generation capacity (KB).
S0ccurrent survivor Space 0 Capacity (KB).
S1C Current survivor Space 1 capacity (KB).
EC Current Eden Space Capacity (KB).
Ogcmnminimum old generation Capacity (KB).
OGCMX Maximum old generation Capacity (KB).
OGC current old generation capacity (KB).
OC Current old space Capacity (KB).
Pgcmnminimum permanent Generation capacity (KB).
PGCMX Maximum Permanent generation Capacity (KB).
PGC current Permanent generation capacity (KB).
PC Current Permanent space Capacity (KB).
Ygcnumber of young generation GC Events.
FGC number of full GC Events.

Jmap
Jmap is a tool that can output all in-memory objects, and even the heap in the VM can be output as text in binary.
How to use
Jmap-histo Pid>a.log can save it to text, and after a while, using the text Comparison tool, you can compare which objects the GC recycles.
The JMAP-DUMP:FORMAT=B,FILE=F1 PID can output the memory heap of the PID process to the F1 file.

Integration tool: JCONSOLE,JVISUALVM

Typical Performance Failure analysis

2.vmstat

(RPM) JVM parameter tuning under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.