From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 10/18] vinyl: do not add initial guess to dump bandwidth histogram Date: Thu, 16 Aug 2018 19:12:04 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: Do not add the initial guess to the histogram, because otherwise it takes more than 10 dumps to get the real dump bandwidth in case the initial value is less (we use 10th percentile). --- src/box/vy_quota.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/box/vy_quota.c b/src/box/vy_quota.c index dfe336c6..96f111f0 100644 --- a/src/box/vy_quota.c +++ b/src/box/vy_quota.c @@ -56,6 +56,12 @@ enum { VY_QUOTA_RATE_AVG_PERIOD = 5, }; +/* + * Until we dump anything, assume bandwidth to be 10 MB/s, + * which should be fine for initial guess. + */ +static const size_t VY_DEFAULT_DUMP_BANDWIDTH = 10 * 1024 * 1024; + /** * Histogram percentile used for estimating dump bandwidth. * For details see the comment to vy_quota::dump_bw_hist. @@ -129,12 +135,6 @@ vy_quota_create(struct vy_quota *q, vy_quota_exceeded_f quota_exceeded_cb) "dump bandwidth histogram"); return -1; } - /* - * Until we dump anything, assume bandwidth to be 10 MB/s, - * which should be fine for initial guess. - */ - q->dump_bw = 10 * MB; - histogram_collect(q->dump_bw_hist, q->dump_bw); q->limit = SIZE_MAX; q->watermark = SIZE_MAX; @@ -142,6 +142,7 @@ vy_quota_create(struct vy_quota *q, vy_quota_exceeded_f quota_exceeded_cb) q->use_curr = 0; q->use_rate = 0; q->too_long_threshold = TIMEOUT_INFINITY; + q->dump_bw = VY_DEFAULT_DUMP_BANDWIDTH; q->quota_exceeded_cb = quota_exceeded_cb; fiber_cond_create(&q->cond); ev_timer_init(&q->timer, vy_quota_timer_cb, 0, -- 2.11.0