summaryrefslogtreecommitdiff
path: root/src/latency.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-11-12 11:17:12 +0100
committerantirez <antirez@gmail.com>2014-11-12 11:17:12 +0100
commit7ea331d60162d5469ccc2f3682f07738a480538f (patch)
tree5b42cc294e8b26ce93e343660d973bb7c71ad5c2 /src/latency.c
parent110f0464e09ef3ff2d4f3a3a319377c77ed70d93 (diff)
downloadredis-7ea331d60162d5469ccc2f3682f07738a480538f.tar.gz
THP detection for LATENCY DOCTOR.
Diffstat (limited to 'src/latency.c')
-rw-r--r--src/latency.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/latency.c b/src/latency.c
index 2e239571a..67eb593f7 100644
--- a/src/latency.c
+++ b/src/latency.c
@@ -229,6 +229,7 @@ sds createLatencyReport(void) {
int advise_hz = 0; /* Use higher HZ. */
int advise_large_objects = 0; /* Deletion of large objects. */
int advise_relax_fsync_policy = 0; /* appendfsync always is slow. */
+ int advise_disable_thp = 0; /* AnonHugePages detected. */
int advices = 0;
/* Return ASAP if the latency engine is disabled and it looks like it
@@ -372,9 +373,15 @@ sds createLatencyReport(void) {
}
dictReleaseIterator(di);
- if (eventnum == 0) {
+ /* Add non event based advices. */
+ if (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");
- } else if (advices == 0) {
+ } 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");
} else {
/* Add all the suggestions accumulated so far. */
@@ -444,6 +451,10 @@ sds createLatencyReport(void) {
if (advise_large_objects) {
report = sdscat(report,"- Deleting, expiring or evicting (because of maxmemory policy) large objects is a blocking operation. If you have very large objects that are often deleted, expired, or evicted, try to fragment those objects into multiple smaller objects.\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");
+ }
}
return report;