BEA WebLogic JROCKIT's use and performance tuning

xiaoxiao2021-04-07  333

One. JROCKIT Tuning Introduction JROCKIT is an adaptive JVM that automatically adjusts yourself to adapt to the underlying hardware, so the tuning is mainly focused on some parameters that require manual intervention, such as how much RAM needs to be used, etc. . JROCKIT has a set of non-standard -X boot options, we can use it to adjust JVM. JROCKIT has two groups of primary subsystems that can be optimized - memory management systems (including garbage recycling) and thread systems. There are a lot of tuning work in terms of memory management subsystems. two. Tuning WebLogic Jrockit JVM1. Setting the initial heap size can set the initial heap size through -XMS: m, if the value of -Xmx is less than 128MB, the -xms default is 16MB; if the -xmx setting is greater than 128MB, the -xms default For 25% of physical memory, the maximum does not exceed 64m. Example: -XGC: Gencon -XMS: 64M -XMX: 64M myclass2. Set the maximum heap size can be set to set the maximum heap size via -xmx: m. Under the IA32 architecture, since the operating system gives the maximum memory addressing space of each process to 1.8g, the maximum heap size cannot exceed 1.8G. Under the IA64 architecture, there is no limit on 1.8G. If your Java application has an error in Out of Memory at runtime, you need to make up the maximum heap size. If you do not set the maximum heap size, the default is: 1. If the -xgc: gencopy is set, the maximum heap size is min {400, physical memory * 75%}; 2. If not set -XGC: Gencopy, the maximum heap size is min {1536, physical memory * 75%}; it is best to handle the maximum heap size to 75% of physical memory (1024M): - XGC: Gencon -XMS: 64M -Xmx: 768m myclass3. Set Nursry's size You can use -xns: to set the size of Nursry, we must increase the size of Nursry while ensuring that the garbage collection-pause is as short as possible, as soon as possible, try to increase the size of Nursry, which is created a lot It is especially important when temporary objects. The default is: 1. For -xgc: Gencopy, the default NURSERY size is 320kb / cpu, for 10 CPU systems, NuRSERY size is 3200kb (3.2m) 2. For -XGC: Gencon, the default NURSERY size is 10m / CPU, and the NURSERY size is 100m4 for 10 CPU systems. Define the cleaning timing of memory space You can use -Xcleartype: to define how the memory space that has been recovered from garbage can be cleared, supporting the following three ways: 1. GC, cleaning memory while garbage collection; 2. Local, cleaning memory when allocating a Thread-local area, is only useful when setting the parameters -XallocationType to LOCAL; 3. Alloc cleans up when this memory is assigned to other objects. It is not supported on IA64.

The default is: 1. The IA32 drives a default value of alloc2. The IA64 drives the default value of GC5. Defining the type of thread allocation You can use -XallocationType: to define the type of thread allocation. 1. Global, uses the thread when the maximum heap size is relatively small (less than 128m) or the application uses a large number of threads. 2. Local, when the maximum heap size is relatively large (greater than 128m) or a small number of applications uses the thread. Default: 1. If the -xgc: gencopy is set, the default is Global2. If the -xgc: siglecon, -xgc: gencon and -xgc: parallel are set to Local6. Defining the thread stack size can define the thread stack size using -XSS [k | k] [m | m]. The minimum thread size is defined as follows: 1. Thin Threads: The minimum thread stack size is 8K, the default is 64k; 2. Native Threads: The minimum thread stack size is 16K If the -xss setting is less than the minimum, the minimum value is automatically used. Default: 1. IA32 system, WIN32: 64K, Linux32: 128k2. IA64 system, WIN64: 320K, Linux64: 1M II. Basic Tuning Tips and Techniques Although JROCKIT provides a set of default OOTB configuration options, it is best to make some adjustments to JROCKIT according to the actual application. 1. Deciding which aspect of you want to adjust the factors to consider: 1. How much memory space is to be assigned to JROCKIT; 2. What is the purpose of you want to tune? It is to get better responsive or better performance; 2. Setting the stack size for the stack size, of course, the bigger it is better. If it is not set enough, it will cause Out-of-Memory and memory page. If multiple applications have been run at the same time, it is recommended to set the minimum and maximum heap size. 3. Tuning in high response should be better response performance, it should be set 1. Use concurrent garbage collectors. -Xgc: gencon2. Set the initial and maximum heap size. -XMS512M, -XMX768M, since the concurrent garbage collector is used, the heap size will not cause long waiting. 3. Set Nursry size. If a large amount of temporary object is used, you need to make an appropriate NuRSERY size. Monitoring the NURSERY size will result in a post-returning time of garbage collection, so pay attention to ensuring that the returns of garbage recycling is within the canlerable range, this pause time can be viewed by setting -XGCPAUSE. 4. In terms of high performance, if you want to get better performance, you should: 1. The parallel garbage collector is selected, so you don't have to set -XNs, the method is to add -XGC: Parallel2. Turn the initial and maximum heap size setting to as much as possible. The method is -XMS512M, -XMX768M. 5. Analysis of garbage collection and pause time 1. Generate reports using -Xgcreport, show statistics for garbage collection, you can see if you use garbage collectors that are most effectively used. 2. Use -xverbose: Memory to display the pause time of each garbage recycling during the run.

This option is for debugging, which will generate a large number of console outputs. 6. Adjusting threads When using threads (more than 100), you need to adjust the thread options: 1. Use the Thin thread option. -XthInthreads. The thin thread mode is very effective under Linux. Note: Thin thread is just a test option in JROCKIT, which is not recommended; 2. Turn off the options for local allocation threads. -XallocationType: Global. Each local thread area consumes approximately 2K memory. If you use threads in a lot, local threads will not only cause memory space, but also cause a stack of fragments. Use the global thread mechanism to reduce the biler, but speed is slow in memory allocation. 7. Analyze and improve application design to find bottlenecks: 1. Use Intel VTune tools; 2. Use -XJVMPI: Allocs = Off, Monitors = OFF, EntryExit = Off option. three. When Command Line Options By Name Start JROCKIT, you can bring some -X options, which are non-JVM standards, specifically to configure the performance of JROCKIT. Option Description -X Display Extended Java Options - xallotype-xallocationType Value Global and Local, define whether to use local threads or global threads. -XBootClassPath specifies the class search path, which can be zip and jar files, to define memory cleaning timing, values ​​GC, Local, Alloc. GC indicates that the memory is cleaned up when garbage recovery; the local representation is cleared when the LOCAL thread is allocated; alloc indicates that the memory area is cleaned up to other objects to clean -XGC to select the type of garbage collector to use, and values: gencopy: generational copyingsinglecon: single spaced concurrent, single space concurrent gencon: generational concurrentparallel: parallel if -Xmx less than 128M, defaults gencopy, otherwise the gencon-Xgcpause printed by the pause time garbage collector garbage collection caused -Xgcreport print a report whether -Xjvmpi Allow JVMPI events, these events include: entryExit Allocs (Default ON) MONITORS (Default ON) ARENASDELETE (Default OFF) -XManagement activates the management server in the JVM, and can connect to the JVM management console Before it is, you must first activate. -XMS Sets the initial heap size, the unit has K, M, G-XMX settings maximum heap size, with k, m, g-xnativethreads use the local thread system, this is the default option -xnoclassGC prohibited to use garbage recycling - xnohup Tell JROCKIT, ignore Ctrl_Logoff_Event and Sighup Events -XNS Set Nursry Size, with K, M, G-XSS Settings Whent Stack Size, K, M, G-XTHINTHREADS Using JROCKIT's high-performance thread system, not available on IA64 .

-Xverbose makes JROCKIT print more information, optional parameters are: Codegen, CPUINFO, GC, LOAD, MEMORY, OPT-XVERIFY, made a complete Bytecode level of check four. Tuning WebLogic1 with the Method Profiler in JROCKIT8.1. About Method Profiler Tools Bea WebLogic JROCKIT 8.1 provides a Profiling tool: Method Profiler to tune WebLogic app. 2. Method Profiler Tools with Method Profiler Tuning WebLogic Apply JROCKIT 8.1 Method Profiler tools can be counted in the number of members methods performed on the JROCKIT Java virtual machine, the total time performed, and each called execution time, as shown in Figure 1 Indicated. Such functions can make us TUNING (code grade) on the application running on WebLogic, and the second is greatly convenient for us to determine where the system bottleneck. This can also be said that JROCKIT JVM is a major advantage over other JVMs. In the pressure test of WebLogic Server 8.1, when a sample containing a sample containing CMP characteristics, the bottleneck of the system was used to diagnose the bottleneck of the system using JROCKIT's Method Profiler. In addition to the CMP Entity Bean in this set of samples, the CMP Entity bean is inserted with EJBCREATE. It is followed by the setName method to set its name attribute, ie UPDATE, the value of the Name domain in the database record, the code is as follows: public void ejbcreate ) // Stateful4CMPBean method of throws CreateException {try {Context ctx = new InitialContext (); SheepHome home = (SheepHome) ctx.lookup ( "Sheep"); Sheep sheep = null; int x = getNextId (); // getNextId () Also contains operations for the database sheep = home.create (x); if (Sheep! = Null) {sheep.setname ("sheep1" .concat (String.Valueof (String.Valueof (x))))); m_strmsg = "Create sheep" .concat (String.Valueof (String.Valueof (x)));} else {m_Strmsg = "The Sheep Name is not created.";}} Catch (Exception E) {m_Strmsg = "*** Some Exception Occured! (CMP) ".concat (String.Valueof (String.Valueof (E.GetMalueof (E.GetMessage ())))));}} The data measured at this time is very low, and the RESPONSE TIME is always in the TPS. Over time is almost linearly climbed. So use Method Profiler to diagnose: (1) Add -XManagement in JROCKIT's startup parameters to start its Management Server at the same time as you start JROCKIT. (2) Start JROCKIT Management Console and connect it to the launched Management Server.

转载请注明原文地址:https://www.9cbs.com/read-132426.html

New Post(0)