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

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

Closed
crionuke opened this issue Dec 2, 2021 · 5 comments
Closed
Labels
area/rest-client kind/bug Something isn't working triage/wontfix This will not be worked on

Comments

@crionuke
Copy link

crionuke commented Dec 2, 2021

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
@crionuke crionuke added the kind/bug Something isn't working label Dec 2, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 2, 2021

/cc @michalszynkiewicz

@geoand
Copy link
Contributor

geoand commented Dec 2, 2021

Thanks for reporting.

This is expected, see #20977 for details.

@geoand geoand closed this as completed Dec 2, 2021
@geoand geoand added the triage/wontfix This will not be worked on label Dec 2, 2021
@geoand
Copy link
Contributor

geoand commented Dec 2, 2021

Maybe we can expose this as part of the rest client config? WDYT @michalszynkiewicz @TomasHofman ?
Also, we should document this clearly.

@TomasHofman
Copy link
Contributor

@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

@geoand
Copy link
Contributor

geoand commented Dec 2, 2021

Ah, nice! I didn't know that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client kind/bug Something isn't working triage/wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants