Here are some simple hints on debugging Redis performance issues.
Monitoring Live Redis QueriesRun the "monitor" command to see queries as they are sent against an Redis instance. Do not use on high traffic instance!
redis-cli monitorThe output looks like this
redis 127.0.0.1:6379> MONITOR OK 1371241093.375324 "monitor" 1371241109.735725 "keys" "*" 1371241152.344504 "set" "testkey" "1" 1371241165.169184 "get" "testkey"
Analyzing Slow CommandsWhen there are too many queries better use "slowlog" to see the top slow queries running against your Redis instance:
slowlog get 25 # print top 25 slow queries slowlog len slowlog reset
Debugging LatencyIf you suspect latency to be an issue use "redis-cli" built-in support for latency measuring. First measure system latency on your Redis server with
redis-cli --intrinsic-latency 100and then sample from your Redis clients with
redis-cli --latency -h <host> -p <port>If you have problems with high latency check if transparent huge pages are disabled. Disable it with
echo never > /sys/kernel/mm/transparent_hugepage/enabled
Check Background Save SettingsIf your instance seemingly freezes peridiocally you probably have background dumping enabled.
grep ^save /etc/redis/redis.confComment out all save lines and setup a cron job to do dumping or a Redis slave who can dump whenever he wants to. Alternatively you can try to mitigate the effect using the "no-appendfsync-on-rewrite" option (set to "yes") in redis.conf.
Check fsync SettingPer default Redis runs fsync() every 1s. Other possibilities are "always" and "no".
grep ^appendfsync /etc/redis/redis.confSo if you do not care about DB corruption you might want to set "no" here.