1 Reply Latest reply on Mar 20, 2014 11:59 AM by oliver.grist

    Redis hit/miss rate application monitoring possible?

    oliver.grist

      Hello,

       

      We have recently moved some systems to used Redis in favour of Memcache, for key -> value lookups.

       

      I notice you can monitor Memcahce and get things like "cache hit/miss rate".

       

      Is Redis in the pipeline, with similar kinds of statistics available?

       

      Thanks,

      Oli.

        • Re: Redis hit/miss rate application monitoring possible?
          oliver.grist

          Did some reading and a lot of this is available pretty easily.

           

          I made one called "Redis" consisting of 2 subcomponents the first being "Keys". Seems to graph stuff nicely.

           

          I appreciate the code isn't efficient, maybe someone can improve on this?

           

          Command Line: perl ${SCRIPT} /tmp


          and the body to:

          $tcr=`redis-cli info | grep total_connections_received | cut -d':' -f 2`;

          print "Message.TotalConnectionsReceived: Total number of connections accepted by the server: $tcr\n";

          print "Statistic.TotalConnectionsReceived: $tcr\n";

           

          $tcp=`redis-cli info | grep total_commands_processed | cut -d':' -f 2`;

          print "Message.TotalConnectionsProcessed: Total number of connections processed by the server: $tcp\n";

          print "Statistic.TotalConnectionsProcessed: $tcp\n";

           

          $ksh=`redis-cli info | grep keyspace_hits | cut -d':' -f 2`;

          print "Message.KeyspaceHits: Number of successful lookup of keys in the main dictionary: $ksh\n";

          print "Statistic.KeyspaceHits: $ksh\n";

           

          $ksm=`redis-cli info | grep keyspace_misses| cut -d':' -f 2`;

          print "Message.KeyspaceMisses: Number of failed lookup of keys in the main dictionary: $ksm\n";

          print "Statistic.KeyspaceMisses: $ksm\n";

           

          $ek=`redis-cli info | grep evicted_keys| cut -d':' -f 2`;

          print "Message.EvictedKeys: Number of evicted keys due to maxmemory limit: $ek\n";

          print "Statistic.EvictedKeys: $ek\n";

           

          $rc=`redis-cli info | grep rejected_connections| cut -d':' -f 2`;

          print "Message.RejectedConnections: Number of connections rejected because of maxclients limit: $rc\n";

          print "Statistic.RejectedConnections: $rc\n";

           

          exit 0;

           

           

           

          and the 2nd being: "Resource Usage"

           

          set:  Command Line:  perl ${SCRIPT} /tmp

           

          $cpusys=`redis-cli info | grep used_cpu_sys | cut -d':' -f 2`;

          print "Message.SystemCPU: System CPU consumed by the Redis server: $cpusys\n";

          print "Statistic.SystemCPU: $cpusys\n";

           

          $cpuuser=`redis-cli info | grep used_cpu_user | cut -d':' -f 2`;

          print "Message.UserCPU: User CPU consumed by the Redis server\n";

          print "Statistic.UserCPU: $cpuuser\n";

           

          $ksh=`redis-cli info | grep keyspace_hits | cut -d':' -f 2`;

          print "Message.KeyspaceHits: Number of successful lookup of keys in the main dictionary: $ksh\n";

          print "Statistic.KeyspaceHits: $ksh\n";

           

          $ramused=`redis-cli info | grep used_memory| cut -d':' -f 2`;

          print "Message.UsedMemory: Total number of bytes allocated by Redis using its allocator: $ramused\n";

          print "Statistic.UsedMemory: $ramused\n";

           

          $ramrss=`redis-cli info | grep used_memory_rss | cut -d':' -f 2`;

          print "Message.UsedMemoryRSS: Number of bytes that Redis allocated as seen by the operating system (a.k.a resident set size): $ramrss\n";

          print "Statistic.UsedMemoryRSS: $ramrss\n";

           

          $ramfragment=`redis-cli info | grep mem_fragmentation_ratio| cut -d':' -f 2`;

          print "Message.MemoryFragmentationRatio: Ratio between used_memory_rss and used_memory: $ramfragment\n";

          print "Statistic.MemoryFragmentationRatio: $ramfragment\n";

           

          exit 0;