Language | Issue and Suggestion | Sample Code |
golang go-redis connection pool | We recommend that you put the used connections at the end of the queue, and get connections from the front of the queue to avoid always getting hot connections. | The queen connection methods and related codes are as follows:
For more information, see redis/go-redis . For v8.11.5 or later, the queue connection method has been fixded. Please confirm the version and the code logic to avoid hot connection. |
golang redigo Connection pool configuration | Redigo connection pool only allows you to get connections from the front of the queue and put the used connections back to the front. As a result, the hottest connection is always being used without polling each connection, and proxy connection or load is always being unbalanced. To address this issue, you need to modify the source code in the pool.go file and add pushBack method and Lifo member variables. | The sample codes are as follows:
For more information, see Suggestions for Using Connection Pool. |
java_jedis_pool | Queue connection mode in connection pool false: Take the connection from the front of the queue and put it back to the end, which is recommended. true: Take the connection from the front of the queue and put it back to the front, which is the default mode and ensures that the hottest connection is always used. Specify the regular check time for the connection pool to avoid connections being occupied for a long time without being released. It is recommended to configure it as 3000 ms, which means checking every 3 seconds.
time-between-eviction-runs: 3000ms | For the key sample code, see Sample Code of Jedis Connection Pool. For more sample codes, see spring-boot-jedis-demo. |
java_lettuce_pool | Set the queue mode of the connection pool to be the same as that of java_jedis_pool. Disable reuse of the connection to avoid PipeLine. | We recommend that you configure the parameters as follows. For more sample codes, see java_jedis_lettuce_pool. For core codes, see RedisConfig.java and RedisProperties.java.
|
spring_boot_redisson connection pool | Configure the maximum connections, the maximum and the minimum idle connections with the same value. | The queen connection methods and related codes are as follows:
|
Was this page helpful?