Hello Tim, first: thanks for the report.
Let's try to understand what's happening here...
> I've just upgraded to Redis 2.0.0 RC2. I have it configured with saves
> turned off, and AOF updates set to everysec.
> While monitoring with: redis-stat latency delay 100
> I ran: redis-cli bgrewriteaof
> And my jaw dropped:
> 233: 0.05 ms
> 234: 0.07 ms
> 235: 0.07 ms
> 236: 9204.92 ms
> 237: 37925.19 ms
My first guess is that this is related to the fsync() call.
Please can you relax the fsync policy and retry? Good news, you can
now do this in a pretty simple way:
% redis-cli config get appendfsync
1. appendfsync
2. everysec
% redis-cli config set appendfsync no
OK
% redis-cli config get appendfsync
1. appendfsync
2. no
Fsync sucks on Linux in general, but when there is tons of I/O at
least it has a reason to be slow ;)
> some dedicate drives on the same machine help?
I think so but before we need to make sure the problem is fsync() or
whatever it is...
I think that in a few emails and retries we can trap this, hopefully.
Thanks for the INFO output, also please if you can provide the output of:
redis-cli config get '*'
Cheers,
Salvatore
--
Salvatore 'antirez' Sanfilippo
http://invece.org
"Once you have something that grows faster than education grows,
you’re always going to get a pop culture.", Alan Kay
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
> So, I did as you suggested, and switched appendfsync to no. When I
> ran bgrewriteaof there was a blip of about 20ms, normal operation for a few
> seconds, then a couple of blips of around 700ms, then normal operation. No
> blocks larger than 1s. I repeated this a couple of times. I also switched
Cool! So we know what happens:
While Redis is rewriting the log, the child performs a lot of disk
I/O, so fsync() starts to be super slow.
Now there are two options:
1) If you don't have problems to loose up to 30 seconds of data on
crash, you can leave the fsync policy to "no".
2) If you want to be both safer and still don't have this problem with
the I/O is caused by Redis itself it's possible to do this:
redis-cli config no-appendfsync_on_rewrite yes
This will disable fsync *only* when there is a bgsave or bgrewriteaof
in progress. The problem is, this is 2.2 only, but there is no reason
why this is not backported to Redis 2.0, so expect an RC3 soon
(probably the start of the next week) where this feature is
backported.
3) ... if you know some tweak to make fsync() on Linux faster this can
help as well ;)
Thank you for your help. There is no better thing about this we can
actually do for now. The only other strategy is writing the buffer and
then flushing it via an additional thread, but since you saw that the
latency is so high when there is I/O contention, what meaning will
have "everysec" in this context? It will not be honored anyway, so why
don't just use "no" that will flush at max every 30 seconds anyway?
Note that fsync()ing in another thread will block write(2) as well.
Also any "in other thread" strategy is not applicable with "fsync
always" policy that is guaranteed to return OK to the caller only
*after* the data is written in the AOF.
The new 2.2 option saves a lot of problems, unless the everysec
requirements can't be relaxed for a few seconds while rewriting the
log, or when the heavy I/O is performed by a non-redis process running
in the same box.
The new option you have in 2.2 sounds like an improvement. I expect
I'll still have heavy io occasionally due to mysql persisting to the
same drive, so I should expect to continue to see long multi-second
blocks in this scenario? Would using a dedicated drive resolve the
issue, or is the bottleneck likely to be some place before the drive?
Cheers,
Tim.