Response Time Testing – How to Measure for API?

What is Response Time Testing?

Response Time Testing measures the time taken for one system node to respond to the request of another. It is the time a system takes to reach a specific input until the process is over. For example, you have API, and you want to know exactly how much time it takes to execute it and return data in JSON. Response Time measures the server response of every single transaction or query.

Response time starts when a user sends a request and ends at the time that the application states that the request has completed.

How to Measure Response Time?

To Measure Response Time, we can use test tools by surrounding an important business process with Start and End transactions. A business process may be an action or a set of actions which users perform in application to complete a business task like login to the application or to purchase a book on Amazon.com

Response Time Testing

Response Time Testing


For the same process to Measure response time for an API, the response will vary slightly from tool to tool. Here is why

  • Step 1) Method of calculating metrics gathered by each API response time test tool
  • Step 2) Tools Simulate the load and capture speed which can make a difference in the response time
  • Step 3) Extra items recorded when monitoring user loads
  • Step 4) Computing metrics gathered by each tool increases the response time due to high resource consumption.
  • Step 5) The architecture of the two tools may be different

Types of Response Metrics

Response Time Metrics Explanation
Average Response Time The Average Response Time is the average time taken for every round trip request. The Average Response Time includes the loading time of HTML, CSS, XML, images, JavaScript files, etc. Therefore, the average is affected when slow components are present in the system.
Peak Response Time The Peak Response Time helps us to find potentially problematic components. It helps us to find all the irregularity in the website or system where a certain request is not handled correctly. For example, there may be a large database query executed which can affect the response time. This query does not permit the page to load at the desired time.
Error Rate The Error Rate is a mathematical calculation which displays the percentage of problem requests against all requests. This percentage counts all HTTP status codes displaying an error on the server. It also counts requests which are time out.

Three Important Response Time Values

Response Time Test has two most essential characteristic:

  • Average response time.
  • Maximum response time.

It shows how long a user needs to wait for the server to the response its request.

Following are key Response time testing example values

Response Time Significance
0.1 Second It is most preferred response time. If the response time is 0.1, users always feel that the application or system is responding instantly, and do not feel any interruption.
1.0 Second It is the defined as the maximum limit of acceptable response time. Users are unlikely to feel any interruption, though they may experience some delay. The response time of more than 1-second may interrupt user experience.
10 Seconds It is a maximum limit after which response time goes beyond the acceptable limit. However, in today’s time, if response time exceeds 6 seconds, the user will leave that site or quit the application.

Generally, response time should be fast as possible in the interval of 0.1 – 1 second. However, people can adapt a slower response times, but they will never be happy with a response time greater than 2 seconds. Lesser the response times, better is client satisfaction, lesser costs, higher customer satisfaction.

Response Time Testing Tools

There are many Response Time testing tools are available in the market. Three most prominent Examples of response time testing tools are:

1) JMeter

Apache JMeter is an open source load testing tool. It is designed to measure the performance of websites. This load testing tool can be used in DevOps methodology.

JMeter

Features:

  • JMeter allows performing load and performance test for various server types.
  • This load testing tool store its test plans in XML format which allows users to generate the test plan using a text editor.
  • The tool can be used to perform automated and functional testing of the applications.

Download link: http://jmeter.apache.org/download_jmeter.cgi


2) Load runner

Loadrunner from Micro Focus is a widely used Load Testing tool. It is one of the best alternatives to JMeter that offers a user-friendly monitoring and analysis interface with colored charts and graphics.

Load runner

Features:

  • Supports continuous testing
  • LoadRunner can effectively work on several enterprise environments
  • It is possible to run multiple protocol script with Loadrunner
  • Integration with various development tools like Visual Studio, Jenkins, Selenium, etc.

Download link: https://software.microfocus.com/en-us/products/loadrunner-load-testing/overview

Conclusion:

  • Response time refer to the time take for one system node to respond to the request of another.
  • The Average Response time in performance testing is the average time taken for every round trip request.
  • Peak Response Time helps us to find that what components are potentially problematic.
  • The Error Rate is a mathematical calculation which displays the percentage of problem requests.
  • Three crucial response time values are: 0.1 seconds, 1.0 second and 10 seconds.
  • Three most used response time testing tools are Jmeter, Loadrunner