Java virtual machine parameters

-Xms512m Set the JVM to cause the memory to be 512m. This value can be set the same as -Xmx to avoid the JVM reallocating memory after each garbage collection is completed.

-Xmx512m, set the maximum available memory of the JVM to 512M.

-Xmn200m: Set the size of the young generation to 200M. The entire heap size = young generation size + old generation size + persistent generation size. The permanent generation generally has a fixed size of 64m, so after increasing the young generation, the size of the old generation will be reduced. This value has a greater impact on system performance. Sun officially recommends a configuration of 3/8 of the entire heap.

-Xss128k:

Set the stack size of each thread. After JDK5.0, the stack size of each thread is 1M, and the stack size of each thread is 256K before. Adjust the memory size required by the application thread. Under the same physical memory, reducing this value can generate more threads. However, the operating system still has a limit on the number of threads in a process, and it cannot be generated indefinitely. The experience value is around 3000~5000.

The function of -Xloggc:file is
similar to -verbose:gc, except that the relevant information of each GC event is recorded to a file. The location of the file is best to be locally to avoid potential network problems.
If it appears on the command line at the same time as the verbose command, -Xloggc shall prevail.
-Xprof

Track the running program, and output the tracking data to the standard output; suitable for debugging in the development environment.

lock:

synchronized is the JVM implementation mechanism:

The spin lock can be turned on by setting -XX:+UseSpining, the default number of spins is 10, you can use -XX:PreBlockSpin to set

Enabled by default in jdk1.6

Turn on the bias lock:

-XX :+UseBiasedLocking

Prohibit biased lock-
XX:-UseBiasedLocking
jdk 1.6 is enabled by default

jvm

TLAB

In order to ensure the security of the memory allocation of Java objects and improve efficiency, each thread can pre-allocate a small piece of memory in the Java heap. This part of the memory is called TLAB (Thread Local Allocation Buffer). Thread exclusive, reading, using, and recycling are shared by threads.

You can specify whether to enable TLAB allocation by setting the -XX:+/-UseTLAB parameter.

Guess you like

Origin blog.csdn.net/keep_learn/article/details/111365001