• Brennan's avatar
    Prevent repetitive backlog trimming (#12155) · c340fd5a
    Brennan authored
    When `replicationFeedSlaves()` serializes a command, it repeatedly calls
    `feedReplicationBuffer()` to feed it to the replication backlog piece by piece.
    It is unnecessary to call `incrementalTrimReplicationBacklog()` for every small
    amount of data added with `feedReplicationBuffer()` as the chance of the conditions
    being met for trimming are very low and these frequent calls add up to a notable
    performance cost. Instead, we will only attempt trimming when a new block is added
    to the replication backlog.
    
    Using redis-benchmark to saturate a local redis server indicated a performance
    improvement of around 3-3.5% for 100 byte SET commands with this change.
    
    (cherry picked from commit 40e6131b)
    c340fd5a
replication.c 165 KB