2, to improve the performance of the server ............................................ ............... 1
3, analyzer principle ............................................. ...................... 2
4, JProfiler Introduction .............................................. ................. 2
5, JProfiler characteristics .............................................. ................. 3
6, the local monitoring .............................................. ....................... 4
7, remote monitoring and control .............................................. ....................... 7
8, reference ............................................... ........................... 9
1, Abstract
To improve the performance of Java server need to simulate the load of the server. Create a simulation environment, collecting data and the results of the analysis may be the developers of many challenges. The article analyzes the use of JProfiler tracking the performance of Java server.
The performance of simple problems could be easily isolated and resolved, however, the performance of major issues, such as memory overflow, or strike system, usually at a high load in the system occur, it can not be dealt with such a simple. These issues need an independent test environment, a simulated load, and require careful analysis and tracking.
In this article, I use more generic tools (JProfiler and JBuilder) and equipment to create a performance analysis of environmental monitoring, tracking of local and remote server program, focusing on the three performance problems: memory, garbage collection and multithreading operating conditions, thus good JVM performance monitoring and performance.
2, to improve the performance of the server
Improve the performance of the server is dependent on the data. The basis of reliable data does not change the application or the environment will lead to even worse results. Analyzer to provide useful information on the Java server applications, but the load from the single-user data and multi-user loads the data are completely different, which lead to the data analyzer is not accurate. Stage in the development of applications using the analyzer to optimize performance is a good way, but in the application under high load analysis can get better results.
In the load analysis of the performance of server applications need some basic elements:
1, the application of controllable load testing environment.
2, man-made controllable load operation allows the application of full load.
3, from the monitor, application and load testing tools for its own data collection.
4, tracking performance changes.
Do not underestimate the demand for the last (performance tracking) the importance of tracking performance because if not you will not be the actual management of the project. 10-20% performance improvement for single-user environment are no different, but the support staff is not the case. 20% of the improvement is very large, but also improve performance by tracking, you can provide important feedback and continuous tracking.
Although the tracking performance is very important, but sometimes in order to enable more accurate follow-up testing had to abandon the previous test results. In the performance test, to improve the accuracy of load testing may be necessary to amend the simulation environment, and these changes are necessary, through changes in the load testing before and after the observation to which you can change.
3, the principle Analyzer
The analyzer is now almost all are from the same starting point and the beginning of restraint: Java Virtual Machine Interface Analyzer (JVMPI) (refer to "The Java Virtual Machine Profiler Interface"). Sun Microsystems, developers of the API interface to allow a tool or to connect to the JVM on JVMPI follow and monitor the operation of the JVM as well as any Java program to run the key events - from a separate application to Applet, Servlet and Enterprise JavaBeans (EJB ) components.
In the analyzer with means to initiate a process to generate, capture, and to observe a large amount of data, so all of the analyzer are contained in different ways to control the flow of data, as well as the different standards in each package based on the filter . The same flexibility can also use regular expressions to complete the type of model.
4, JProfiler Profile
Is a full-featured Java analysis tools (profiler), dedicated to analysis of J2SE and J2EE applications. It is the CPU, memory, thread and a powerful combination of analysis of the applications. JProfiler can provide a number of IDE integration and application server integration purposes. JProfiler's intuitive GUI allows you to find the performance bottleneck out of memory loss (memory leaks), and solve the problem of thread. It allows you to be on the recycling heap walker device for root analysis, can easily find out the memory overflow; heap snapshot (snapshot) is not allowed to refer to (reference) the object was a slight reference to the object, or in the end (finalization ) queue object will be removed; integration wizard in order to analyze the Java browser plug-in function.
At present, the latest version is 4.1.2, supports almost all common IDE and Application Server, can go to their official website http://www.ej-technologies.com/ downloaded EJ, apply for a ten-day trial registration key.
5, JProfiler characteristics
Analysis 5.1 Memory Memory profiler
JProfiler view some of the memory can provide a dynamic view of memory use to update and display information about the status of memory allocation on the view. View all of the layers together and have a few to show the existence of the existing objects and the object as garbage collection.
* All objects
Display or the size of the state of statistics and information on all objects in the pile of packages. You can tag and display the current value of the difference value.
* Record objects Object record
Or show all objects of the package records. You can tag and displays the current value of the difference value.
* The distribution of visit Allocation call tree tree
Shows a tree or a request method, class, package or class have chosen to take note of the distribution of the information components of J2EE.
* Distribution of Allocation hot spots hot spots
A list is displayed, including methods, classes, packages or the distribution of selected types of J2EE components. You can show marked differences between the current value and value. For each hot spot can show its track record of the tree.
5.2 Heap Heap walker traversal
JProfiler traversal of the heap in the browser (Heap walker), you can stack a snapshot of the situation and can find step by selecting the object of interest. Traversal stack machine has a five view:
* Class Classes
Show all categories and their examples.
* Distribution of Allocations
For all records show that the distribution of the object tree and distribution of hot spots.
References * Index
For a single object and "garbage collection indicates that the path to the root directory" index map display. View can provide the combined input and output functions of view.
* Data Data
For a single object instance and class data show.
* Time Time
Records show that the object has a time resolution of the histogram.
5.3 CPU analyzing CPU profiler
JProfiler provides different ways to record the visit in order to optimize the performance of the tree and details. Threads or thread groups and the situation can be threaded view all options. View all of the methods can be gathered, classes, packages or J2EE components on different layers. CPU view include:
* Call tree tree visit
Shows that the accumulation of a top-down tree, the tree contains all the records in the JVM has access to the queue. JDBC, JMS and JNDI service requests have been comments in the request tree. Tree request Servlet and JSP according to the different needs of the URL to split.
* Hot Hot spots
Shows that the most time-consuming method of the list. Hot spots of each tree will be able to show the back. The hot spots can be requested in accordance with the method, JDBC, JMS and JNDI service request and the request in accordance with the URL to be calculated.
* Call graph access map
Display a selection from the methods, categories, packages or J2EE components access to the beginning of the map queue.
5.4 Analysis Thread Thread profiler
Analysis of the thread, JProfiler offers the following view:
* Thread Thread history history
Shows a state of threads and thread schedule of activities together.
* Thread Thread monitor monitor
A list is displayed, including all the activities of threads, as well as the activities of their current situation.
* Deadlock Detection Deadlock detection graph
Show that contains all the deadlocks in the JVM in the chart.
* The monitors currently in use Current monitor useage
Display monitors currently in use and including their associated threads.
* Detection recording the history of History usage history
Showed a significant obstruction to wait for events and event history.
* Monitoring the use of a state Monitor usage statistics
Show packet monitoring, thread and monitoring of statistical monitoring data category.
5.5 VM telemetry VM telemetry technology
Observation of the internal JVM state, JProfiler provides a different view of the remote sensing survey, as follows:
* Heap Heap
Show that the use of a stack and heap size of the schedule of activities.
* Recorded objects Object record
Show objects with an array of activities the activities schedule chart.
* Garbage collector garbage collection
Shows a garbage collection activities on the schedule of activities.
* Class Classes
Shows a type of graph has been loaded with the timetable of activities.
* Thread Threads
Shows a graph of threads and dynamic schedule of activities.
6, the local monitoring
System environment Windows OS; software JBuilderX/2005 and JProfiler 4.1.2
1, the installation of JBuilderX and JProfiler 4.1.2
2, run JProfiler, Session-> IDE integration tab, IDE choice Borland JBuilder7 to 2005, click the Integrate button, select the directory where you installed JBuilder, confirm, will see to JProfiler has OpenTool the form of successful integration to JBuilder, see below Fig.
3, run JBuilder, open the Run-> Configurations, select or create a new Runtime, in the Optimize option can be seen on JProfiler, can choose to run the program every time a new set JProfiler prompt window.
4, click Optimize Project button to run the program.
5, the following pop-up window JProfiler, relevant information can be confirmed.
6, At this point, on the local server can monitor the performance of all aspects of the.
7, remote monitoring
Server program generally run in a remote server device, sometimes we also need to remote monitoring of server resources business.
Server operating systems Linux OS, the installation steps are as follows:
1, ./jprofiler_linux_4_1_2.sh, the following prompt appears:
testing JVM in / usr/jdk1.4 ...
Starting Installer ...
Note: do not install X Server machines, the need to implement ./jprofiler_linux_4_1_2.sh-q, or else they would suggest that
testing JVM in / usr/jdk1.4 ...
Starting Installer ...
This installer needs access to an X Server.
If this is not possible, you can run the installer in unattended mode
by passing the argument-q to the installer.
2, After installation, will be in the / opt directory, jprofiler find the installation directory, / opt/jprofiler4.
Local operating system WindowXP, the relevant configuration is as follows:
1, the local installation of JProfiler, Linux servers are also installed JProfiler (only local / monitoring the need to enter the serial number).
2, open the local JProfiler, session-> Integration wizards-> New Remote integration
3, selection on a remote computer, platform choice of linux x86/AMD64, click next
4, enter the remote ip address, click next
5, enter the remote JProfiler install directory, by default are installed in / opt/jprofiler4 under way NEXT
6, the following prompt box appears, in accordance with the requirements of the server configuration settings, the interface is as follows:
Java implementation by adding the following statement in operating parameters
-Xint-Xrunjprofiler: port = 8849-Xbootclasspath / a: / opt/jprofiler4/bin/agent.jar;
/ etc / profile to add export LD_LIBRARY_PATH = / opt/jprofiler4/bin/linux-x86, exit and re-landing.
7, Well, all configured and ready to run the remote server first, and then open the local JProfiler procedures, handshake is successful, the normal operation of the remote procedure.
Server information is as follows:
[root @ ns 55556] # tail-f nohup.out
JProfiler> Protocol version 21
JProfiler> Using JVMPI
JProfiler> 32-bit library
JProfiler> Listening on port: 8849.
JProfiler> Native library initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...
/ / More than up for the local system even JProfiler tips
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Starting org / anymobile / server / cmwap / CmwapServer ...
2005/12/15 17:05:46 [INFO] - Starting Cmwap Stand Server ...
2005/12/15 17:05:47 [INFO] - HandleThread runing ......
8, additional information and reference
Added 8.1
If you wish to save the current Session dynamic operation of the data snapshot, click the Save button JProfiler;
JProfiler Start Center through the Save Open snapshot tab to open the Session;
You can also right-click a view, save to static HTML documents, text description plus picture view;
Some of the data view will only run once, the refresh will not be dynamic, such as memory allocation of view, such as access to the tree view;
JProfiler under WinXP does not seem to support the Chinese, 2K under the support of the above picture there are some systems in the 2K intercepted;
In addition, JProfiler can also monitor an Application Server, Applet, very powerful, you can reference the built-in Help.







