Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH v2 4/8] vinyl: report pages and bytes_compressed in dump/compact in/out stats
Date: Sun, 16 Sep 2018 20:06:47 +0300	[thread overview]
Message-ID: <89b4528c5e34733ef1162cd443905743a6522104.1537115208.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1537115208.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1537115208.git.vdavydov.dev@gmail.com>

There's no reason not to report pages and bytes_compressed under
disk.stat.dump.out and disk.stat.compact.{in,out} apart from using
the same struct for dump and compaction statistics (vy_compact_stat).
The statistics are going to differ anyway once compaction queue size
is added to disk.stat.compact so let's zap struct vy_compact_stat
and report as much info as we can.
---
 src/box/vinyl.c        | 23 ++++++++++-------------
 src/box/vy_scheduler.c |  6 +++---
 src/box/vy_stat.h      | 27 ++++++++++++++++-----------
 test/vinyl/info.result | 28 ++++++++++++++++++++++++----
 4 files changed, 53 insertions(+), 31 deletions(-)

diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index ce58247a..197f16d6 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -337,17 +337,6 @@ vy_info_append_disk_stmt_counter(struct info_handler *h, const char *name,
 }
 
 static void
-vy_info_append_compact_stat(struct info_handler *h, const char *name,
-			    const struct vy_compact_stat *stat)
-{
-	info_table_begin(h, name);
-	info_append_int(h, "count", stat->count);
-	vy_info_append_stmt_counter(h, "in", &stat->in);
-	vy_info_append_stmt_counter(h, "out", &stat->out);
-	info_table_end(h);
-}
-
-static void
 vinyl_index_stat(struct index *index, struct info_handler *h)
 {
 	char buf[1024];
@@ -398,8 +387,16 @@ vinyl_index_stat(struct index *index, struct info_handler *h)
 	info_append_int(h, "miss", stat->disk.iterator.bloom_miss);
 	info_table_end(h); /* bloom */
 	info_table_end(h); /* iterator */
-	vy_info_append_compact_stat(h, "dump", &stat->disk.dump);
-	vy_info_append_compact_stat(h, "compact", &stat->disk.compact);
+	info_table_begin(h, "dump");
+	info_append_int(h, "count", stat->disk.dump.count);
+	vy_info_append_stmt_counter(h, "in", &stat->disk.dump.in);
+	vy_info_append_disk_stmt_counter(h, "out", &stat->disk.dump.out);
+	info_table_end(h); /* dump */
+	info_table_begin(h, "compact");
+	info_append_int(h, "count", stat->disk.compact.count);
+	vy_info_append_disk_stmt_counter(h, "in", &stat->disk.compact.in);
+	vy_info_append_disk_stmt_counter(h, "out", &stat->disk.compact.out);
+	info_table_end(h); /* compact */
 	info_append_int(h, "index_size", lsm->page_index_size);
 	info_append_int(h, "bloom_size", lsm->bloom_size);
 	info_table_end(h); /* disk */
diff --git a/src/box/vy_scheduler.c b/src/box/vy_scheduler.c
index 08de214a..dd1e88d2 100644
--- a/src/box/vy_scheduler.c
+++ b/src/box/vy_scheduler.c
@@ -1182,7 +1182,7 @@ vy_task_dump_complete(struct vy_task *task)
 	 * Account the new run.
 	 */
 	vy_lsm_add_run(lsm, new_run);
-	vy_stmt_counter_add_disk(&lsm->stat.disk.dump.out, &new_run->count);
+	vy_disk_stmt_counter_add(&lsm->stat.disk.dump.out, &new_run->count);
 
 	/* Drop the reference held by the task. */
 	vy_run_unref(new_run);
@@ -1521,7 +1521,7 @@ vy_task_compact_complete(struct vy_task *task)
 	 */
 	if (new_slice != NULL) {
 		vy_lsm_add_run(lsm, new_run);
-		vy_stmt_counter_add_disk(&lsm->stat.disk.compact.out,
+		vy_disk_stmt_counter_add(&lsm->stat.disk.compact.out,
 					 &new_run->count);
 		/* Drop the reference held by the task. */
 		vy_run_unref(new_run);
@@ -1544,7 +1544,7 @@ vy_task_compact_complete(struct vy_task *task)
 		next_slice = rlist_next_entry(slice, in_range);
 		vy_range_remove_slice(range, slice);
 		rlist_add_entry(&compacted_slices, slice, in_range);
-		vy_stmt_counter_add_disk(&lsm->stat.disk.compact.in,
+		vy_disk_stmt_counter_add(&lsm->stat.disk.compact.in,
 					 &slice->count);
 		if (slice == last_slice)
 			break;
diff --git a/src/box/vy_stat.h b/src/box/vy_stat.h
index ca52c4d3..6d37e79f 100644
--- a/src/box/vy_stat.h
+++ b/src/box/vy_stat.h
@@ -101,15 +101,6 @@ struct vy_txw_iterator_stat {
 	struct vy_stmt_counter get;
 };
 
-/** Dump/compaction statistics. */
-struct vy_compact_stat {
-	int32_t count;
-	/** Number of input statements. */
-	struct vy_stmt_counter in;
-	/** Number of output statements. */
-	struct vy_stmt_counter out;
-};
-
 /** LSM tree statistics. */
 struct vy_lsm_stat {
 	/** Number of lookups in the LSM tree. */
@@ -141,9 +132,23 @@ struct vy_lsm_stat {
 		/** Run iterator statistics. */
 		struct vy_run_iterator_stat iterator;
 		/** Dump statistics. */
-		struct vy_compact_stat dump;
+		struct {
+			/* Number of completed tasks. */
+			int32_t count;
+			/** Number of input statements. */
+			struct vy_stmt_counter in;
+			/** Number of output statements. */
+			struct vy_disk_stmt_counter out;
+		} dump;
 		/** Compaction statistics. */
-		struct vy_compact_stat compact;
+		struct {
+			/* Number of completed tasks. */
+			int32_t count;
+			/** Number of input statements. */
+			struct vy_disk_stmt_counter in;
+			/** Number of output statements. */
+			struct vy_disk_stmt_counter out;
+		} compact;
 	} disk;
 	/** TX write set statistics. */
 	struct {
diff --git a/test/vinyl/info.result b/test/vinyl/info.result
index a53ee3ae..3d7108cc 100644
--- a/test/vinyl/info.result
+++ b/test/vinyl/info.result
@@ -160,14 +160,20 @@ istat()
         bytes: 0
       count: 0
       out:
+        bytes_compressed: 0
+        pages: 0
         rows: 0
         bytes: 0
     compact:
       in:
+        bytes_compressed: 0
+        pages: 0
         rows: 0
         bytes: 0
       count: 0
       out:
+        bytes_compressed: 0
+        pages: 0
         rows: 0
         bytes: 0
     iterator:
@@ -264,8 +270,10 @@ stat_diff(istat(), st)
         bytes: 26525
       count: 1
       out:
-        rows: 25
         bytes: 26049
+        pages: 7
+        bytes_compressed: <bytes_compressed>
+        rows: 25
     index_size: 294
     rows: 25
     bloom_size: 70
@@ -300,8 +308,10 @@ stat_diff(istat(), st)
         bytes: 53050
       count: 1
       out:
-        rows: 50
         bytes: 52091
+        pages: 13
+        bytes_compressed: <bytes_compressed>
+        rows: 50
     index_size: 252
     rows: 25
     bytes_compressed: <bytes_compressed>
@@ -309,12 +319,16 @@ stat_diff(istat(), st)
     bytes: 26042
     compact:
       in:
-        rows: 75
         bytes: 78140
+        pages: 20
+        bytes_compressed: <bytes_compressed>
+        rows: 75
       count: 1
       out:
-        rows: 50
         bytes: 52091
+        pages: 13
+        bytes_compressed: <bytes_compressed>
+        rows: 50
   put:
     rows: 50
     bytes: 53050
@@ -958,14 +972,20 @@ istat()
         bytes: 0
       count: 0
       out:
+        bytes_compressed: <bytes_compressed>
+        pages: 0
         rows: 0
         bytes: 0
     compact:
       in:
+        bytes_compressed: <bytes_compressed>
+        pages: 0
         rows: 0
         bytes: 0
       count: 0
       out:
+        bytes_compressed: <bytes_compressed>
+        pages: 0
         rows: 0
         bytes: 0
     iterator:
-- 
2.11.0

  parent reply	other threads:[~2018-09-16 17:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-16 17:06 [PATCH v2 0/8] vinyl: improve stats for throttling Vladimir Davydov
2018-09-16 17:06 ` [PATCH v2 1/8] vinyl: fix force compaction logic Vladimir Davydov
2018-09-19  1:43   ` Konstantin Osipov
2018-09-16 17:06 ` [PATCH v2 2/8] vinyl: update compact priority usual way on range split/coalesce Vladimir Davydov
2018-09-19  1:46   ` Konstantin Osipov
2018-09-16 17:06 ` [PATCH v2 3/8] vinyl: annotate info_table_end with comment Vladimir Davydov
2018-09-19  1:47   ` Konstantin Osipov
2018-09-16 17:06 ` Vladimir Davydov [this message]
2018-09-19  1:48   ` [PATCH v2 4/8] vinyl: report pages and bytes_compressed in dump/compact in/out stats Konstantin Osipov
2018-09-16 17:06 ` [PATCH v2 5/8] vinyl: add helpers for resetting statement counters Vladimir Davydov
2018-09-19  1:49   ` Konstantin Osipov
2018-09-16 17:06 ` [PATCH v2 6/8] vinyl: keep track of compaction queue length Vladimir Davydov
2018-09-19  1:53   ` Konstantin Osipov
2018-09-16 17:06 ` [PATCH v2 7/8] vinyl: factor out helpers for accounting dump/compaction Vladimir Davydov
2018-09-19  1:53   ` Konstantin Osipov
2018-09-16 17:06 ` [PATCH v2 8/8] vinyl: add global disk stats Vladimir Davydov
2018-09-19  1:56   ` Konstantin Osipov
2018-09-19  9:59 ` [PATCH v2 0/8] vinyl: improve stats for throttling 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=89b4528c5e34733ef1162cd443905743a6522104.1537115208.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 4/8] vinyl: report pages and bytes_compressed in dump/compact in/out stats' \
    /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