sorentwo / readthis

:newspaper: Pooled active support compliant caching with redis
MIT License
504 stars 40 forks source link

Let us pass our own Connection Pool? #39

Closed jeffblake closed 8 years ago

jeffblake commented 8 years ago

Hi,

I'm really looking forward to trying this out. Looking a bit at the source code, it looks like you don't allow for me to provide my own connection pool? To maintain predictable redis connection counts, I want to share my Sidekiq client pool with my session store and maybe my IdentityCache Pool as well. Would appreciate any insights here if you've benchmarked this. My plan:

Thanks.

sorentwo commented 8 years ago

@jeffblake Hi, nice to hear you're considering using Readthis. It would be trivial to allow providing a connection pool when instantiating a new cache instance, so I'd be willing to make that change. Where I would push back is at the point of sharing a pool with Sidekiq. Sidekiq jobs are important and must be persisted, backed up to disk, and shouldn't be dropped with memory limitations. On the other hand, cache data can be ephemeral, doesn't require persistence, and should be evicted over time. I'd suggest using two different instances anyhow.

More information about that here http://sorentwo.com/2015/07/27/optimizing-redis-usage-for-caching.html.

jeffblake commented 8 years ago

That's a good point. In fact, I already have separate servers for session (redis, readthis) and worker (sidekiq) so I can't share pools anyway.