Closed BharathMC closed 4 weeks ago
You are blocking the event loop. What you are doing is actually an exception earlier in the latest version of Micronaut. If you intention is to do primarily blocking operations you need to configure the client & server to handle that case. Here is a recommended configuration:
# We assume primarily blocking user code, so configure the server & client to handle blocking I/O
micronaut.server.thread-selection=blocking
micronaut.netty.event-loops.http-client-group.executor=blocking
micronaut.netty.event-loops.http-client-group.prefer-native-transport=true
micronaut.http.client.event-loop-group=http-client-group
micronaut.http.client.pool.enabled=true
Expected Behavior
Concurrent requests to micronaut service should work fine without any issues.
Actual Behaviour
I am facing issue with concurrent requests hitting micronaut service.
To simplify, I have made this application: I have exposed a GET method REST api, which calls external service REST API and returns HTTP 200.
When I run these in sequential, it works fine. But, when I run in concurrent fashion with just 2 threads, it fails with timeout exception after 200 requests.
Note: endpoint (health) API is available and no issue on that.
Steps To Reproduce
Resource class
Filter class
application.properties
Exception after some requests (about 200 requests):
Exception happens at
and
Post stopping the incoming requests, these logs are printed continuously
Thanks
Environment Information
JDK 17
Example Application
No response
Version
4.2.1