valkey icon indicating copy to clipboard operation
valkey copied to clipboard

Input output traffic stats and command process count for each client.

Open CharlesChen888 opened this issue 1 year ago • 3 comments

We already have global stats for input traffic, output traffic and how many commands have been executed.

However, some users have the difficulty of locating the IP(s) which have heavy network traffic. So here some stats for single client are introduced.

tot-net-in   // Total network input bytes read from the client
tot-net-out  // Total network output bytes sent to the client
tot-cmds     // Total commands the client has executed     

These three stats are shown in CLIENT LIST and CLIENT INFO.

Though the metrics are handled in hot paths of the code, personally I don't think it will slow down the server. Considering all other complex operations handled nearby, this is only a small and simple operation.

However we do need to be cautious when adding more and more metrics, as discussed in redis/redis#12640, we may need to find a way to tell whether this has obvious performance degradation.

CharlesChen888 avatar Apr 16 '24 11:04 CharlesChen888

@valkey-io/core-team Please 👍 and 👎 for this since it's a major issue.

madolson avatar Apr 17 '24 16:04 madolson

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:exclamation: No coverage uploaded for pull request base (unstable@96d14fe). Click here to learn what that means.

Additional details and impacted files
@@             Coverage Diff             @@
##             unstable     #327   +/-   ##
===========================================
  Coverage            ?   68.40%           
===========================================
  Files               ?      108           
  Lines               ?    61571           
  Branches            ?        0           
===========================================
  Hits                ?    42118           
  Misses              ?    19453           
  Partials            ?        0           
Files Coverage Δ
src/blocked.c 91.86% <100.00%> (ø)
src/networking.c 84.94% <100.00%> (ø)
src/server.c 88.13% <100.00%> (ø)

codecov[bot] avatar Apr 22 '24 03:04 codecov[bot]

OK, besides the one comment about tot-cmds, the change LGTM.

madolson avatar Apr 29 '24 17:04 madolson

@madolson Any more comments? I think this PR is ready to merge.

CharlesChen888 avatar May 06 '24 00:05 CharlesChen888