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.