Can ktor client limit the number of concurrent con...
# ktor
u
Can ktor client limit the number of concurrent connections? Something like this code for HttoAsyncCliebt:
Copy code
CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
    .setMaxConnTotal(100)
    .setMaxConnPerRoute(10)
    .build();
📝 1
âś… 1
e
It's engine specific for now. `CIO`:
Copy code
val client = HttpClient(CIO.config {
    maxConnectionsCount = 10

    endpoint.apply {
        maxConnectionsPerRoute = 10
    }
})
In
Apache
you could use
customizeRequest
builder in engine config
d
For the record, the CIO part is explained here: https://ktor.io/clients/http-client.html#cio Going to update to explain this
u
Thanks for all the responses. I go down the Apache route. Actually I was wondering, if this feature is abstracted, independent of the used engine.
d
(Already added to the website) Right now Jetty doesn’t support maximum connection configuration. But I agree that would be convenient to do that
811 Views