JVM Tuning Parameter Selection for Java Virtual Machine
(For more information, see Java, javafx, and Solaris.
Http://developers.sun.com.cn/blog/henry/
)
System Performance Tuning is an important step before any production system goes online. Generally, the default values of the software and hardware of the application system are designed for the Development Platform (or small-scale system ).
Almost all production systems can not achieve the best performance of hardware and software. Sometimes, the performance is several times worse before and after system optimization. On the other hand, because application developers generally develop functions
Therefore, hardware development is a machine that is smaller than the production environment. For example, the production system is a server with 8 CPUs and 64 GB memory, while the Development Server may only have 1 CPU and 4 GB memory. Therefore
Developers often do not have software and hardware environments for performance testing. In addition, some programmers did not even take into account the multi-user concurrency environment during development, and the program had single point of bottleneck and other problems. Performing stress testing
And tuning, these key points are often discovered.
Because the application system is a complete unity of hardware and software, system optimization usually involves hardware, network, operating system, middleware, applications and databases. In the process of optimization
Locate the bottleneck (that is, the part that causes system slowdown) and analyze the cause to improve and determine the optimal parameters.
Before tuning the JVM, we usually need to understand the running hardware platform, operating system, and middleware, then configure the corresponding system parameters for these situations, and continuously improve the parameters during testing. By
Performance tuning requires a good understanding of the system and rich experience, so it is not easy. Here is a good reference for spec.org. This is a hardware vendor
Generally, the hardware manufacturer will tune the system to the optimum to publish the results, which is of great reference. Common JVM-related benchmark values include:
Specjappserver2004 and specjbb2005. The former is the performance indicator of the J2EE application server, and the latter is the performance indicator of the server-side Java virtual machine. For everyone
The purpose of this website is to refer to the JVM configuration provided by the hardware vendor and quickly obtain better parameters based on the characteristics of the application environment. For example, sun
The value of specjappserver2004 for t5120 SERVER + Application Server 9.1 + jdk1.5 is 8,439.36:
Http://www.spec.org/jAppServer2004/results/res2007q4/jAppServer2004-20071106-00092.html
What we need to care about now is not the benchmark value (Note: In fact, sun's value is a good result), but the JVM parameter configuration in this environment.
You can find a topic "Notes/tuning information ":
(For more information, see Java, javafx, and Solaris.
Technical Exchange
Http://developers.sun.com.cn/blog/henry/
)
JVM Options: -server -XX:+AggressiveHeap
-Xmx2560m -Xms2560m -Xmn1024m -Xss128k
-XX:PermSize=256m
-XX:+DisableExplicitGC
-XX:ParallelGCThreads=24
-XX:LargePageSizeInBytes=256m
-XX:+UseParallelOldGC
-XX:+AggressiveOpts
-DAllowManagedFieldsInDefaultFetchGroup=true
-DAllowMediatedWriteInDefaultFetchGroup=true
-XX:-UseBiasedLocking
-Dcom.sun.ejb.containers.readonly.relative.refresh.mode=true
-Dcom.sun.jts.dblogging.insertquery=insert into
txn_log_table_0 values ( ? , ? , ? )
-Dcom.sun.jts.dblogging.deletequery=delete from
txn_log_table_0 where localtid = ? and servername = ?
-Dcom.sun.jdo.spi.persistence.support.sqlstore.
MULTILEVEL_PREFETCH=true
So what do the above parameters mean? In the above section, the "-xx" parameter is the Sun JVM extension option, and the following are related to garbage collection (GC:
-XX:PermSize=256m
-XX:+DisableExplicitGC
-XX:ParallelGCThreads=24
-XX:+UseParallelOldGC
-XX:+AggressiveHeap
The following option selects a large memory page:
-XX:LargePageSizeInBytes=256m
"-XX: + aggressiveopts" is a number of experimental optimization parameters. "-XX:-usebiasedlocking" is a non-competitive synchronization option.
The option "-xmx2560m-xms2560m-xmn1024m"
-Xss128k is the memory value of the initial stack. Note that the values of-xmx and-XMS are the same, so that the system performance will be smoother.
What are the meanings of these parameters? You can Google them to understand them easily. This is a description on the sun website. If you are interested, read:
Http://java.sun.com/performance/reference/whitepapers/tuning.html
If your application system is jdk1.5, the hardware is t5120, and the operating system is Solaris, these parameters are of great reference. If your hardware system is not
T5120, but sun's jdk1.5
These parameters are also useful for reference. Of course, the most ideal is to select a result similar to your own environment for reference. Most software and hardware test results can be found on spec.org. If
Your system is a three-layer architecture of J2EE. You can use jappserver2004 metrics. If it is a Java-only application, the jbb2005 results can be used:
http://www.spec.org/jAppServer2004/
http://www.spec.org/jbb2005/
It should be noted that these optimization parameters only provide a way of thinking. Whether or not they are suitable for your application depends on the actual test results.