Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relation between PoolTimeout, IdleTimeout & IdleCheckFrequency in go-redis

Tags:

redis

go

Can someone let me know the relation between PoolTimeout, IdleTimeout & IdleCheckFrequency in go-redis?

Doubts:-

  1. If I specify PoolTimeout 20ms, IdleTimeout 20ms, PoolSize 100 & IdleCheckFrequency 1 min. Let's say all the connection in the pool are used and a connection finishes its operation. Then will the request for a new connection wait till the IdleCheck is run in 1 min interval?
  2. If I specify PoolSize 100 will the client keep open 100 connections to redis even if there is no active client operation being performed to Redis?

Environment:-

  1. Go - 1.7.4
  2. Redis - 3.2.6
  3. Go-Redis - v5.2
like image 577
tuk Avatar asked Oct 16 '25 14:10

tuk


1 Answers

This has been answered in github here. Just posting the relevant parts below:-

PoolSize limits max number of open connections. If app is idle then go-redis does not open any connections.

New connection is opened when there is a command to process and there are no idle connections in the pool. Idle connections are closed after they are idle for IdleTimeout.

IdleCheckFrequency specifies how often we check if connection is expired. This is needed in case app is idle and there is no activity. Normally idle connections are closed when go-redis asks pool for a (healthy) connection.

like image 169
tuk Avatar answered Oct 18 '25 07:10

tuk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!