[tarantool-patches] Re: [PATCH 7/9] vinyl: randomize range compaction to avoid IO load spikes

Vladimir Davydov vdavydov.dev at gmail.com
Wed Feb 6 11:53:02 MSK 2019

On Tue, Feb 05, 2019 at 08:39:58PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev at gmail.com> [19/01/22 15:56]:
> > I ran some tests and, surprisingly, it turned out that randomization
> > didn't help at all: the compaction queue size jumped up to 30% and even
> > 40% from time to time although there was plenty of compaction power -
> > compaction threads were busy only half of the time. When I looked
> > closer, I saw that the queue size behavior looked weird - it jumped
> > after a dump for a very short period of time, until the next dump, which
> > pushed it back to 10%. This made me wonder how it could happen at all -
> > normally, compaction queue should only grow after a dump, not diminish.
> > I think I've finally found the root cause of the problem. The code
> > computing compaction priority (see vy_range_update_compaction_priority)
> > is unstable meaning the size of the first level equals the size of the
> > smallest run so if memory dumps produce runs of varying sizes, which is
> > what happens in practice in contrast to simulation, the shape of the
> > tree will vary as well, resulting in different compaction priority and
> > unstable queue behavior.
> > 
> > We must fix this somehow. One way to do it is compute the first level
> > size basing on the size of the last level run, which is constant most of
> > the time, and indeed, when I did it and reran the tests, I found that
> > the queue stayed below 10% all the time. Turning off randomization, made
> > the queue jump up to 30%, which was expected. The diff is below. I'll
> > spruce it up a little, wrap it nicely, and submit it separately later.
> Why not use a simple weighted average? 

Over how many dumps? What do we do after restart, when there's no
history and perhaps even no level 1?

More information about the Tarantool-patches mailing list