Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: tarantool-patches@freelists.org
Subject: [PATCH 08/12] vinyl: add dump count to global scheduler statistics
Date: Tue, 15 Jan 2019 17:17:17 +0300	[thread overview]
Message-ID: <3c608d953539141eb2d2aeb3fb5b23369151b639.1547558871.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1547558871.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1547558871.git.vdavydov.dev@gmail.com>

This patch adds scheduler.dump_count to box.stat.vinyl(), which shows
the number of memory level dumps that have happened since the instance
startup or box.stat.reset(). It's useful for estimating an average size
of a single memory dump, which in turn can be used for calculating LSM
tree fanout.
---
 src/box/vinyl.c          |  1 +
 src/box/vy_scheduler.c   |  2 ++
 src/box/vy_stat.h        |  2 ++
 test/vinyl/stat.result   | 79 ++++++++++++++++++++++++++++++++++++++++++++++--
 test/vinyl/stat.test.lua | 27 +++++++++++++++++
 5 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index b30e69a1..e3478679 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -250,6 +250,7 @@ vy_info_append_scheduler(struct vy_env *env, struct info_handler *h)
 	struct vy_scheduler_stat *stat = &env->scheduler.stat;
 
 	info_table_begin(h, "scheduler");
+	info_append_int(h, "dump_count", stat->dump_count);
 	info_append_int(h, "dump_input", stat->dump_input);
 	info_append_int(h, "dump_output", stat->dump_output);
 	info_append_int(h, "compaction_input", stat->compaction_input);
diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c
index 2d4f6bed..d06da484 100644
--- a/src/box/vy_scheduler.c
+++ b/src/box/vy_scheduler.c
@@ -504,6 +504,7 @@ void
 vy_scheduler_reset_stat(struct vy_scheduler *scheduler)
 {
 	struct vy_scheduler_stat *stat = &scheduler->stat;
+	stat->dump_count = 0;
 	stat->dump_input = 0;
 	stat->dump_output = 0;
 	stat->compaction_input = 0;
@@ -696,6 +697,7 @@ vy_scheduler_complete_dump(struct vy_scheduler *scheduler)
 	double dump_duration = now - scheduler->dump_start;
 	scheduler->dump_start = now;
 	scheduler->dump_generation = min_generation;
+	scheduler->stat.dump_count++;
 	scheduler->dump_complete_cb(scheduler,
 			min_generation - 1, dump_duration);
 	fiber_cond_signal(&scheduler->dump_cond);
diff --git a/src/box/vy_stat.h b/src/box/vy_stat.h
index 195b09a4..b976db47 100644
--- a/src/box/vy_stat.h
+++ b/src/box/vy_stat.h
@@ -212,6 +212,8 @@ struct vy_tx_stat {
  * disk compression.
  */
 struct vy_scheduler_stat {
+	/** Number of completed memory dumps. */
+	int32_t dump_count;
 	/** Number of bytes read by dump tasks. */
 	int64_t dump_input;
 	/** Number of bytes written by dump tasks. */
diff --git a/test/vinyl/stat.result b/test/vinyl/stat.result
index 16f01945..e8780e5b 100644
--- a/test/vinyl/stat.result
+++ b/test/vinyl/stat.result
@@ -242,8 +242,9 @@ gstat()
     data: 0
     index: 0
   scheduler:
-    compaction_output: 0
     compaction_queue: 0
+    dump_count: 0
+    compaction_output: 0
     dump_output: 0
     dump_input: 0
     compaction_input: 0
@@ -1091,8 +1092,9 @@ gstat()
     data: 104300
     index: 1190
   scheduler:
-    compaction_output: 0
     compaction_queue: 0
+    dump_count: 0
+    compaction_output: 0
     dump_output: 0
     dump_input: 0
     compaction_input: 0
@@ -1100,6 +1102,79 @@ gstat()
 s:drop()
 ---
 ...
+-- sched stats
+s = box.schema.space.create('test', {engine = 'vinyl'})
+---
+...
+i1 = s:create_index('i1', {parts = {1, 'unsigned'}})
+---
+...
+i2 = s:create_index('i2', {parts = {2, 'unsigned'}})
+---
+...
+for i = 1, 100 do s:replace{i, i, string.rep('x', 1000)} end
+---
+...
+st = gstat()
+---
+...
+box.snapshot()
+---
+- ok
+...
+stat_diff(gstat(), st, 'scheduler')
+---
+- dump_count: 1
+  dump_input: 208400
+  dump_output: 103592
+...
+for i = 1, 100, 10 do s:replace{i, i, string.rep('y', 1000)} end
+---
+...
+st = gstat()
+---
+...
+box.snapshot()
+---
+- ok
+...
+stat_diff(gstat(), st, 'scheduler')
+---
+- dump_count: 1
+  dump_input: 21230
+  dump_output: 10371
+...
+st = gstat()
+---
+...
+i1:compact()
+---
+...
+while i1:stat().disk.compaction.count == 0 do fiber.sleep(0.01) end
+---
+...
+stat_diff(gstat(), st, 'scheduler')
+---
+- compaction_input: 112188
+  compaction_output: 101984
+...
+st = gstat()
+---
+...
+i2:compact()
+---
+...
+while i2:stat().disk.compaction.count == 0 do fiber.sleep(0.01) end
+---
+...
+stat_diff(gstat(), st, 'scheduler')
+---
+- compaction_input: 1775
+  compaction_output: 1608
+...
+s:drop()
+---
+...
 --
 -- space.bsize, index.len, index.bsize
 --
diff --git a/test/vinyl/stat.test.lua b/test/vinyl/stat.test.lua
index 6708fcb9..f2acf3e8 100644
--- a/test/vinyl/stat.test.lua
+++ b/test/vinyl/stat.test.lua
@@ -320,6 +320,33 @@ gstat()
 
 s:drop()
 
+-- sched stats
+s = box.schema.space.create('test', {engine = 'vinyl'})
+i1 = s:create_index('i1', {parts = {1, 'unsigned'}})
+i2 = s:create_index('i2', {parts = {2, 'unsigned'}})
+
+for i = 1, 100 do s:replace{i, i, string.rep('x', 1000)} end
+st = gstat()
+box.snapshot()
+stat_diff(gstat(), st, 'scheduler')
+
+for i = 1, 100, 10 do s:replace{i, i, string.rep('y', 1000)} end
+st = gstat()
+box.snapshot()
+stat_diff(gstat(), st, 'scheduler')
+
+st = gstat()
+i1:compact()
+while i1:stat().disk.compaction.count == 0 do fiber.sleep(0.01) end
+stat_diff(gstat(), st, 'scheduler')
+
+st = gstat()
+i2:compact()
+while i2:stat().disk.compaction.count == 0 do fiber.sleep(0.01) end
+stat_diff(gstat(), st, 'scheduler')
+
+s:drop()
+
 --
 -- space.bsize, index.len, index.bsize
 --
-- 
2.11.0

  parent reply	other threads:[~2019-01-15 14:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 14:17 [PATCH 00/12] vinyl: statistics improvements Vladimir Davydov
2019-01-15 14:17 ` [PATCH 01/12] test: rename vinyl/info to vinyl/stat Vladimir Davydov
2019-01-17 11:32   ` [tarantool-patches] " Konstantin Osipov
2019-01-15 14:17 ` [PATCH 02/12] test: split vinyl/errinj Vladimir Davydov
2019-01-17 11:33   ` [tarantool-patches] " Konstantin Osipov
2019-01-15 14:17 ` [PATCH 03/12] vinyl: rename dump/compact in/out to input/output Vladimir Davydov
2019-01-17 11:33   ` [tarantool-patches] " Konstantin Osipov
2019-01-15 14:17 ` [PATCH 04/12] vinyl: rename compact to compaction Vladimir Davydov
2019-01-17 11:34   ` [tarantool-patches] " Konstantin Osipov
2019-01-17 12:08     ` Vladimir Davydov
2019-01-17 13:51       ` Konstantin Osipov
2019-01-15 14:17 ` [PATCH 05/12] vinyl: bump range version in vy_range.c Vladimir Davydov
2019-01-15 14:17 ` [PATCH 06/12] vinyl: don't add dropped LSM trees to the scheduler during recovery Vladimir Davydov
2019-01-15 14:17 ` [PATCH 07/12] vinyl: move global dump/compaction statistics to scheduler Vladimir Davydov
2019-01-16 16:36   ` Vladimir Davydov
2019-01-15 14:17 ` Vladimir Davydov [this message]
2019-01-15 14:17 ` [PATCH 09/12] vinyl: don't account secondary indexes to scheduler.dump_input Vladimir Davydov
2019-01-15 14:17 ` [PATCH 10/12] vinyl: add task accounting to global scheduler statistics Vladimir Davydov
2019-01-15 14:17 ` [PATCH 11/12] vinyl: add dump/compaction time to statistics Vladimir Davydov
2019-01-15 14:17 ` [PATCH 12/12] vinyl: add last level size " Vladimir Davydov
2019-01-17 11:35   ` [tarantool-patches] " Konstantin Osipov
2019-01-17 11:32 ` [tarantool-patches] Re: [PATCH 00/12] vinyl: statistics improvements Konstantin Osipov
2019-01-17 12:06   ` Vladimir Davydov
2019-01-20 21:16 ` 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=3c608d953539141eb2d2aeb3fb5b23369151b639.1547558871.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 08/12] vinyl: add dump count to global scheduler statistics' \
    /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