How LoadRunner monitors Tomcat Performance

Source: Internet
Author: User

How LoadRunner monitors Tomcat Performance

When LoadRunner is used for performance testing, the general intuition is that LR can only complete script recording and writing to simulate user request behavior, but in some cases, to monitor the performance of some middleware or web servers, you cannot use the recording script. You need to write a script manually and use the lr_user_data_point ("", "") function provided by LR to perform custom performance monitoring.

The following uses monitoring Tomcat web server as an example.

Implementation ideas:

1. Configure Tomcat Login User, find the/conf/tomcat-users.xml under the tomcat-6.0.37 directory, add the configuration as follows:

<Tomcat-users>
<Role rolename = "manager-gui"/>
<User username = "monitor" password = "123456" roles = "manager-gui"/>
</Tomcat-users>

(After configuring the Tomcat login user, we recommend that you test whether the configured user can log on to the Tomcat Management page)

2. In the Action Script, use web_set_user ("username", "password", "tomcat server IP Address: Port ");

3. Write web_url () in the script. Simulate the url for accessing Tomcat and log on

4. Use the association function web_reg_save_parm () to dynamically capture the desired data

5. Use the lr_user_data_point function ("metric indicator name" and "Metric value") to record user-defined data samples.

The VuGen script code is as follows:

Action_tomcat ()
{

Double atof (const char * string );

Web_reg_save_param ("JVM_FreeMemory ",
"LB = Free memory :",
"RB = MB ",
"Ord = 1 ",
LAST );

Web_reg_save_param ("JVM_TotalMemory ",
"LB = Total memory :",
"RB = MB ",
"Ord = 1 ",
LAST );

Web_reg_save_param ("JVM_MaxMemory ",
"LB = Max memory :",
"RB = MB ",
"Ord = 1 ",
LAST );

Web_reg_save_param ("HTTP_MaxThreads ",
"LB = Max threads :",
"RB = ",
"Ord = 1 ",
LAST );

Web_reg_save_param ("HTTP_MaxProcessingTime ",
"LB = Max processing time :",
"RB = s ",
"Ord = 1 ",
LAST );

Web_reg_save_param ("HTTP_RequestCount ",
"LB = Request count :",
"RB = ",
"Ord = 1 ",
LAST );

Web_reg_save_param ("HTTP_BytesReceived ",
"LB = Bytes encoded ed :",
"RB = MB ",
"Ord = 1 ",
LAST );

Web_set_user ("monitor", "123456", "localhost: 8088 ");

Lr_think_time (5 );

Web_url ("status ",
"URL = http: // localhost: 8088/manager/status ",
"Resource = 0 ",
"Referer = ",
"Snapshot = t1.inf ",
"Mode = HTML ",
LAST );

Lr_user_data_point ("tomcat_jvm_freemory", atof (lr_eval_string ("{jvm_freemory }")));

Lr_user_data_point ("Tomcat_JVM_TotalMemory", atof (lr_eval_string ("{JVM_TotalMemory }")));

Lr_user_data_point ("Tomcat_JVM_MaxMemory", atof (lr_eval_string ("{JVM_MaxMemory }")));

Lr_user_data_point ("Tomcat_HTTP_MaxThreads", atof (lr_eval_string ("{HTTP_MaxThreads }")));

Lr_user_data_point ("Tomcat_HTTP_MaxProcessingTime", atof (lr_eval_string ("{HTTP_MaxProcessingTime }")));

Lr_user_data_point ("Tomcat_HTTP_ProcessingTime", atof (lr_eval_string ("{HTTP_ProcessingTime }")));

Lr_user_data_point ("Tomcat_HTTP_RequestCount", atof (lr_eval_string ("{HTTP_RequestCount }")));

Lr_user_data_point ("Tomcat_HTTP_BytesReceived", atof (lr_eval_string ("{HTTP_BytesReceived }")));

Return 0;
}

Run the script to view the playback log:

Write the script (Note: We recommend that you put the script code for monitoring Tomcat in a new Action and after the recorded business script). Next, optimize the business script, the process for creating a Controller is the same as that for testing performance.

In the Controller monitoring scenario diagram, add "RunTime diagram-user-defined data point diagram"

Finally, in the Analysis report generated by Analysis, you can see that "RunTime diagram-user-defined data point diagram" shows data,

Note: here, the values of logs and Tomcat_HTTP_RequestCount will increase, while those values such as Tomcat_HTTP_MaxThreads, Tomcat_JVM_MaxMemory, and Tomcat_HTTP_MaxProcessingTime will not change much, basically because of tomcat's own restrictions.

Conclusion: we can see that 4 ~ During the 5-minute period, there is a bottleneck for tomcat to process client requests. In the future, we need to observe other figures for analysis, which may be a CPU bottleneck.

Install JDK + Tomcat in RedHat Linux 5.5 and deploy Java Projects

Tomcat authoritative guide (second edition) (Chinese/English hd pdf + bookmarks)

Tomcat Security Configuration and Performance Optimization

How to Use Xshell to view Tomcat real-time logs with Chinese garbled characters in Linux

Install JDK and Tomcat in CentOS 64-bit and set the Tomcat Startup Procedure

Install Tomcat in CentOS 6.5

Tomcat details: click here
Tomcat: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.