CONFIG RESETSTAT

Introduction and Use Case(s)

CONFIG RESETSTAT is a Redis command used to reset the stats reported by the INFO command. This includes resetting counters such as the number of commands processed, connections received, and more. It is typically used when you need to clear statistics for monitoring purposes, or before starting a new performance test to ensure you’re working with clean data.

Syntax

  1. CONFIG RESETSTAT

Parameter Explanations

This command does not take any parameters.

Return Values

The CONFIG RESETSTAT command returns a simple status reply indicating that the operation was successful.

Example:

  1. OK

Code Examples

  1. dragonfly> INFO
  2. # Server
  3. redis_version:6.2.1
  4. ...
  5. # Stats
  6. total_connections_received:5
  7. total_commands_processed:10
  8. ...
  9. dragonfly> CONFIG RESETSTAT
  10. OK
  11. dragonfly> INFO
  12. # Server
  13. redis_version:6.2.1
  14. ...
  15. # Stats
  16. total_connections_received:0
  17. total_commands_processed:0
  18. ...

Best Practices

  • Use CONFIG RESETSTAT before running performance tests to start with a clean slate.
  • Regularly reset statistics in long-running instances if you’re using them for operational monitoring to keep the data relevant.

Common Mistakes

  • Forgetting that this command does not affect historical data outside of the current runtime statistics.

FAQs

Does CONFIG RESETSTAT affect all clients connected to the Redis server?

No, it only resets the internal statistics counters of the Redis server; it does not impact connected clients.

Can I undo a CONFIG RESETSTAT command?

No, once the statistics are reset, they cannot be restored. Be cautious when using this command.