Search code examples
testingjmeterperformance-testingstress-testingjmeter-3.2

JMeter How to test page loading performance while another page is open


I was wondering if there is a a way to test the following scenario in jmeter:

Site: A site has 2 pages, one of those (let's call it heavy-page), after load is done, consumes a lot of system resources (cpu), the other doesn't (let's call it light-page).

  1. Simulate 1000 users (threads) loading and staying on the heavy page.
  2. While those 1000 users are still on the heavy-page, have another group of 1000 users load the light-page.

The key questions would be, how to have the first set of threads simulate users staying on a page after it is done loading, while having another set of users loading the light-page?

Currently I have something like this:

Group1 (1000 threads, loop count 1):
 - Runtime controller (set to 5min, so each thread runs for 5 minutes):
   - heavy-page
Group2: (1000 threads, loop count 1, and a startup delay set to 2 minutes, so it starts after all threads in Group1 are running)
 - light-page

This does almost all I wanted, except that I see that heavy-page sent a lot more requests than what I was expecting (way over 1000) like it didn't recognize loop count set to one in G1. I'm not sure if the reason behind that is that since the sampler/thread is inside a runtime controller it is just looping forever during the time set by the controller, which would mean (I think) that the user is not just staying on the page for 5 minutes, but it is sending the request one after another after the page has loaded, which is not what I need to test


Solution

    1. In your setup users are not "staying" at the "heavy page", they are re-opening it again and again. Runtime Controller don't respect the loop count, it runs its children for the specified duration.

    2. As per JMeter Project main page:

      JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

    3. JMeter's HTTP Request samplers don't "stay" at the page, they execute request, retrieve the response, measure time taken and if there are no more samplers to execute and loops to iterate the thread is being shut down. If there are background events happening at the "heavy" page like AJAX requests or WebSocket requests you need to simulate them using Parallel Controller or WebSocket Samplers