dongsaolian8786 2016-12-10 16:53
浏览 657
已采纳

go-redis中PoolTimeout,IdleTimeout和IdleCheckFrequency之间的关系

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
  • 写回答

1条回答 默认 最新

  • douduan6731 2016-12-12 06:54
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器