You have 3 tests configured:
- TestOnBorrow - Sends a PING request when requesting a resource.
- TestOnReturn - Sends PING, and you return the resource to the pool.
- TestWhileIdle - Sends periodic PINGS from unallocated resources in the pool.
While itβs good to know that your connections are still alive, those onBorrow PING requests spend RTT before your request, and the other two tests waste valuable Redis resources. Theoretically, the connection may get worse even after the PING test, so you should catch the connection exception in your code and deal with it even if you send the PING. If your network is stable and you do not have too many drops, you should remove these tests and process this scenario only with your exceptions.
Also, by setting MaxIdle == MaxTotal, you will not evict resources from your pool (good / bad?, Depends on your use). And when your pool is exhausted, an attempt to get a resource will end in a timeout after 2 minutes of waiting for a free resource.
Ofir luzon
source share