Member-only story
How to check the performance of Rest API in Spring Boot Project.
In this tutorial, we will learn how to check and log time taken by rest API to process the request with ease. By following these simple steps, you can measure and optimize your application’s performance.
What is API Response Time ?
API Response time is a critical metric that developers must monitor to ensure the smooth functioning of their spring boot applications. The response time of an API refers to the amount of time it takes for the application to return a response to a given request. Monitoring and Log API response time can help developers detect and resolve issues that affect the performance of the application.
Okay Lets start to write the code :
I have already created a spring boot application and also created one Controller class MessageController.java
package com.example.schedulerdemo.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MessageController {
@GetMapping("/message")
public String getMessage(){
return "message received successfully.";
}
}
Calculate API Response time in spring boot application :