jondot/sneakers

Shared memory space for all workers

khataev opened this issue · 1 comments

Hi! I'm just curious is it possible to implement such behaviour. The case is that each of my workers establishes some connection to remote server (I'm fetching emails with IMAP protocol). So I'd like to have some kind of pool of established connections in advance. I want this pool to be available to newly spawned worker, so it could fetch connection instead of connecting again and again, wasting time and resources.

Do you think leveraging the connection-pool gem would help here? You could add n connections to your server into the pool for your workers to share. Then you could limit the number of concurrent connections and reuse connections as long as their alive. The connection pool can handle reconnecting and making sure the pool has sufficient resources according to your limit.