How to make spring accept multiple synchronous requests?

Viewed 68

I am implementing a system using Spring Boot 2.3.5 where two micro-services (e.g. A and B) make web requests to each other in a way like this:

Service A -> Service B -> Service A

This services are hosted in Azure App Services, where this type of flow works with no problem at all.

The problem is when running locally, the second call from Service B to Service A causes a deadlock, once the Service A is waiting for the service B to respond, causing a timeout exception.

My question is: Is there a way to make Spring Boot applications accept more than one request simultaneously while running on local machine?

I've already tried to set the variable server.tomcat.threads.max to 100 in the application-local.yml from the Service A but with no success.

1 Answers

As pointed out by M. Deinum the reason of the deadlock was a block in the database caused by the @Transactional annotation.

The problem was that during the second call to Service A the spring was trying to access a table which spring blocked because of the transactional.

What I did was take out the first call from the transactional method and place it in another use case, therefore when Service A tries to read the value, the table is already free.

Related