JPCui / jpcui.github.io

0 stars 0 forks source link

【redis】RedisTemplate的一点疑问 | RushGo #19

Open JPCui opened 3 years ago

JPCui commented 3 years ago

https://rushgo.wiki/redis/%E3%80%90redis%E3%80%91RedisTemplate%E7%9A%84%E4%B8%80%E7%82%B9%E7%96%91%E9%97%AE/

最近老是看到 redis 从pool里获取/释放的频繁操作日志, 跟踪业务发现, 每调用一次 RestTemplate.execute(callback), 都会从连接池里获取jedis连接 频繁获取和释放连接, 会很浪费资源.在获取资源时, 会经过下面几个操作: 获取空闲对象(takeObject/pollObject) 激活对象(activateObject) 检查对象是否可用(testOn