A generic, thread-safe connection pool implementation for Ruby network clients like Redis and Dalli.
Connection_pool is a generic connection pooling library for Ruby that manages shared network connections (like Redis or Memcached clients) across threads and fibers. It prevents connection exhaustion in concurrent applications by providing a thread-safe pool with configurable size and timeout, ensuring efficient resource usage.
Ruby developers building concurrent applications that use network clients (Redis, Dalli, etc.) and need to manage shared connections safely across threads or fibers.
Developers choose Connection_pool because it's a reliable, generic alternative to database-specific pools, offering thread safety, easy migration from single connections, and fine-grained control over connection lifecycle without the risks of Ruby's native Timeout API.
Generic connection pooling for Ruby
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works with any Ruby network client like Redis or Dalli, providing a unified pooling solution instead of relying on database-specific implementations, as shown in the usage examples.
Ensures safe connection sharing across threads and fibers with configurable timeouts, preventing connection exhaustion and race conditions in concurrent apps.
Offers ConnectionPool::Wrapper for gradual adoption from single global connections, making it straightforward to refactor existing code without immediate full rewrites.
Includes shutdown, reload, and reap methods for controlled connection handling, useful in long-running processes or after forking, as detailed in the README.
The ConnectionPool::Wrapper uses method_missing, which the README explicitly states is not high-performance, making it a bottleneck for performance-sensitive code.
Upgrading from version 2.x requires converting positional arguments to keywords, as documented, which can break existing implementations and increase migration effort.
Lacks built-in support for connection validation, dynamic pool sizing, or integration with monitoring tools, requiring custom code for advanced use cases.