diff options
author | Harkrishn Patro <harkrisp@amazon.com> | 2022-07-03 23:47:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-04 09:47:34 +0300 |
commit | a3704d4e87b65a9c071b9dd1ead04cc338d3bc18 (patch) | |
tree | d5823eb7b2d97bb6bec9d66e9df24777ff79aaed /tests/cluster | |
parent | 33b7ff387cbc75b5d53d4c42ec6303c8dbd5f656 (diff) | |
download | redis-a3704d4e87b65a9c071b9dd1ead04cc338d3bc18.tar.gz |
Optimize number of realloc syscall during multi/exec flow (#10921)
## Issue
During the MULTI/EXEC flow, each command gets queued until the `EXEC`
command is received and during this phase on every command queue, a
`realloc` is being invoked. This could be expensive based on the realloc
behavior (if copy to a new memory location).
## Solution
In order to reduce the no. of syscall, couple of optimization I've used.
1. By default, reserve memory for atleast two commands. `MULTI/EXEC` for a
single command doesn't have any significance. Hence, I believe customer wouldn't use it.
2. For further reservation, increase the memory allocation in exponent growth (power of 2).
This reduces the no. of `realloc` call from `N` to `log(N)` times.
## Other changes:
* Include multi exec queued command array in client memory consumption calculation
(affects client eviction too)
Diffstat (limited to 'tests/cluster')
0 files changed, 0 insertions, 0 deletions