Strange behavior with Rails and Pool connection_limit
Closed this issue · 2 comments
Hi! Don't know if i am wrong or not. I made example repo https://github.com/woto/async-redis-test
It has slightly modified example of pub/sub https://github.com/woto/async-redis-test/blob/master/app/controllers/test_controller.rb Also i added output for current subscribers listeners_count
. During testing with wrk
i see almost 50 subscibers (then their amount decreases and then again increases up to 50). Shouldn't connection be closed? Even if not, shouldn't their amount up to connection_limit
?
Thanks.
Hmmm, this change leads to correct closing connections
woto/async-redis-test@93c76d3
The connections are cached. Connections which are in use (i.e. in a transaction context) will not be used by other tasks/requests. We could implement high and low water marks to close connections (i.e. only keep a limited number of unused connections). But right now this isn't done. You shouldn't need to worry about idle connections unless you are literally exhausting some kind of resource limit.