Always network clients require a connection pool, like database connection, cache connection and others. Generic connection pool can be used with anything. It is extracted from ActiveRecord ConnectionPool. Sharing a limited number of network connections among many threads. Connections are created delayed.
Gemfile gem 'generic_connection_pool', '~> 0.1.1'
install gem install generic_connection_pool