Simulate Real Users with JMeter

If you are setting up a JMeter test to simulate user load on your website or web application, you’ll need to follow these steps to make your tests as realistic as possible.

Cache and Cookies

Add a “HTTP Cookie Manager” and a “HTTP Cache Manager” to your test. Set them to clear on each iteration.

Configure Your HTTP Request

At the foot of your HTTP Request sampler, select “Retrieve All Embedded Resources” and set the concurrent pool size to 6 (this is the average between the 4 to 8 usually employed by browsers and allows a number of simultaneous requests for resources).

Now add a filter to exclude URLs from third parties – because you don’t want to performance test Google’s JavaScript files and other third party files (especially not without their permission!)

To do this, set the URLs Must Match field to:

^((?!google|someone-else|some-other-third-party).)*$

This will exclude URLs that contain the specified terms (so you would need to ensure there was no clash – for example, if you had a resource on your website such as “http://example.com/interesting-google-buttons.css”, it would not be downloaded as an embedded resource.

Summary

If you look at the requests being generated by JMeter now, you’ll see that there are additional requests for resources on the page, such as images, CSS, and JavaScript – and cookies are stored and sent along with these requests. Some resources will also be cached, which makes things quite realistic.