LoadRunner's Java vuser Protocol

Source: Internet
Author: User

During this period, we will test the performance of a Java product. Nosql storage. The client written in fixed Java needs to send data to the server. Therefore, we use LoadRunner's Java vuser protocol to try concurrency. For a cracked version of LoadRunner, you must replace the license with 100. Do not use the 10000 version. Otherwise, Java is not supported.
1. Create a Java vuser protocol. The content in init and end does not need to be modified. Because action contains the two items
2. The script is as follows:

Import lrapi. lr; // do not delete the class that comes with LoadRunner. the following references the defined class. Development will put these classes in the jar package
Import Voldemort. Client. clientconfig;
Import Voldemort. Client. socketstoreclientfactory;
Import Voldemort. Client. storeclient;
Import Voldemort. Client. storeclientfactory;
Import Voldemort. versioning. versioned;

Public class actions
{
Storeclient <string, string> client; // public Region

Public int Init () throws throwable {
String bootstrapurl = "TCP: // 192.168.64.183: 8003"; // only one TCP connection is established.
Storeclientfactory factory = new socketstoreclientfactory (New clientconfig (). setbootstrapurls (bootstrapurl)
Client = factory. getstoreclient ("test ");
Return 0;
}

Public int action () throws throwable {
Client. Put ("<key>", "Chinese"); // loop part, write data
Client. Get ("<key>"); // loop part, read data
Return 0;
}

Public int end () throws throwable {
Return 0;
}
}
Note: The jar package must be placed in the root directory of vuser script. Otherwise, the jar package cannot be found.
JDK must be installed on the machine running LoadRunner; otherwise, Java cannot compile
When multiple clients are pressurized at the same time, you must copy the jar package on each machine. The hosts file. After opening it, there will be other client script locations, 192.168.xx.xx = D: \ temp \ brr_yar.419 \ netdir \ D \ Script \ Java \ res \ 192.168.64.68 _ 45.eve. Test the required jar package under D: \ temp \ brr_yar.419 \ netdir \ D \ Script \ Java.

I feel that LoadRunner is limited to support Java projects. The LoadRunner does not support multi-thread concurrency mode. Later, in the running settings, change the thread mode to the process mode. This method consumes too much resources and can only be performed on multiple clients.

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.