Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH 6/9] vinyl: set range size automatically
Date: Wed, 6 Feb 2019 20:04:23 +0300	[thread overview]
Message-ID: <20190206170423.4dv7slwyecuubdqt@esperanza> (raw)
In-Reply-To: <20190206092331.tpqfx2odv45fqqlx@esperanza>

On Wed, Feb 06, 2019 at 12:23:31PM +0300, Vladimir Davydov wrote:
> On Tue, Feb 05, 2019 at 08:09:09PM +0300, Konstantin Osipov wrote:
> > * Vladimir Davydov <vdavydov.dev@gmail.com> [19/01/21 06:58]:
> > > +int64_t
> > > +vy_lsm_range_size(struct vy_lsm *lsm)
> > > +{
> > > +	/* Use the configured range size if available. */
> > > +	if (lsm->opts.range_size > 0)
> > > +		return lsm->opts.range_size;
> > > +	/*
> > > +	 * It doesn't make much sense to create too small ranges.
> > > +	 * Limit the max number of ranges per index to 1000 and
> > > +	 * never create ranges smaller than 16 MB.
> > > +	 */
> > > +	enum { MIN_RANGE_SIZE = 16 * 1024 * 1024 };
> > > +	enum { MAX_RANGE_COUNT = 1000 };
> > > +	/*
> > > +	 * Ideally, we want to compact roughly the same amount of
> > > +	 * data after each dump so as to avoid IO bursts caused by
> > > +	 * simultaneous major compaction of a bunch of ranges,
> > > +	 * because such IO bursts can lead to a deviation of the
> > > +	 * LSM tree from the configured shape and, as a result,
> > > +	 * increased read amplification.  To achieve that, we need
> > > +	 * to have at least as many ranges as the number of dumps
> > > +	 * it takes to trigger major compaction in a range.
> > > +	 */
> > > +	int range_count = vy_lsm_dumps_per_compaction(lsm);
> > > +	range_count = MIN(range_count, MAX_RANGE_COUNT);
> > > +	int64_t range_size = lsm->stat.disk.last_level_count.bytes /
> > > +						(range_count + 1);
> > > +	range_size = MAX(range_size, MIN_RANGE_SIZE);
> > > +	return range_size;
> > > +}
> > 
> > OK, you could say the value is rarely used, so can be calculated
> > each time it is used, but why instead not recalculate it on each
> > major compaction? This would spare us from technical debt and
> > having to think about potential performance bottleneck in the
> > future.
> 
> Well, okay, I think we can do that, too.

Come to think of it, I'd prefer not to, because this would one more
member to struct vy_lsm, which we would have to update on dump and
compaction - it's more error prone IMO. Since calculation of the target
range size is trivial and called rarely (on split/coalesce), I think we
should leave it as is.

  reply	other threads:[~2019-02-06 17:04 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-20 21:16 [PATCH 0/9] vinyl: compaction randomization and throttling Vladimir Davydov
2019-01-20 21:17 ` [PATCH 1/9] vinyl: update lsm->range_heap in one go on dump completion Vladimir Davydov
2019-01-24 16:55   ` Vladimir Davydov
2019-02-05 16:37   ` [tarantool-patches] " Konstantin Osipov
2019-01-20 21:17 ` [PATCH 2/9] vinyl: ignore unknown .run, .index and .vylog keys Vladimir Davydov
2019-01-24 16:56   ` Vladimir Davydov
2019-01-20 21:17 ` [PATCH 3/9] vinyl: use uncompressed run size for range split/coalesce/compaction Vladimir Davydov
2019-01-21  9:42   ` Vladimir Davydov
2019-02-05 16:49     ` [tarantool-patches] " Konstantin Osipov
2019-02-06  8:55       ` Vladimir Davydov
2019-02-06 10:46         ` Konstantin Osipov
2019-02-06 10:55           ` Vladimir Davydov
2019-02-05 16:43   ` Konstantin Osipov
2019-02-06 16:48     ` Vladimir Davydov
2019-01-20 21:17 ` [PATCH 4/9] vinyl: rename lsm->range_heap to max_compaction_priority Vladimir Davydov
2019-01-20 21:17 ` [PATCH 5/9] vinyl: keep track of dumps per compaction for each LSM tree Vladimir Davydov
2019-02-05 16:58   ` [tarantool-patches] " Konstantin Osipov
2019-02-06  9:20     ` Vladimir Davydov
2019-02-06 16:54       ` Vladimir Davydov
2019-01-20 21:17 ` [PATCH 6/9] vinyl: set range size automatically Vladimir Davydov
2019-01-22  9:17   ` Vladimir Davydov
2019-02-05 17:09   ` [tarantool-patches] " Konstantin Osipov
2019-02-06  9:23     ` Vladimir Davydov
2019-02-06 17:04       ` Vladimir Davydov [this message]
2019-01-20 21:17 ` [PATCH 7/9] vinyl: randomize range compaction to avoid IO load spikes Vladimir Davydov
2019-01-22 12:54   ` Vladimir Davydov
2019-02-05 17:39     ` [tarantool-patches] " Konstantin Osipov
2019-02-06  8:53       ` Vladimir Davydov
2019-02-06 10:44         ` Konstantin Osipov
2019-02-06 10:52           ` Vladimir Davydov
2019-02-06 11:06             ` Konstantin Osipov
2019-02-06 11:49               ` Vladimir Davydov
2019-02-06 13:43                 ` Konstantin Osipov
2019-02-06 14:00                   ` Vladimir Davydov
2019-02-05 17:14   ` Konstantin Osipov
2019-01-20 21:17 ` [PATCH 8/9] vinyl: introduce quota consumer types Vladimir Davydov
2019-01-20 21:17 ` [PATCH 9/9] vinyl: throttle tx to ensure compaction keeps up with dumps Vladimir Davydov
2019-01-21 14:14   ` Vladimir Davydov
2019-01-22  9:09   ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190206170423.4dv7slwyecuubdqt@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] Re: [PATCH 6/9] vinyl: set range size automatically' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox