Jmeter (49) - From entry to advanced level - jmeter uses monitor results to monitor tomcat performance (detailed tutorial)

1 Introduction

The previous article explained how to use jmeter’s plug-in to monitor server resources. This article explains and shares how to use jmeter’s monitor results to monitor tomcat performance.

2. Preparation

The title of the article mentions jmeter and tomcat, so you only need to prepare them.

2.1 Tomcat configures user name, password and monitoring permissions

1. When using tomcat, if you want to use the management monitoring function, you need to log in with the username and password. Tomcat7 annotates the user by default, so it needs to be configured before use. The configuration file is /conf/tomcat- in the root directory. users.xml file.

2. Take a look at the official instructions, as shown in the figure below:

If you want to learn automated testing, I recommend a set of videos to you. This video can be said to be the number one automated testing tutorial on the entire network played by Bilibili. The number of people online at the same time has reached 1,000, and there are also notes that can be collected and distributed by various channels. Master technical communication: 798478386    

[Updated] A complete collection of the most detailed practical tutorials on Python interface automation testing taught by Bilibili (the latest practical version)_bilibili_bilibili [Updated] A complete collection of the most detailed practical tutorials on Python interface automated testing taught by Bilibili (practical version) The latest version) has a total of 200 videos, including: 1. Why interface automation is needed, 2. Overall view of request for interface automation, 3. Interface practice for interface automation, etc. For more exciting videos from UP master, please follow the UP account . icon-default.png?t=N7T8https://www.bilibili.com/video/BV17p4y1B77x/?spm_id_from=333.337 

3. It can be seen that tomcat9 has changed compared with before, and the permissions are divided into 4 types.

manager-gui
manager-script
manager-jmx
manager-status

4. Moreover, mangar-gui cannot be used with mangar-script or mangar-jmx at the same time, so we can configure it as follows:

<tomcat-users>
<role rolename="admin"/>
<role rolename="admin-gui"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin" roles="admin-gui,manager-gui"/>
<user username="bjhg" password="bjhg" roles="manager-script"/>
<user username="hg" password="hg" roles="manager-jmx"/>
</tomcat-users>

5. Restart Tomcat to take effect. Enter the corresponding username and password to use the Server Status, Manager App, and host-manager functions.

(1) Click the three buttons just configured, as shown in the figure below:

 (2) The login page pops up and enter the username and password just configured in xml, as shown in the figure below:

 (3) Click "Login", the login is successful, the following picture appears, the configuration is successful, as shown in the following picture:

2.2jmeter configuration

1. After tomcat configuration is completed, jmeter needs to be configured; we need to use: HTTP authorization manager to allow JMeter to pass Tomcat authentication and allow access to tomcat related data.

  • Username - admin (depends on configuration in tomcat-users.xml file)

  • Password - admin (depends on configuration in tomcatusers.xml file)

  • Leave other fields blank. As shown below:

 

2. HTTP request, send a get request to tomcat to obtain monitoring data, as shown in the following figure:

3. Correctly fill in the IP address and tomcat port number of the server where tomcat is located, fill in manager/status in the "path", request parameters, the name is "XML" (note that it is capitalized), the value is "true", and check in Advanced As a monitor (must be checked); as shown in the figure below: 

4. Finally, right-click on "HTTP Request" and select "Add" - "Monitor Results" and set the number of loops of the thread group to "Forever", as shown in the following figure:

 5. By running the thread group, you can monitor Tomcat. The monitoring data can also be saved as a file for subsequent analysis. As shown below:

Note that there are subtitles on both sides of the chart. The left is the percentage, the right is dead/healthy. If a memory line rises and falls rapidly, it may indicate memory thrashing. In these cases it is better to use Borland OptimizeIt or JProbe to profile the application. What you want to see is the general pattern of loading, memory and threading. Any erratic behavior usually indicates poor performance or some kind of bug.

3. Summary

1. This function only supports TOMCAT5 and above versions, official description http://jmeter.apache.org/usermanual/build-monitor-test-plan.html.

2. Tomcat must be restarted after configuring the user name, password and permissions.

3.Solution to the JMeter monitor result with no data: http request, remember to select "Use as monitor" below.

4. The result of adding a monitor is in jmeter2.9, and it seems that it cannot be found in other versions.

 

Guess you like

Origin blog.csdn.net/Faith_Lzt/article/details/133241341