summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-03-25 11:27:35 +0200
committerantirez <antirez@gmail.com>2012-03-25 11:27:35 +0200
commitc1d01b3c5796ee7e3f466e0db9f55d37e843cbb9 (patch)
tree1bbdbb588580a46e8f74a04c2f2e055b479bae65
parent512f682340eb74aaedc525e834a943427999508c (diff)
downloadredis-c1d01b3c5796ee7e3f466e0db9f55d37e843cbb9.tar.gz
New INFO field aof_delayed_fsync introduced.
This new field counts all the times Redis is configured with AOF enabled and fsync policy 'everysec', but the previous fsync performed by the background thread was not able to complete within two seconds, forcing Redis to perform a write against the AOF file while the fsync is still in progress (likely a blocking operation).
-rw-r--r--src/aof.c1
-rw-r--r--src/config.c1
-rw-r--r--src/redis.c7
-rw-r--r--src/redis.h1
4 files changed, 8 insertions, 2 deletions
diff --git a/src/aof.c b/src/aof.c
index 83633217f..4d3ce096a 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -108,6 +108,7 @@ void flushAppendOnlyFile(int force) {
}
/* Otherwise fall trough, and go write since we can't wait
* over two seconds. */
+ server.aof_delayed_fsync++;
redisLog(REDIS_NOTICE,"Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.");
}
}
diff --git a/src/config.c b/src/config.c
index 316f0a284..2be92426f 100644
--- a/src/config.c
+++ b/src/config.c
@@ -859,6 +859,7 @@ void configCommand(redisClient *c) {
server.stat_numcommands = 0;
server.stat_numconnections = 0;
server.stat_expiredkeys = 0;
+ server.aof_delayed_fsync = 0;
resetCommandTableStats();
addReply(c,shared.ok);
} else {
diff --git a/src/redis.c b/src/redis.c
index 2f27b4ddb..e926fd9b6 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -1007,6 +1007,7 @@ void initServerConfig() {
server.aof_rewrite_base_size = 0;
server.aof_rewrite_scheduled = 0;
server.aof_last_fsync = time(NULL);
+ server.aof_delayed_fsync = 0;
server.aof_fd = -1;
server.aof_selected_db = -1; /* Make sure the first time will not match */
server.aof_flush_postponed_start = 0;
@@ -1802,12 +1803,14 @@ sds genRedisInfoString(char *section) {
"aof_base_size:%lld\r\n"
"aof_pending_rewrite:%d\r\n"
"aof_buffer_length:%zu\r\n"
- "aof_pending_bio_fsync:%llu\r\n",
+ "aof_pending_bio_fsync:%llu\r\n"
+ "aof_delayed_fsync:%lu\r\n",
(long long) server.aof_current_size,
(long long) server.aof_rewrite_base_size,
server.aof_rewrite_scheduled,
sdslen(server.aof_buf),
- bioPendingJobsOfType(REDIS_BIO_AOF_FSYNC));
+ bioPendingJobsOfType(REDIS_BIO_AOF_FSYNC),
+ server.aof_delayed_fsync);
}
if (server.loading) {
diff --git a/src/redis.h b/src/redis.h
index 1fc2ae393..e4fd47d3f 100644
--- a/src/redis.h
+++ b/src/redis.h
@@ -638,6 +638,7 @@ struct redisServer {
int aof_selected_db; /* Currently selected DB in AOF */
time_t aof_flush_postponed_start; /* UNIX time of postponed AOF flush */
time_t aof_last_fsync; /* UNIX time of last fsync() */
+ unsigned long aof_delayed_fsync; /* delayed AOF fsync() counter */
/* RDB persistence */
long long dirty; /* Changes to DB from the last save */
long long dirty_before_bgsave; /* Used to restore dirty on failed BGSAVE */