why redis aof rewrite 0M to disk? -
i using redis 2.6.14 aof on. size of aof file becomes 0m after rewriting, cant understand this. give me help,plz. below log:
# server started, redis version 2.6.14 * server ready accept connections on port 7379 * starting automatic rewriting of aof on 2098226700% growth * background append file rewriting started pid 7961 * sync append file rewrite performed * aof rewrite: 0 mb of memory used copy-on-write * background aof rewrite terminated success * parent diff flushed rewritten aof (94778 bytes) * background aof rewrite finished i think "aof rewrite: 0 mb of memory used copy-on-write" key, explain it?
i got answer in way:
1.edit redis.conf, set loglevel debug. 2.i found keys 32, problem of test program. 3.i modified test program, make keys unique. when program runs again, keys in reids increase rapidly, , aof file increase too. 4.when rewrite triggered, write 2m bytes aof file instead of 0m. the conclusion : size of bytes rewritten aof not 0, small. reason mistake in test program.
i think "aof rewrite: 0 mb of memory used copy-on-write" key, explain it?
it totally unrelated resulting size of aof.
redis single-threaded event loop. when has process long running job, such rdb dump or aof rewrite, forks second process it. job run in parallel redis event loop, not blocked. mechanism leverages copy-on-write facility provided virtual memory subsystem of os.
when redis forks, memory pages shared 2 processes. while job running, redis can still modify these memory pages (insert, update, delete operations). these operations caught os, , pages duplicated in lazy mode, when modified.
the consequence redis can consume more or less memory when running background job. if lot of write operations occur, more memory consumed copy-on-write mechanism.
the "aof rewrite: xxx mb of memory used copy-on-write" line provides evaluation of copy-on-write memory overhead. ideally, should 0 (meaning no page duplicated). if start writing lot during background operation, increase. in worst case (unlikely), can close total memory used redis.
Comments
Post a Comment