Open GoogleCodeExporter opened 9 years ago
Hello, thanks for this interesting and detailed bug report.
Here I think that the easy fix is to avoid the fsync() while there is a rewrite
ongoing,
but the *right* fix is probably a thread. There is no asynchronous version of
fsync()
so what I could like to do to fix this issue is the following:
create a thread at startup dealing with this stuff. Every second:
open(file)
fsync(it)
close(file)
So that we don't have to coordinate with the main thread. Our common knowledge
is
just the file name.
I'll fix it ASAP in Redis master but it's unlikely this will enter 1.2.x soon,
so for 1.2.x
the fix could be to avoid fsync()ing if bgrewriteaof is in progress.
Cheers,
Salvatore
Original comment by anti...@gmail.com
on 27 Feb 2010 at 11:35
updates about this:
1) With the current Linux kernel it is not possible to flush on a different
thread, as write(2) will block anyway in the main thread. This sucks but I
don't think this is going to get fixed in little time.
2) We have now in Redis master an option so that fsync(2) is not called when
there is a background saving/log-rewrite operation in progress. It's a trick...
but works.
3) All this is highly dependent on the file system used and the mount options.
4) "fsync none" is a trivial way to completely fix this problem but the
drawback is that up to 30 seconds of logs can be lost.
5) fsync always is now optimized, it is still very very slow but much faster
than before.
I'm leaving this open as it's an open problem but I don't think there are very
good way to fix this at the moment, still with the latest changes we mitigated
the problem enough. Currently when very low latency is required a two box setup
with a saving slave may be the best option.
Original comment by anti...@gmail.com
on 24 Aug 2010 at 2:16
Original issue reported on code.google.com by
henkp...@gmail.com
on 26 Feb 2010 at 4:44