In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "the startup parameters of jvm are divided into several categories", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "the startup parameters of jvm are divided into several categories"!
Java startup parameters are divided into three categories.
One is the standard parameter (-), which must be implemented by all JVM implementations and is backward compatible.
The second is the non-standard parameter (- X). The default jvm implements the function of these parameters, but it does not guarantee that all jvm implementations are met and backward compatibility is not guaranteed.
The third is the non-Stable parameter (- XX), which varies from jvm to jvm implementation and may be cancelled at any time in the future, so it needs to be used with caution.
The more useful of the standard parameters:
Verbose
-verbose:class
Output information about jvm loading classes, which can be diagnosed when jvm reports that the class cannot be found or that there is a class conflict.
-verbose:gc
Output the relevant information of each GC.
-verbose:jni
Output information about native method calls, which is generally used to diagnose jni call error messages.
Non-standard parameters are also known as extended parameters
Generally speaking, the most frequently used is
-Xms512m sets JVM to cause memory to be 512m. This value can be set to the same as-Xmx to prevent JVM from reallocating memory after each garbage collection.
-Xmx512m, set the maximum available memory of JVM to 512m.
-Xmn200m: set the size of the younger generation to 200m. Whole heap size = young generation size + old generation size + lasting generation size. The permanent generation usually has a fixed size of 64m, so increasing the size of the younger generation will reduce the size of the old generation. This value has a great impact on system performance, and Sun officially recommends that it be configured as 3Universe 8 of the entire heap.
-Xss128k:
Sets the stack size for each thread. The stack size of each thread after JDK5.0 is 1m, and the stack size of each thread before is 256K. Adjust the amount of memory required by more applicable threads. Decreasing this value generates more threads under the same physical memory. However, the operating system still has a limit on the number of threads in a process, which cannot be generated indefinitely, and the experience value is about 3000 to 5000.
-Xloggc:file
Similar to the-verbose:gc function, except that the relevant information about each GC event is recorded in a file, preferably 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 trace data in the standard output; suitable for debugging in the development environment.
The parameter list prefixed with-XX may not be robust in jvm, and SUN is not recommended, and it may be cancelled without notice later, but because many of these parameters are very useful to us, such as-XX:PermSize,-XX:MaxPermSize, and so on.
First, let's introduce the behavior parameters:
Parameter and its default value description-XX:-DisableExplicitGC forbids calling System.gc () But jvm's gc is still valid-XX:+MaxFDLimit maximizes the number of file descriptors limit-XX:+ScavengeBeforeFullGC new generation GC takes precedence over FullGC execution-XX:+UseGCOverheadLimit limits the proportion of time spent on GC by jvm before throwing OOM-XX:-UseConcMarkSweepGC uses concurrent tag exchange algorithm for GC-XX:-UseParallelGC to enable parallel GC-XX:-UseParallelOldGC to enable parallelism for FullGC This item is automatically enabled when-XX:-UseParallelGC is enabled-XX:-UseSerialGC enables serial GC-XX:+UseThreadPriorities enables local thread priority
The three parameters in boldface in the above table represent the three modes of GC execution in jvm, that is, serial, parallel and concurrent.
Serial (SerialGC) is the default GC mode of jvm, which is generally suitable for small applications and single processors. The algorithm is relatively simple and GC efficiency is high, but it may bring standstill to applications.
ParallelGC refers to the GC runtime, which has no effect on the running of the application, and the threads of GC and app are executing concurrently, which can minimize the impact on the running of app.
ConcMarkSweepGC refers to the concurrent execution of GC by multiple threads, which is generally suitable for multiprocessor systems and can improve the efficiency of GC, but the algorithm is complex and the system consumes a lot.
List of performance tuning parameters:
Parameter and its default value description-XX:LargePageSizeInBytes=4m sets large page size for Java heap-maximum percentage of free memory in java heap after XX:MaxHeapFreeRatio=70GC-maximum memory occupied by newly generated XX:MaxNewSize=size objects-maximum memory occupied by XX:MaxPermSize=64m older objects-minimum percentage of free memory in java heap after XX:MinHeapFreeRatio=40GC-ratio of XX:NewRatio=2 new generation memory capacity to old generation memory capacity-XX: Default value of memory occupied when NewSize=2.125m new generation objects are generated-XX:ReservedCodeCacheSize=32m preserves the amount of memory occupied by code-XX:ThreadStackSize=512 sets the thread stack size If 0, use the system default-XX:+UseLargePages uses large page memory
We basically use these attributes in boldface in our daily performance tuning.
Debug parameter list:
Parameter and its default value description-XX:-CITime print consumed in JIT compilation time-XX:ErrorFile=./hs_err_pid.log saves error log or data to file-XX:-ExtendedDTraceProbes turns on solaris-specific dtrace probe-XX:HeapDumpPath=./java_pid.hprof specifies the path or file name when exporting heap information-XX:-HeapDumpOnOutOfMemoryError exports relevant information in the heap when it encounters OOM for the first time-XX:OnError= " "run the custom command-XX:OnOutOfMemoryError= after the fatal ERROR occurs" "execute a custom command when you encounter OOM for the first time-XX:-PrintClassHistogram prints the column information of the class instance when it encounters Ctrl-Break, which has the same function as jmap-histo-XX:-PrintConcurrentLocks prints information about concurrent locks when it encounters Ctrl-Break. Same as jstack-l function-XX:-PrintCommandLineFlags prints tags that appear on the command line-XX:-PrintCompilation prints relevant information when a method is compiled-XX:-PrintGC prints relevant information every time GC-XX:-PrintGC Details prints details every time GC-XX:-PrintGCTimeStamps prints time stamp of each GC-loading information of XX:-TraceClassLoading tracking class-XX:-TraceClassLoadingPreorder tracks all classes referenced Load information-XX:-TraceClassResolution trace constant pool-unload information for XX:-TraceClassUnloading trace classes-information about XX:-TraceLoaderConstraints trace class loader constraints here I believe that everyone on the "jvm startup parameters are divided into several categories" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.