Skip to content

Instantly share code, notes, and snippets.

@iamstoick
Last active January 11, 2018 02:05
Show Gist options
  • Save iamstoick/2ff86fa0a5e851b50d6c5f06770b6e38 to your computer and use it in GitHub Desktop.
Save iamstoick/2ff86fa0a5e851b50d6c5f06770b6e38 to your computer and use it in GitHub Desktop.
Redis useful commands

info commandstats - collect throughput metric values for all the commands run on the Redis server

info memory - collect all memory utilization metrics data for a Redis instance

Memory RSS (Resident Set Size) is the number of bytes that the operating system 
has allocated to Redis. If the ratio of ‘memory_rss’ to ‘memory_used’ is greater 
than ~1.5, then it signifies memory fragmentation. The fragmented memory can be 
recovered by restarting the server.

info stats - provides keyspace_hits & keyspace_misses metric data to further calculate cache hit ratio

If the cache hit ratio is lower than ~0.8 then a significant amount of the 
requested keys are evicted, expired, or do not exist at all. It is crucial 
to watch this metric while using Redis as a cache. Lower cache hit ratio results 
in larger latency as most of the requests are fetching data from the disk. 
It indicates that you need to increase the size of Redis cache to improve 
your application’s performance.

Further readings:

  1. https://scalegrid.io/blog/6-crucial-redis-monitoring-metrics/
  2. https://blog.newrelic.com/2015/05/11/redis-performance-metrics/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment