Expand Authors Top

If you have a few years of experience in the Java ecosystem and you’d like to share that with the community, have a look at our Contribution Guidelines.

Expanded Audience – Frontegg – Security (partner)
announcement - icon User management is very complex, when implemented properly. No surprise here.

Not having to roll all of that out manually, but instead integrating a mature, fully-fledged solution - yeah, that makes a lot of sense.
That's basically what Frontegg is - User Management for your application. It's focused on making your app scalable, secure and enjoyable for your users.
From signup to authentication, it supports simple scenarios all the way to complex and custom application logic.

Have a look:

>> Elegant User Management, Tailor-made for B2B SaaS

Generic Top

Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:

>> CHECK OUT THE COURSE

1. Overview

Performance testing is a crucial part of software development. It helps reveal bottlenecks and bugs and ensures our applications are responsive. One particularly important aspect is the time a web application needs to load and react to user interactions.

In this article, we're going to explore two metrics that can help detect and improve load time issues: latency and load time. We'll learn how these metrics are defined, what distinguishes them from each other, and how to measure them with the performance tool JMeter.

2. Latency and Load Time Metrics in JMeter

In JMeter, latency and load time are both metrics that measure roundtrips. In other words, they both measure the time from when a client sends a request to a server until it receives the response. However, there's an important difference between these two.

Latency is defined as the time from just before sending the request to just after receiving the first part of the response, whereas load time is the time from just before sending the request to just after receiving the last part of the response.

For both metrics, JMeter includes the time it takes to assemble the request. Latency also includes the time it takes to assemble the first part of the response, and load time includes the time to assemble the entire response. Assembling does not include the rendering of the response or any client-side code execution.

3. How to Measure Latency and Load Time

We can measure latency and load time in JMeter by creating a test plan that sends an HTTP request and uses a View Results Tree Listener.

We'll start with a test plan that JMeter automatically creates when we open the tool. In our case, let's rename it to LatencyVsLoadTime:

Screenshot of a JMeter test plan

Next, let's create a Thread Group, which is the beginning point of every test plan. This is done by right-clicking the test plan and then selecting Add -> Thread (Users) -> Thread Group:

JMeter screenshot on how to create a Thread Group

Next, let's add an HTTP Request by right-clicking the Thread Group and selecting Add -> Sampler -> HTTP Request:

JMeter screenshot on how to create an http request sampler

Last but not least, we need a Listener that tracks the results of our request. Let's add it by right-clicking the Thread Group and selecting Add -> Listener -> View Results Tree:

JMeter screenshot on how to create a View Results Tree Listener

Now that we have all parts of the test plan in place, let's configure our HTTP request.

To do this, we select the HTTP Request and set the Path to the URL we want to test. For our example, let's choose https://www.google.com:

JMeter screenshot on how to configure an http request

After saving the test plan by clicking the disk icon in the top bar, we can execute it. Let's select the HTTP Request and click the play button in the top bar:

JMeter screenshot on how to save a test plan

Finally, let's check the results by selecting the View Results Tree element under the Sampler result tab. In our example, the request has a latency of 215 ms and a load time of 218 ms:

Screenshot of JMeter test results of an http request

4. Conclusion

In this article, we've discussed two performance metrics, latency and load time, that can help to detect load time issues and improve the usability of an application.

First, we defined the metrics in the context of JMeter and elaborated on the difference between the two. Then, we saw how to set up a JMeter test plan with an HTTP request that we could use to measure the metrics. Finally, we learned how to execute the test plan and examine the results.

The JMeter test plan that we created throughout this article is available over on GitHub.

Generic bottom

Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:

>> CHECK OUT THE COURSE
Junit footer banner
Comments are closed on this article!