vert.xvertx-verticlevertx-httpclientvert.x-webclient

Vert Http Client max connection pooling? Is this pool per endpoint or in total?


I am using vertx web client (3.8.5) for api-gateway and setting setMaxPoolSize to 20. Is this limit per endpoint or in total across all endpoints?

I am deploying my application with 36 verticles and 1 web client per verticle, which makes 36 web clients in total and my application needs to connect to more than 1000 different ip:port. Now, to use the benefit of connection pooling, if the above limit is on total connections, I need to setMaxPoolSize >= 1000 which makes overall connections from the application equal to 1000 * 36 >= 36000. What are the advisable settings for the above use case?

If I set maxPoolSize = 20 and none of them has expired (expiry time = 60s) and only let's say 10 of them are being used, what happens when the request comes for ip:port which isn't in pool. Does it get queued or one of the unused connection is disconnected and a new connection (for the new ip:port) is established?

What should be my client configuration for api-gateway to handle multiple concurrent requests for different ip:port?

Thanks, Nitish


Solution

  • After reading vert.x code, I figured out that maxPoolSize is per destination

    So, in the above case, it would be number of http clients * maxPoolSize (per destination)

    I don't expect more than 100 concurrent requests to any destination host. So, setting this value to 5 gives me - 5 * 36 (36 http clients) = 180 connections

    Note : If you are running good number of http clients in an instance with multiple verticles, you need to configure the max number of open file descriptors