Sylwester Lachiewicz created THRIFT-6207:
--------------------------------------------
Summary: Go: Add thread-safe client connection pool (TClientPool)
Key: THRIFT-6207
URL: https://issues.apache.org/jira/browse/THRIFT-6207
Project: Thrift
Issue Type: New Feature
Components: Go - Library
Reporter: Sylwester Lachiewicz
Currently, the Apache Thrift Go library (lib/go/thrift) lacks a built-in client
connection pool abstraction. Because Thrift client instances and raw socket
transports are not safe for concurrent use across goroutines, applications must
either create a new TCP/TLS connection per RPC (introducing significant latency
and socket churn) or implement custom connection pools outside the library.
In contrast, other languages (such as Java via Apache Commons Pool /
TTransportPool, and C++) provide standard connection pooling facilities.
### Proposed Solution
Implement a thread-safe connection pool in lib/go/thrift:
1. Configurable Capacity & Lifecycle: Support MinIdle, MaxActive, IdleTimeout,
and MaxConnLifetime.
2. Context-Aware Acquisition: Get(ctx context.Context) (TTransport, func(),
error) to allow cancellations and bounded wait times when the pool is at
maximum capacity.
3. Health Validation: Integrate pre-borrow connection validation using
TSocket.CheckConn() (THRIFT-5214) to transparently discard broken or
server-closed connections before returning them to callers.
4. Graceful Shutdown: Support Close() to drain and cleanly close all active and
idle transport connections.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)