tuk
tuk

Reputation: 6872

Relation between PoolTimeout, IdleTimeout & IdleCheckFrequency in go-redis

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

Upvotes: 4

Views: 5340

Answers (1)

tuk
tuk

Reputation: 6872

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.

Upvotes: 5

Related Questions