Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] vinyl: don't throttle DDL
@ 2019-05-31 10:00 Vladimir Davydov
  2019-05-31 10:11 ` [tarantool-patches] " Konstantin Osipov
  2019-05-31 10:35 ` Vladimir Davydov
  0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Davydov @ 2019-05-31 10:00 UTC (permalink / raw)
  To: tarantool-patches

Since DDL is triggered by the admin, it can be deliberately initiated
when the workload is known to be low. Throttling it along with DML
requests would only cause exasperation in this case. So we don't apply
disk-based rate limit to DDL. This should be fine, because the
disk-based limit is set rather strictly to let the workload some space
to grow, see vy_regulator_update_rate_limit(), and in contrast to the
memory-based limit, exceeding the disk-based limit doesn't result in
abrupt stalls - it may only lead to a gradual accumulation of disk space
usage and read latency.

Closes #4238
---
https://github.com/tarantool/tarantool/issues/4238
https://github.com/tarantool/tarantool/commits/dv/gh-4238-vy-dont-throttle-ddl

 src/box/vinyl.c    |  6 +++---
 src/box/vy_quota.c | 13 +++++++++++++
 src/box/vy_quota.h |  2 ++
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index 8286fed7..9b4bc53b 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -4191,10 +4191,10 @@ vy_build_insert_tuple(struct vy_env *env, struct vy_lsm *lsm,
 	/* Consume memory quota. Throttle if it is exceeded. */
 	size_t mem_used_after = lsregion_used(&env->mem_env.allocator);
 	assert(mem_used_after >= mem_used_before);
-	vy_quota_force_use(&env->quota, VY_QUOTA_CONSUMER_TX,
+	vy_quota_force_use(&env->quota, VY_QUOTA_CONSUMER_DDL,
 			   mem_used_after - mem_used_before);
 	vy_regulator_check_dump_watermark(&env->regulator);
-	vy_quota_wait(&env->quota, VY_QUOTA_CONSUMER_TX);
+	vy_quota_wait(&env->quota, VY_QUOTA_CONSUMER_DDL);
 	return rc;
 }
 
@@ -4321,7 +4321,7 @@ vy_build_recover(struct vy_env *env, struct vy_lsm *lsm, struct vy_lsm *pk)
 
 	mem_used_after = lsregion_used(&env->mem_env.allocator);
 	assert(mem_used_after >= mem_used_before);
-	vy_quota_force_use(&env->quota, VY_QUOTA_CONSUMER_TX,
+	vy_quota_force_use(&env->quota, VY_QUOTA_CONSUMER_DDL,
 			   mem_used_after - mem_used_before);
 	return rc;
 }
diff --git a/src/box/vy_quota.c b/src/box/vy_quota.c
index 035040a3..f1ac8dd9 100644
--- a/src/box/vy_quota.c
+++ b/src/box/vy_quota.c
@@ -76,6 +76,19 @@ vy_quota_consumer_resource_map[] = {
 	 * to avoid long stalls.
 	 */
 	[VY_QUOTA_CONSUMER_COMPACTION] = (1 << VY_QUOTA_RESOURCE_MEMORY),
+	/**
+	 * Since DDL is triggered by the admin, it can be deliberately
+	 * initiated when the workload is known to be low. Throttling
+	 * it along with DML requests would only cause exasperation in
+	 * this case. So we don't apply disk-based rate limit to DDL.
+	 * This should be fine, because the disk-based limit is set
+	 * rather strictly to let the workload some space to grow, see
+	 * vy_regulator_update_rate_limit(), and in contrast to the
+	 * memory-based limit, exceeding the disk-based limit doesn't
+	 * result in abrupt stalls - it may only lead to a gradual
+	 * accumulation of disk space usage and read latency.
+	 */
+	[VY_QUOTA_CONSUMER_DDL] = (1 << VY_QUOTA_RESOURCE_MEMORY),
 };
 
 /**
diff --git a/src/box/vy_quota.h b/src/box/vy_quota.h
index 7ff98cc1..63d4f6a8 100644
--- a/src/box/vy_quota.h
+++ b/src/box/vy_quota.h
@@ -150,6 +150,8 @@ enum vy_quota_consumer_type {
 	VY_QUOTA_CONSUMER_TX = 0,
 	/** Compaction job. */
 	VY_QUOTA_CONSUMER_COMPACTION = 1,
+	/** Request to build a new index. */
+	VY_QUOTA_CONSUMER_DDL = 2,
 
 	vy_quota_consumer_type_MAX,
 };
-- 
2.11.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tarantool-patches] Re: [PATCH] vinyl: don't throttle DDL
  2019-05-31 10:00 [PATCH] vinyl: don't throttle DDL Vladimir Davydov
@ 2019-05-31 10:11 ` Konstantin Osipov
  2019-05-31 10:35 ` Vladimir Davydov
  1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Osipov @ 2019-05-31 10:11 UTC (permalink / raw)
  To: tarantool-patches

* Vladimir Davydov <vdavydov.dev@gmail.com> [19/05/31 13:01]:
> Since DDL is triggered by the admin, it can be deliberately initiated
> when the workload is known to be low. Throttling it along with DML
> requests would only cause exasperation in this case. So we don't apply
> disk-based rate limit to DDL. This should be fine, because the
> disk-based limit is set rather strictly to let the workload some space
> to grow, see vy_regulator_update_rate_limit(), and in contrast to the
> memory-based limit, exceeding the disk-based limit doesn't result in
> abrupt stalls - it may only lead to a gradual accumulation of disk space
> usage and read latency.
> 
> Closes #4238

Nice that you provisioned for this in advance. LGTM.


-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vinyl: don't throttle DDL
  2019-05-31 10:00 [PATCH] vinyl: don't throttle DDL Vladimir Davydov
  2019-05-31 10:11 ` [tarantool-patches] " Konstantin Osipov
@ 2019-05-31 10:35 ` Vladimir Davydov
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Davydov @ 2019-05-31 10:35 UTC (permalink / raw)
  To: tarantool-patches

Pushed to master, 2.1, 1.10.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-31 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 10:00 [PATCH] vinyl: don't throttle DDL Vladimir Davydov
2019-05-31 10:11 ` [tarantool-patches] " Konstantin Osipov
2019-05-31 10:35 ` Vladimir Davydov

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