I've deployed my high traffic SpringBoot Application on Wildfly 10. The server architecture for this application is nginx (Angular Application) -> (reverse proxy) -> wildfly server. Since we get high traffic during the hours, the 8080 port (wildfly application port) stays at CLOSE_WAIT because nginx closes the connection after certain period of time.
I'm looking to configure the Spring Boot Application to close the connection if the request time is lets say > than 5 seconds.
Example:
@GetMapping("test1")
public ResponseEntity test1(){
return ResponseEntity.ok("TESTED!");
}
@GetMapping("test2")
public ResponseEntity test2() throws InterruptedException{
Thread.sleep(300000);
return ResponseEntity.ok("TESTED!");
}
For test2 Get HTTP method is there a way to configure spring boot application / Wildfly / centos to set connection timeout for incoming request?
You can try
server.connection-timeout=300000in yourapplication.properties.From the official documentation:
Or you can try to use the
@Transactionalannotation and set an argument to it as that:@Transactional(timeout = 300000)