Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent requests for blocking reactive routes is limited by quarkus.vertx.event-loops-pool-size #10292

Closed
timoesk opened this issue Jun 26, 2020 · 8 comments · Fixed by #10310
Labels
kind/bug Something isn't working
Milestone

Comments

@timoesk
Copy link

timoesk commented Jun 26, 2020

Describe the bug

Concurrent requests for blocking reactive routes is limited by quarkus.vertx.event-loops-pool-size

Expected behavior

Concurrent requests for blocking reactive routes should be limited by quarkus.vertx.worker-pool-size

Actual behavior

When a blocking route is created with the the Route annotation.

@Route(path = "/blocking-with-annotation", methods = HttpMethod.GET, type = Route.HandlerType.BLOCKING)

Then the concurrent HTTP requests are limited by the number of event loops.

To Reproduce

See ReactiveRoutesTest.java in:

https://github.com/timoesk/quarkus-reactive-routes-issue

@timoesk timoesk added the kind/bug Something isn't working label Jun 26, 2020
@gsmet
Copy link
Member

gsmet commented Jun 26, 2020

/cc @johnaohara @cescoffier

@gsmet
Copy link
Member

gsmet commented Jun 26, 2020

maybe /cc @stuartwdouglas too

@timoesk
Copy link
Author

timoesk commented Jun 26, 2020

I noticed that SmallRye Metrics extension has the same issue. The concurrent requests for the metrics API are also limited by the number of event loops.

2020-06-26 14:56:22,293 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-19) Requesting 6
2020-06-26 14:56:22,293 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-9) Requesting 5
2020-06-26 14:56:22,295 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-13) Requesting 1
2020-06-26 14:56:22,295 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-23) Requesting 8
2020-06-26 14:56:22,295 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-3) Requesting 0
2020-06-26 14:56:22,295 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-17) Requesting 9
2020-06-26 14:56:22,295 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-5) Requesting 2
2020-06-26 14:56:22,296 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-31) Requesting 3
2020-06-26 14:56:22,295 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-21) Requesting 7
2020-06-26 14:56:22,295 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-27) Requesting 4
Handling http://localhost:8081/metrics?i=2 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,473 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-5) Completed 2
Handling http://localhost:8081/metrics?i=0 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,538 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-3) Completed 0
Handling http://localhost:8081/metrics?i=5 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,606 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-9) Completed 5
Handling http://localhost:8081/metrics?i=4 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,694 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-27) Completed 4
Handling http://localhost:8081/metrics?i=6 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,763 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-19) Completed 6
Handling http://localhost:8081/metrics?i=8 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,833 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-23) Completed 8
Handling http://localhost:8081/metrics?i=1 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,903 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-13) Completed 1
Handling http://localhost:8081/metrics?i=9 on thread vert.x-worker-thread-1
2020-06-26 14:56:22,968 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-17) Completed 9
Handling http://localhost:8081/metrics?i=3 on thread vert.x-worker-thread-1
2020-06-26 14:56:23,039 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-31) Completed 3
Handling http://localhost:8081/metrics?i=7 on thread vert.x-worker-thread-1
2020-06-26 14:56:23,303 INFO  [org.acm.MetricsTest] (ForkJoinPool-2-worker-21) Completed 7

I used debugger to print the worker thread.

Is this related to the blocking reactive routes issue?

@cescoffier
Copy link
Member

It's related to the @Route annotation.

I've tried the reproducer and changed the code a bit to display the value of the counter. Using the regular route (registered on the router) I got 20. However, with the @Route it does not go above 1.

@cescoffier
Copy link
Member

Found the issue... our blocking handler are registered with ordered set to true, which means it waits for one task to complete before executing the next task.

@cescoffier
Copy link
Member

I've submitted a fix: #10310

@timoesk
Copy link
Author

timoesk commented Jun 26, 2020

That was fast. Thanks!

@cescoffier
Copy link
Member

@timoesk BTW, yes, it would fix the metrics issue too.

@gsmet gsmet added this to the 1.6.0.Final milestone Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants