Browse DevX
Sign up for e-mail newsletters from DevX


Load Testing with Apache JMeter : Page 2

Got a handle on how much your Website can handle? Use Apache's new Jmeter to perform fast, easy load testing on your Web pages, Web applications, and databases.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Testing Things Out

Figure 2. Here are the values to set up in the "Small File" Thread Group.

First, make sure that you can load the two static Web pages through your Web browser. Next, create a Thread Group for the smaller file. Right click on the Test Plan and go to Add->Thread Group. The Thread Group should appear under the Test Plan in the left pane. Click on the Thread Group in the left pane and fill out the values as shown in Figure 2.

To test things out, set the Thread Group to run one thread, which represents one user making a request. The ramp-up period specifies the time it takes to reach the maximum number of threads. So, if you had 100 threads and a ramp-up period of ten seconds, Jmeter would launch ten threads per second (100 threads/ten seconds).

Uncheck the Forever checkbox next to Loop Count and set the Loop Count to one for now. The loop count defines the number of times that the thread group will loop before terminating. Bear in mind that the ramp-up period only applies to the first loop.

Figure 3. This is the HTTP Request Sampler for the "Small File" Thread Group.

Now, you need to tell JMeter where your Web page is. Right click on the Small File thread group you just created and go to Add->Sampler->HTTP Request. Setup the HTTP Request sampler as shown in Figure 3.

The port number and path may differ based on the Web server to which you deployed the HTML files. Make certain that you check the "Retrieve All Images" checkbox under Optional Tasks. This is essential, because youre testing the response time for your pages based on the image sizes.

You want to know if the page has loaded properly, so add a View Results Tree Listener to the Thread Group as well. This listener allows you to see the HTML results for each request that your threads make. Right click on the Thread Group and select Add->Listener->View Results Tree.

To run the test and see if your page pulls up correctly, click on the Run menu at the top and select Start (or just press Ctrl-R).

Figure 4. View the Results Tree after the tests have run.

Select the View Results Tree and you should see something similar to Figure 4. The image icon in the Response Data area indicates that there is an image in the file. But drill down further under the Request Small File folder—you can retrieve the image there without a problem.

Now that you know your page was pulled up correctly, you need to create a similar Test Group for the large file. A saved version of the test plan generated for this article is available here. Download this file and modify it however you see fit. This saved test plan may not work in previous or future versions of JMeter.

Thanks for your registration, follow us on our social networks to keep up-to-date