Skip to content

HttpClient usage #151

@alekseibozhev

Description

@alekseibozhev

I need to send a lot of concurrent http requests per second. (from 1k to 20k per second, for example). This is probably can be implemented by pure netty, and it will work very fast. However, I would like to take advantage of pretty API, that reactor-netty provides. So I'm using reactor.ipc.netty.http.client.HttpClient. But it shows very high latency, even on low amount of requests. I'm doing a simple measurement, like this:

HttpClient httpClient = HttpClient.create();
AtomicLong total = new AtomicLong(0);
for (int i = 0; i < 1234; i++) {
    long l = System.currentTimeMillis();
    httpClient.get("https://jsonplaceholder.typicode.com/posts/1").timestamp().subscribe(tuple2 -> {
        total.getAndAdd(tuple2.getT1() - l);
    });
}
System.in.read();
System.out.println("total = " + total.get() / 1234);

Following snippet prints 1000 ms average. This is inappropriate for my use case (rest calls for microservices).
Is my use case suitable for your library, and if so, how to achieve good results ?
I'm using reactor-core 3.0.7. and reactor-netty 0.6.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions