From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 07/11] vinyl: do not account zero dump bandwidth Date: Thu, 20 Sep 2018 12:34:12 +0300 Message-Id: <0f5578b940031e14c8e08234648c84103e0d78b2.1537435404.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: Since we free memory in 16 MB blocks (see SLAB_SIZE), it may occur that we dump almost all data stored in a block but still have to leave it be, because it contains data of a newer generation. If the memory limit is small (as it is typically in tests), this may result in dumping 0 bytes. In order not to disrupt statistics and throttling transactions in vain, let's simply ignore such results. Normally, the memory limit should be large enough for such granularity not to affect the measurements (hundreds of megabytes) so this problem isn't worth putting more efforts into. --- src/box/vy_quota.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/box/vy_quota.c b/src/box/vy_quota.c index 7cd64474..5f8c0618 100644 --- a/src/box/vy_quota.c +++ b/src/box/vy_quota.c @@ -205,8 +205,20 @@ vy_quota_dump(struct vy_quota *q, size_t size, double duration) q->used -= size; fiber_cond_signal(&q->cond); - /* Update dump bandwidth. */ - if (duration > 0) { + /* + * Update dump bandwidth. + * + * Note, since we free memory in 16 MB blocks (see SLAB_SIZE), + * it may occur that we dump almost all data stored in a block + * but still have to leave it be, because it contains data of + * a newer generation. If the memory limit is small, this may + * result in dumping 0 bytes. In order not to disrupt statistics + * let's simply ignore such results. Normally, the memory limit + * should be large enough for such granularity not to affect the + * measurements (hundreds of megabytes) so this problem isn't + * worth putting more efforts into. + */ + if (size > 0 && duration > 0) { histogram_collect(q->dump_bw_hist, size / duration); /* * To avoid unpredictably long stalls, we need to -- 2.11.0