question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rest-client-reactive has limit for amount of simultaneously outgoing requests

See original GitHub issue

Describe the bug

Hi, there ! I found out that rest-client-reactive has limit for amount of simultaneously outgoing requests to 20, so next requests accomplish only after some of the first finished.

That’s feature or bug? Are there any configuration properties to extend this limit?

Expected behavior

No limit by default

Actual behavior

Limit to 20 requests

How to Reproduce?

Api.java

@Path("/")
public class Api {
    static final Logger LOG = Logger.getLogger(Api.class);

    final AtomicLong pingCounter;

    final Service service;

    public Api(@RestClient Service service) {
        this.service = service;
        pingCounter = new AtomicLong();
    }

    @POST
    @Path("/ping")
    public Response ping() throws InterruptedException {
        long number = pingCounter.incrementAndGet();
        LOG.debugf("Ping request, %d", number);
        Thread.sleep(5000);
        LOG.debugf("Pong response, %d", number);
        return Response.ok("pong " + number).build();
    }

    @POST
    @Path("/load/{requests}")
    public Uni<Response> load(int requests) {
        LOG.debugf("Load request, requests=%d", requests);

        List<Uni<String>> unis = new ArrayList<>();
        for (int i = 0; i < requests; i++) {
            unis.add(service.ping());
        }

        return Uni.combine().all().unis(unis)
                .combinedWith(listOfResponse -> Response.ok(listOfResponse.toString()).build());
    }
}

Service.java

@RegisterRestClient
public interface Service {

    @POST
    @Path("/ping")
    Uni<String> ping();
}

application.yml

"%dev":
  quarkus:
    rest-client:
      "com.crionuke.Service":
        url: "http://localhost:8080/"

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

<quarkus.platform.version>2.5.1.Final</quarkus.platform.version>

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

curl -X POST -v localhost:8080/load/30
2021-12-02 14:57:35,921 DEBUG [ru.sbe.gen.aut.Api] (vert.x-eventloop-thread-5) Load request, requests=30
2021-12-02 14:57:36,001 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-0) Ping request, 1
2021-12-02 14:57:36,002 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-1) Ping request, 2
2021-12-02 14:57:36,003 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-2) Ping request, 3
2021-12-02 14:57:36,004 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-3) Ping request, 4
2021-12-02 14:57:36,005 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-4) Ping request, 5
2021-12-02 14:57:36,005 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-5) Ping request, 6
2021-12-02 14:57:36,006 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-6) Ping request, 7
2021-12-02 14:57:36,007 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-7) Ping request, 8
2021-12-02 14:57:36,007 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-8) Ping request, 9
2021-12-02 14:57:36,008 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-9) Ping request, 10
2021-12-02 14:57:36,009 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-10) Ping request, 11
2021-12-02 14:57:36,010 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-11) Ping request, 12
2021-12-02 14:57:36,010 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-12) Ping request, 13
2021-12-02 14:57:36,011 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-13) Ping request, 14
2021-12-02 14:57:36,012 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-14) Ping request, 15
2021-12-02 14:57:36,013 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-15) Ping request, 16
2021-12-02 14:57:36,013 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-16) Ping request, 17
2021-12-02 14:57:36,015 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-17) Ping request, 18
2021-12-02 14:57:36,015 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-18) Ping request, 19
2021-12-02 14:57:36,016 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-19) Ping request, 20
2021-12-02 14:57:41,005 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-2) Pong response, 3
2021-12-02 14:57:41,005 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-4) Pong response, 5
2021-12-02 14:57:41,005 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-3) Pong response, 4
2021-12-02 14:57:41,005 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-1) Pong response, 2
2021-12-02 14:57:41,005 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-0) Pong response, 1
2021-12-02 14:57:41,007 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-6) Pong response, 7
2021-12-02 14:57:41,007 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-7) Pong response, 8
2021-12-02 14:57:41,007 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-5) Pong response, 6
2021-12-02 14:57:41,008 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-8) Pong response, 9
2021-12-02 14:57:41,013 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-12) Pong response, 13
2021-12-02 14:57:41,013 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-9) Pong response, 10
2021-12-02 14:57:41,013 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-11) Pong response, 12
2021-12-02 14:57:41,013 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-10) Pong response, 11
2021-12-02 14:57:41,014 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-13) Pong response, 14
2021-12-02 14:57:41,014 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-14) Pong response, 15
2021-12-02 14:57:41,018 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-16) Pong response, 17
2021-12-02 14:57:41,017 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-15) Pong response, 16
2021-12-02 14:57:41,018 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-17) Pong response, 18
2021-12-02 14:57:41,018 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-18) Pong response, 19
2021-12-02 14:57:41,020 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-19) Pong response, 20
2021-12-02 14:57:41,048 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-19) Ping request, 21
2021-12-02 14:57:41,049 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-18) Ping request, 22
2021-12-02 14:57:41,049 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-17) Ping request, 23
2021-12-02 14:57:41,050 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-15) Ping request, 24
2021-12-02 14:57:41,051 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-16) Ping request, 25
2021-12-02 14:57:41,052 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-14) Ping request, 26
2021-12-02 14:57:41,052 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-13) Ping request, 27
2021-12-02 14:57:41,054 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-11) Ping request, 28
2021-12-02 14:57:41,054 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-10) Ping request, 29
2021-12-02 14:57:41,055 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-9) Ping request, 30
2021-12-02 14:57:46,049 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-19) Pong response, 21
2021-12-02 14:57:46,049 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-18) Pong response, 22
2021-12-02 14:57:46,050 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-17) Pong response, 23
2021-12-02 14:57:46,050 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-15) Pong response, 24
2021-12-02 14:57:46,051 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-16) Pong response, 25
2021-12-02 14:57:46,052 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-14) Pong response, 26
2021-12-02 14:57:46,053 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-13) Pong response, 27
2021-12-02 14:57:46,054 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-11) Pong response, 28
2021-12-02 14:57:46,056 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-10) Pong response, 29
2021-12-02 14:57:46,056 DEBUG [ru.sbe.gen.aut.Api] (executor-thread-9) Pong response, 30

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TomasHofmancommented, Dec 2, 2021

@geoand @crionuke I believe the configuration property for setting the connection pool size is already exposed. Can you try following?

quarkus.rest-client."com.crionuke.Service".connection-pool-size=40
1reaction
geoandcommented, Dec 2, 2021

Thanks for reporting.

This is expected, see https://github.com/quarkusio/quarkus/pull/20977 for details.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the REST Client Reactive - Quarkus
As HTTP messages can have large bodies, we limit the amount of body characters logged. The default limit is 100 , you can...
Read more >
Simultaneous Spring WebClient Calls - Baeldung
This reactive operator has a concurrency level of 256 by default, meaning it executes at most 256 getUser calls simultaneously.
Read more >
coordinating multiple outgoing requests in a reactive manner
Yes, the MP RestClient is reactive. Let's say you have this service which invokes a backend to get a comic villain:
Read more >
Rest Client for MicroProfile
MicroProfile Rest Client Server Sent Event Support ... The annotation contains three attributes: name , value . and required .
Read more >
Endpoint Limits for Concurrent REST Requests from vCenter ...
Envoy has a maximum HTTPS connection limit of 2048, and the maximum number of connections from Envoy to the vAPI endpoint is limited...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found