From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <vdavydov.dev@gmail.com> From: Vladimir Davydov <vdavydov.dev@gmail.com> Subject: [PATCH 13/18] vinyl: use lower bound percentile estimate for dump bandwidth Date: Thu, 16 Aug 2018 19:12:07 +0300 Message-Id: <4bbbdd705bb4a39bfbf81744e3d16e90ee1aaf02.1534432819.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1534432819.git.vdavydov.dev@gmail.com> References: <cover.1534432819.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1534432819.git.vdavydov.dev@gmail.com> References: <cover.1534432819.git.vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: <tarantool-patches.dev.tarantool.org> Use a lower bound estimate in order not to overestimate dump bandwidth. For example, if an observation of 12 MB/s falls in bucket 10 .. 15, we should use 10 MB/s to avoid stalls. --- src/box/vy_quota.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/box/vy_quota.c b/src/box/vy_quota.c index 64c2ca04..620155ab 100644 --- a/src/box/vy_quota.c +++ b/src/box/vy_quota.c @@ -196,8 +196,13 @@ vy_quota_dump(struct vy_quota *q, size_t size, double duration) /* Account dump bandwidth. */ if (duration > 0) { histogram_collect(q->dump_bw_hist, size / duration); - q->dump_bw = histogram_percentile(q->dump_bw_hist, - VY_DUMP_BANDWIDTH_PCT); + /* + * To avoid unpredictably long stalls, we need to + * know the worst (smallest) dump bandwidth so use + * a lower-bound percentile estimate. + */ + q->dump_bw = histogram_percentile_lower(q->dump_bw_hist, + VY_DUMP_BANDWIDTH_PCT); } } -- 2.11.0