Federico Toledo is the co-founder and director of the software testing company Abstracta, and holds a PhD in Computer Science from UCLM, Spain. With over 10 years of experience in performance engineering, he's helped many companies to successfully improve their application performance. He is dedicated to testing education, having written one of the first books in Spanish on testing and formed Abstracta Academy. He is also a co-organizer of TestingUY, the biggest testing conference in Latin America.

Become a JMeter and Continuous Testing Pro

Start Learning

Test Your Website Performance NOW! |

arrowPlease enter a URL with http(s)
Mar 23 2017

Differentiating Response Times in JMeter with Embedded Resources

When load testing, we need our scripts to simulate real user behaviour as accurately as possible. This includes getting HTML resources from the server. When you request a URL for a webpage the HTML resources can have different embedded elements, like images used in the page, JavaScripts that must execute certain code on the client side, and CSS files for adding style to our HTML elements. After receiving the request, the browser gets the HTML, parses it and retrieves all the embedded resources automatically with new HTTP requests.


To make JMeter behave more like a browser that gets HTML, enable the “retrieve all embedded resources” option.


In your Thread Group Right Click -> Sampler -> HTTP Request -> Advanced -> Retrieve All Embedded Resources


retrieving embedded resources on jmeter


But this might be a problem when measuring response time. It’s important to understand that the response time that JMeter shows for each HTTP request with the embedded resources enabled will include all requests, both the primary and the secondary ones that are triggered (embedded).


You don’t necessarily want to measure the embedded resources response times, for example if you are using a CDN or 3rd parties or you are interested in a certain endpoint.


So, how do we distinguish the response times corresponding to the main request and the embedded requests?


The solution is very simple, we just have to use the "View Results in Table" component. This listener shows individual response times of the requests, provided that we enable the option "Child samples" (see the image below).


This table in the screenshot below shows the response times not only for the main request to “opencart.abstracta.us”, but also for all its embedded resources. We can see the response times in the column “Sample Time” in milliseconds. The first row corresponds to the main request and the last one corresponds to a Transaction Controller containing the HTTP Request sampler.


view results in table listener


Through this listener, we can see the response time for the main request, separately from the response time for each embedded resource.


But a new problem arises here. Have you noticed that the sum of the response times is larger than the response time registered by the Transaction Controller? Shouldn’t they be the same? What is the reason for the difference?


The answer is that the secondary requests are made in parallel threads. When we select the option “retrieve all embedded resources” there is another option next to that checkbox, which allows us to set the number of “parallel downloads”, meaning the number of threads requesting the embedded resources.


parallel downloads in jmeter


As they are not sequential, the total response time is not equal to the sum of all the individual requests. This is an advantage for the user experience since the loading time for the web page is going to be shorter, as explained here. This is the main reason for simulating this aspect properly, but on the other hand we shouldn’t forget that using this implies that JMeter is going to use more resources for the simulation (because it needs more threads, sockets, memory, and so on).


That’s it! You now know how to differentiate Response Times in JMeter when embedded resources are retrieved.


To learn more about JMeter check out this free 5 day online course.


To try BlazeMeter, put your URL in the box at the top of this page or upload your jmx file, and your test will start in minutes.

arrowPlease enter a URL with http(s)

Interested in writing for our Blog?Send us a pitch!