core / pragma.http / Apache5HttpClientFactory /

Apache5HttpClientFactory #

object Apache5HttpClientFactory

Builds outbound ktor clients on the Apache5 engine, which pools connections. CIO only reuses connections when pipelining is enabled, so every request would otherwise pay a new TCP connect and TLS handshake.

Apache5 has no WebSocket support; WebSocket clients stay on CIO.

Properties #

NameSummary

MAX_CONNECTIONS_PER_ROUTE

const val MAX_CONNECTIONS_PER_ROUTE: Int = 500

Must stay at or above the largest concurrency limit configured on a caller of this client. httpclient5 does not bound the wait for a pooled connection, so a caller blocked on an exhausted pool fails at REQUEST_TIMEOUT_MILLIS and is recorded as a request timeout, not as pool exhaustion.

MIN_IO_THREAD_COUNT

const val MIN_IO_THREAD_COUNT: Int = 4

ktor hard-codes 4 IO reactor threads for Apache5; the factory raises it to the core count.