Once you've used the IBM Application Pattern for Java to deploy a Web Application on Apache Tomcat or other middleware, the next task you might want to undertake is to load test your application. Given that you've deployed your web application remotely to the cloud, it may be that you don't have the network bandwidth to carry out load testing from your local machine to the remote deployment - therefore being able to get one bit of the cloud to load test another bit could be useful.
Another usage scenario for the IBM Application Pattern for Java is cloud-based load testing, whereby cloud-based engines are deployed for load-testing web (or other) applications. For this purpose, you can use the IBM Application Pattern for Java to deploy Apache JMeter and use its server load-testing engine capability.
Assuming you've downloaded and saved a JMeter archive from Apache, follow these steps (illustrated in Figure 7) to create a deployment of Apache JMeter 2.7 in server mode in the Virtual Application Builder:
- Drag in a Java application widget from the palette to be the JMeter server. You can optionally give it a name, such as Apache JMeter 2.7 Server.
- From the Archive File configuration field, browse to the JMeter archive that you've downloaded from Apache.org — such as apache-jmeter-2.7.tar.gz. You don't need to make any changes to the download.
- Select Command Line from the Application launch type list and enter /apache-jmeter-2.7/bin/jmeter-server -Jserver.rmi.localport=6437 in the Command Line field. This is the server launch script — provided in the download from apache.org — that is used to start the JMeter server, along with an additional option that sets the RMI connection port rather than using a randomly assigned one (which would cause problems with the firewall).
- Add one Generic listener for RMI Registry on 1099 and another for RMI connection on 6437 (specified using the localport option). Two generic listeners are required because you can only specify a single port in each. The RMI Registry defaults to port 1099, and the RMI connection port was specified using the Jserver.rmi.localport=6437 option on the command line.
- Add a Generic target on 9080 for the application server (AppServer in Figure 7) hosting the web application that you'll test. A server IP/netmask of 0.0.0.0/0.0.0.0 allows for any application-server IP address. The generic target component with a port of 9080 means that it can send traffic to port 9080 on the target server, which is the port that an application deployed using the Web Application Pattern will use. This is useful when you do not yet know where the target application will be. You can also limit it to a specific IP address or range of IP addresses.
- Drag in a Monitored file and configure it to monitor the JMeter log files, such as /jmeter-server.log, the default JMeter log file that shows the status of the load tests being run through the server.
Once the JMeter server application has been deployed, you can run a load test
from a client/desktop install of JMeter by launching the client with the
server list option and using the Run -> Remote Start
option inside the JMeter Client UI to launch the testing from the servers in
You can run a sample JMeter test plan (see bottom of entry) against a deployment of the "Sample Web application only" sample provided as part of the Web Application Pattern Type 2.0 pattern, using the following steps:
Run JMeter from the command line with the address of the JMeter server
deployment — for example:
- Inside JMeter, click File -> Open to open a test plan.
- Select the SampleWebAppTestPlan.jmx file.
- Select Test Plan -> Thread Group -> HTTP Requests Default from the tree view in the left-hand panel.
- Modify the Web Server: Server Name or IP address in the main panel to be the address part of the endpoint for your deployed "Sample Web application only" sample.
- Modify the HTTP Request: path to be any other part of the endpoint address before /webapp/.
- Select Run -> Remote Start -> JMeter Server Address to start the test.
The following steps enable you to see if load is being driven against the "Sample Web application only" sample:
- For the deployed sample, select Manage to launch the Virtual Application Console.
- Select Monitoring > Middleware.
- Select the web application item from the list — for example, Web-Application-was.11342004774648.
The main panel should then display a number of graphs that can be used to monitor the deployed web application. If the web application is receiving load from the JMeter server, then the Web Applications Request Count graph should show requests being serviced, as illustrated here:
Below is a download of a sample test plan for JMeter for use against the "Sample web application only" sample for the IBM Web Application Pattern:
JMeter sample test plan
Below is a template for Apache JMeter 2.7. In order to use this you will need to download apache-jmeter-2.7.tar.gz and upload it into the template:
Template for Apache JMeter 2.7