Class HttpConnectionPools
java.lang.Object
ai.redouble.nucleo.http.HttpConnectionPools
Shared HTTP connection pool for all API calls.
Single pool serves all workloads (LLM, embeddings, general HTTP).
Apache HttpClient's internal connection pooling handles concurrency. The pool holds
HttpSettings.poolSize connections, as the total and as the per-route maximum
alike. Its timeouts: 30 seconds to open a connection, 15 minutes for a response and for
socket reads, 60 minutes to obtain a connection from the pool when every one is leased.
A connection idle for more than 5 seconds is validated before reuse; one idle for 5
minutes is evicted.
Usage: Just call getClient() from anywhere that needs HTTP.
- Since:
- 0.1 (2025-01-10)
- Author:
- Andrey Santrosyan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHow long a connection may take to open; SDK transports a provider builds itself use the same.static final intHow long a response may take to arrive: a model call writing a long answer is silent until it is done, so this is the window of the longest call, and SDK transports a provider builds itself use the same rather than their own shorter defaults. -
Method Summary
Modifier and TypeMethodDescriptiongate()The admission account a job's demand names when it makes HTTP calls: one permit per admitted job, sized to this pool, so the pool is never the narrower door.org.apache.hc.client5.http.impl.classic.CloseableHttpClientGets the shared HTTP client.static HttpConnectionPoolsorg.apache.hc.core5.pool.PoolStatsgetStats()Gets current pool statistics.
-
Field Details
-
CONNECT_TIMEOUT_SECONDS
public static final int CONNECT_TIMEOUT_SECONDSHow long a connection may take to open; SDK transports a provider builds itself use the same.- See Also:
-
RESPONSE_TIMEOUT_MINUTES
public static final int RESPONSE_TIMEOUT_MINUTESHow long a response may take to arrive: a model call writing a long answer is silent until it is done, so this is the window of the longest call, and SDK transports a provider builds itself use the same rather than their own shorter defaults.- See Also:
-
-
Method Details
-
getInstance
-
getClient
public org.apache.hc.client5.http.impl.classic.CloseableHttpClient getClient()Gets the shared HTTP client. -
gate
The admission account a job's demand names when it makes HTTP calls: one permit per admitted job, sized to this pool, so the pool is never the narrower door. -
getStats
public org.apache.hc.core5.pool.PoolStats getStats()Gets current pool statistics.
-