Recently I noticed that the traffic of a redis server is significant higher than normal(at about 2GB/s) and
is about to exceed the hardware limits. I searched around and found many people are facing this problem.
So I dig into the code and find there is a bug. and here are the details:
Redis counts more bytes than it actually wrote when dealing with pending replies, and this would make
metrics of instantaneous_output_kbps and total_net_output_bytes increase very fast.
In src/networking.c writeToClient function:
while(clientHasPendingReplies(c)) {
//...
nwritten = write(/*...*/);
totwritten += nwritten;
//...
server.stat_net_output_bytes += totwritten;
}
totwritten is counted(and not reset) each time the loop runs.
BTW I made a pull request on Github.