radix
radix copied to clipboard
Does pool's connection number can be adjusted dynamically based on different RPS?
How does radix's pool work
I checked the source codes, it works as below
- The pool will create all connections initial with pool.size number: https://github.com/mediocregopher/radix/blob/v3/pool.go#L359
- When use redis connection to get data, if some crtical network happens, the connection will be removed from the pool
- This is test case for it: https://github.com/mediocregopher/radix/blob/v3/pool_test.go#L210
-
refill operation will be executed periodically to add connection:
- When do
refill operation
, allow some overflow- https://github.com/mediocregopher/radix/blob/v3/pool.go#L485
- https://github.com/mediocregopher/radix/blob/v3/pool.go#L343
- When do
-
doOverflowDrain operation will be executed periodically to delete the redundant connection:
- If current connection number is greater than pool.size, the redundant connection will be deleted: https://github.com/mediocregopher/radix/blob/v3/pool.go#L520
(If i miss something, please tell me)
Does the pool work as below?
We expect the pool feature like below
- There should have
minConnectionNumber
andmaxConnectionNumber
configuration. - Normally, the init connection number should be
minConnectionNumber
- The connection number should be adjusted automatically according to
how much the RPS against redis server
- Under higher RPS, the connections should be created, but can't exceed maxConnectionNumber
- Under lower RPS, the connections should be removed, but cannot be lower than the minConnectionNumber
Is it possible to make radix pool
to support adjust the connection number
dynamically based on RPS in future?
(If already support, can share how to implement?)