From bc846d047de1ebc3d352688f02948b0c14f00e56 Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 4 Jun 2020 01:28:52 -0400 Subject: [PATCH] Latency doctor updated for KeyDB Pro Former-commit-id: a2690fca4a74e92eb44d5e38f886b08363a6d7b0 --- src/latency.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/latency.cpp b/src/latency.cpp index 3bf10109b..458e7a992 100644 --- a/src/latency.cpp +++ b/src/latency.cpp @@ -213,7 +213,7 @@ void analyzeLatencyForEvent(char *event, struct latencyStats *ls) { if (ls->samples) ls->mad = sum / ls->samples; } -/* Create a human readable report of latency events for this Redis instance. */ +/* Create a human readable report of latency events for this KeyDB instance. */ sds createLatencyReport(void) { sds report = sdsempty(); int advise_better_vm = 0; /* Better virtual machines. */ @@ -239,7 +239,7 @@ sds createLatencyReport(void) { if (dictSize(g_pserver->latency_events) == 0 && g_pserver->latency_monitor_threshold == 0) { - report = sdscat(report,"I'm sorry, Dave, I can't do that. Latency monitoring is disabled in this Redis instance. You may use \"CONFIG SET latency-monitor-threshold .\" in order to enable it. If we weren't in a deep space mission I'd suggest to take a look at http://redis.io/topics/latency-monitor.\n"); + report = sdscat(report,"I'm sorry, Dave, I can't do that. Latency monitoring is disabled in this KeyDB instance. You may use \"CONFIG SET latency-monitor-threshold .\" in order to enable it.\n"); return report; } @@ -258,7 +258,7 @@ sds createLatencyReport(void) { if (ts == NULL) continue; eventnum++; if (eventnum == 1) { - report = sdscat(report,"Dave, I have observed latency spikes in this Redis instance. You don't mind talking about it, do you Dave?\n\n"); + report = sdscat(report,"Dave, I have observed latency spikes in this KeyDB instance. You don't mind talking about it, do you Dave?\n\n"); } analyzeLatencyForEvent(event,&ls); @@ -381,15 +381,15 @@ sds createLatencyReport(void) { dictReleaseIterator(di); /* Add non event based advices. */ - if (THPGetAnonHugePagesSize() > 0) { + if (g_pserver->aof_enabled && THPGetAnonHugePagesSize() > 0) { advise_disable_thp = 1; advices++; } if (eventnum == 0 && advices == 0) { - report = sdscat(report,"Dave, no latency spike was observed during the lifetime of this Redis instance, not in the slightest bit. I honestly think you ought to sit down calmly, take a stress pill, and think things over.\n"); + report = sdscat(report,"Dave, no latency spike was observed during the lifetime of this KeyDB instance, not in the slightest bit. I honestly think you ought to sit down calmly, take a stress pill, and think things over.\n"); } else if (eventnum > 0 && advices == 0) { - report = sdscat(report,"\nWhile there are latency events logged, I'm not able to suggest any easy fix. Please use the Redis community to get some help, providing this report in your help request.\n"); + report = sdscat(report,"\nWhile there are latency events logged, I'm not able to suggest any easy fix. Please use the KeyDB community to get some help, providing this report in your help request.\n"); } else { /* Add all the suggestions accumulated so far. */ @@ -401,7 +401,7 @@ sds createLatencyReport(void) { /* Slow log. */ if (advise_slowlog_enabled) { - report = sdscatprintf(report,"- There are latency issues with potentially slow commands you are using. Try to enable the Slow Log Redis feature using the command 'CONFIG SET slowlog-log-slower-than %llu'. If the Slow log is disabled Redis is not able to log slow commands execution for you.\n", (unsigned long long)g_pserver->latency_monitor_threshold*1000); + report = sdscatprintf(report,"- There are latency issues with potentially slow commands you are using. Try to enable the Slow Log KeyDB feature using the command 'CONFIG SET slowlog-log-slower-than %llu'. If the Slow log is disabled KeyDB is not able to log slow commands execution for you.\n", (unsigned long long)g_pserver->latency_monitor_threshold*1000); } if (advise_slowlog_tuning) { @@ -414,12 +414,12 @@ sds createLatencyReport(void) { /* Intrinsic latency. */ if (advise_scheduler) { - report = sdscat(report,"- The system is slow to execute Redis code paths not containing system calls. This usually means the system does not provide Redis CPU time to run for long periods. You should try to:\n" + report = sdscat(report,"- The system is slow to execute KeyDB code paths not containing system calls. This usually means the system does not provide KeyDB CPU time to run for long periods. You should try to:\n" " 1) Lower the system load.\n" - " 2) Use a computer / VM just for Redis if you are running other softawre in the same system.\n" + " 2) Use a computer / VM just for KeyDB if you are running other softawre in the same system.\n" " 3) Check if you have a \"noisy neighbour\" problem.\n" " 4) Check with 'keydb-cli --intrinsic-latency 100' what is the intrinsic latency in your system.\n" - " 5) Check if the problem is allocator-related by recompiling Redis with MALLOC=libc, if you are using Jemalloc. However this may create fragmentation problems.\n"); + " 5) Check if the problem is allocator-related by recompiling KeyDB with MALLOC=libc, if you are using Jemalloc. However this may create fragmentation problems.\n"); } /* AOF / Disk latency. */ @@ -428,15 +428,15 @@ sds createLatencyReport(void) { } if (advise_ssd) { - report = sdscat(report,"- SSD disks are able to reduce fsync latency, and total time needed for snapshotting and AOF log rewriting (resulting in smaller memory usage and smaller final AOF rewrite buffer flushes). With extremely high write load SSD disks can be a good option. However Redis should perform reasonably with high load using normal disks. Use this advice as a last resort.\n"); + report = sdscat(report,"- SSD disks are able to reduce fsync latency, and total time needed for snapshotting and AOF log rewriting (resulting in smaller memory usage and smaller final AOF rewrite buffer flushes). With extremely high write load SSD disks can be a good option. However KeyDB should perform reasonably with high load using normal disks. Use this advice as a last resort.\n"); } if (advise_data_writeback) { - report = sdscat(report,"- Mounting ext3/4 filesystems with data=writeback can provide a performance boost compared to data=ordered, however this mode of operation provides less guarantees, and sometimes it can happen that after a hard crash the AOF file will have an half-written command at the end and will require to be repaired before Redis restarts.\n"); + report = sdscat(report,"- Mounting ext3/4 filesystems with data=writeback can provide a performance boost compared to data=ordered, however this mode of operation provides less guarantees, and sometimes it can happen that after a hard crash the AOF file will have an half-written command at the end and will require to be repaired before KeyDB restarts.\n"); } if (advise_disk_contention) { - report = sdscat(report,"- Try to lower the disk contention. This is often caused by other disk intensive processes running in the same computer (including other Redis instances).\n"); + report = sdscat(report,"- Try to lower the disk contention. This is often caused by other disk intensive processes running in the same computer (including other KeyDB instances).\n"); } if (advise_no_appendfsync) { @@ -452,7 +452,7 @@ sds createLatencyReport(void) { } if (advise_hz && g_pserver->hz < 100) { - report = sdscat(report,"- In order to make the Redis keys expiring process more incremental, try to set the 'hz' configuration parameter to 100 using 'CONFIG SET hz 100'.\n"); + report = sdscat(report,"- In order to make the KeyDB keys expiring process more incremental, try to set the 'hz' configuration parameter to 100 using 'CONFIG SET hz 100'.\n"); } if (advise_large_objects) { @@ -460,11 +460,11 @@ sds createLatencyReport(void) { } if (advise_mass_eviction) { - report = sdscat(report,"- Sudden changes to the 'maxmemory' setting via 'CONFIG SET', or allocation of large objects via sets or sorted sets intersections, STORE option of SORT, Redis Cluster large keys migrations (RESTORE command), may create sudden memory pressure forcing the server to block trying to evict keys. \n"); + report = sdscat(report,"- Sudden changes to the 'maxmemory' setting via 'CONFIG SET', or allocation of large objects via sets or sorted sets intersections, STORE option of SORT, KeyDB Cluster large keys migrations (RESTORE command), may create sudden memory pressure forcing the server to block trying to evict keys. \n"); } if (advise_disable_thp) { - report = sdscat(report,"- I detected a non zero amount of anonymous huge pages used by your process. This creates very serious latency events in different conditions, especially when Redis is persisting on disk. To disable THP support use the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled', make sure to also add it into /etc/rc.local so that the command will be executed again after a reboot. Note that even if you have already disabled THP, you still need to restart the Redis process to get rid of the huge pages already created.\n"); + report = sdscat(report,"- I detected a non zero amount of anonymous huge pages used by your process. This creates very serious latency events in different conditions, especially when KeyDB is persisting on disk. To disable THP support use the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled', make sure to also add it into /etc/rc.local so that the command will be executed again after a reboot. Note that even if you have already disabled THP, you still need to restart the KeyDB process to get rid of the huge pages already created.\n"); } }