On Tue, Dec 1, 2009 at 7:01 AM, Matt Todd <
mt...@highgroove.com> wrote:
> Hey, is it expected to see a BGSAVE taking 100% of the CPU to persist to
> disk?
Hello, this is the intended behavior actually, but 100% of a single process.
> I'm running on an EC2 instance and using the default persistence settings,
> and it usually happens every 5 minutes (since it's just under 10,000 changes
> per minute).
> Once it forks, the second redis-server shoots up to 100% CPU usage and the
> server load (on a medium CPU instance) starts at 0.3 and gets as high as
> 0.76 over the span it takes to write. Obviously, I want to keep this number
> down as low as possible, but I need the data persisted.
Because this happens on a single core, even if the load goes high, it
is actually not a big problem in practice. But for you this is not
desirable I think you should switch to Redis 1.1 append only file to
persist.
> The redis data is about 250mb to 300mb, and rotates completely every hour +1
> (as in, the data from hour 1 is completely gone by the end of the 2nd hour,
> due to expiration).
> Is there any way to control how much CPU is being taken by the Redis server?
Currently not with snapshotting, it will just try to serialized data
on disk ASAP, because the more time it takes, the more the two
processes will have differences in memory pages, the more physical
memory will be used.
I think you should try to check if apart from the load figure this is
having bad effects on the real-world system performance. I don't know
on EC2, but on a normal box with 2 or 4 cores this is usually not a
problem as reported by many users.
> Obviously, as scaling becomes a problem, we'll want to move the Redis server
> onto it's own dedicated machine (and slave), but for now we're having it
> share resources with some background jobs and a message queue broker and
> we'd like to prevent load from getting too high.
You'll find that Redis performances outside EC2 are impressive
compared to EC2 :) Even with a *very* entry level box.
Btw the load will get an increment by 1 as there is always a process
willing to run (the saving process), but it's not a concern especially
of this EC2 instance is running *only* redis. A much bigger problem I
guess is that there is not enough disk bandwidth if there are other
disk-intensive processes running on the system.
Btw at least in theory it's trivial to add some kind of config
parameter in order to make the saving child less aggressive CPU-wise,
but I think after all it's not a good idea most of the times.
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