From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org
Cc: zhang.zhanghailiang@huawei.com, yunhong.jiang@intel.com,
eddie.dong@intel.com, peter.huangpeng@huawei.com, luis@cs.umu.se
Subject: [Qemu-devel] [RFC 1/1] COLO: Add primary side rolling statistics
Date: Thu, 5 Mar 2015 13:31:34 +0000 [thread overview]
Message-ID: <1425562294-1616-2-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1425562294-1616-1-git-send-email-dgilbert@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Record:
Checkpoint lifetime (ms)
Pause time due to checkpoint (ms)
Checkpoint size (bytes)
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hmp.c | 12 ++++++++++++
include/migration/migration.h | 3 +++
migration/colo.c | 15 +++++++++++++++
migration/migration.c | 30 ++++++++++++++++++++++++++++++
qapi-schema.json | 11 ++++++++++-
5 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/hmp.c b/hmp.c
index c724efa..2b17ed0 100644
--- a/hmp.c
+++ b/hmp.c
@@ -197,6 +197,18 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
info->setup_time);
}
}
+ if (info->has_colo_checkpoint_stats) {
+ monitor_printf_RollingStats(mon, "colo checkpoint (ms)",
+ info->colo_checkpoint_stats);
+ }
+ if (info->has_colo_paused_stats) {
+ monitor_printf_RollingStats(mon, "colo paused time (ms)",
+ info->colo_paused_stats);
+ }
+ if (info->has_colo_size_stats) {
+ monitor_printf_RollingStats(mon, "colo checkpoint size",
+ info->colo_size_stats);
+ }
if (info->has_ram) {
monitor_printf(mon, "transferred ram: %" PRIu64 " kbytes\n",
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 9893467..564edaa 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -64,6 +64,9 @@ struct MigrationState
int64_t setup_time;
int64_t dirty_sync_count;
RStats *expected_downtime_stats;
+ RStats *colo_checkpoint_stats;
+ RStats *colo_paused_stats;
+ RStats *colo_size_stats;
};
enum {
diff --git a/migration/colo.c b/migration/colo.c
index 042dec8..653ef25 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -15,6 +15,7 @@
#include "sysemu/sysemu.h"
#include "migration/migration-colo.h"
#include "qemu/error-report.h"
+#include "qemu/rolling-stats.h"
#include "migration/migration-failover.h"
#include "net/colo-nic.h"
#include "block/block.h"
@@ -272,6 +273,7 @@ static int do_colo_transaction(MigrationState *s, QEMUFile *control)
int ret;
size_t size;
QEMUFile *trans = NULL;
+ int64_t stop_time, start_time;
ret = colo_ctl_put(s->file, COLO_CHECKPOINT_NEW);
if (ret < 0) {
@@ -295,6 +297,7 @@ static int do_colo_transaction(MigrationState *s, QEMUFile *control)
goto out;
}
/* suspend and save vm state to colo buffer */
+ stop_time = qemu_clock_get_ms(QEMU_CLOCK_HOST);
qemu_mutex_lock_iothread();
vm_stop_force_state(RUN_STATE_COLO);
qemu_mutex_unlock_iothread();
@@ -343,6 +346,9 @@ static int do_colo_transaction(MigrationState *s, QEMUFile *control)
if (ret < 0) {
goto out;
}
+
+ rstats_add_value(s->colo_size_stats, size, stop_time);
+
ret = colo_ctl_get(control, COLO_CHECKPOINT_RECEIVED);
if (ret < 0) {
goto out;
@@ -366,6 +372,11 @@ static int do_colo_transaction(MigrationState *s, QEMUFile *control)
qemu_mutex_lock_iothread();
vm_start();
qemu_mutex_unlock_iothread();
+ start_time = qemu_clock_get_ms(QEMU_CLOCK_HOST);
+ rstats_add_value(s->colo_paused_stats,
+ start_time - stop_time,
+ start_time);
+
DPRINTF("vm resume to run again\n");
out:
@@ -450,6 +461,10 @@ static void *colo_thread(void *opaque)
DPRINTF("Net packets is not consistent!!!\n");
}
+ current_time = qemu_clock_get_ms(QEMU_CLOCK_HOST);
+ rstats_add_value(s->colo_checkpoint_stats,
+ current_time - start_time,
+ current_time);
/* start a colo checkpoint */
if (do_colo_transaction(s, colo_control)) {
goto out;
diff --git a/migration/migration.c b/migration/migration.c
index 794d94a..7c0517a 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -244,6 +244,21 @@ MigrationInfo *qmp_query_migrate(Error **errp)
case MIG_STATE_COLO:
info->has_status = true;
info->status = g_strdup("colo");
+ if (s->colo_checkpoint_stats) {
+ info->colo_checkpoint_stats =
+ rstats_as_RollingStats(s->colo_checkpoint_stats);
+ info->has_colo_checkpoint_stats = true;
+ }
+ if (s->colo_paused_stats) {
+ info->colo_paused_stats =
+ rstats_as_RollingStats(s->colo_paused_stats);
+ info->has_colo_paused_stats = true;
+ }
+ if (s->colo_size_stats) {
+ info->colo_size_stats =
+ rstats_as_RollingStats(s->colo_size_stats);
+ info->has_colo_size_stats = true;
+ }
/* TODO: display COLO specific informations(checkpoint info etc.),*/
break;
case MIG_STATE_COMPLETED:
@@ -433,6 +448,21 @@ static MigrationState *migrate_init(const MigrationParams *params)
} else {
rstats_reset(s->expected_downtime_stats);
}
+ if (!s->colo_checkpoint_stats) {
+ s->colo_checkpoint_stats = rstats_init(10, 0.2);
+ } else {
+ rstats_reset(s->colo_checkpoint_stats);
+ }
+ if (!s->colo_paused_stats) {
+ s->colo_paused_stats = rstats_init(10, 0.2);
+ } else {
+ rstats_reset(s->colo_paused_stats);
+ }
+ if (!s->colo_size_stats) {
+ s->colo_size_stats = rstats_init(10, 0.2);
+ } else {
+ rstats_reset(s->colo_size_stats);
+ }
s->bandwidth_limit = bandwidth_limit;
s->state = MIG_STATE_SETUP;
trace_migrate_set_state(MIG_STATE_SETUP);
diff --git a/qapi-schema.json b/qapi-schema.json
index 2ec35c7..f2a666c 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -486,6 +486,12 @@
# @expected-downtime-stats: #optional more detailed statistics from the
# downtime estimation.
#
+# @colo-checkpoint-stats: #optional The length of COLO checkpoints (ms)
+#
+# @colo-paused-stats: #optional The time paused (ms) as COLO took checkpoints
+#
+# @colo-size-stats: #optional The size of COLO checkpoints (bytes)
+#
# Since: 0.14.0
##
{ 'type': 'MigrationInfo',
@@ -496,7 +502,10 @@
'*expected-downtime': 'int',
'*downtime': 'int',
'*setup-time': 'int',
- '*expected-downtime-stats': 'RollingStats' } }
+ '*expected-downtime-stats': 'RollingStats',
+ '*colo-checkpoint-stats': 'RollingStats',
+ '*colo-paused-stats': 'RollingStats',
+ '*colo-size-stats': 'RollingStats' } }
##
# @query-migrate
--
2.1.0
next prev parent reply other threads:[~2015-03-05 13:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 13:31 [Qemu-devel] [RFC 0/1] Rolling stats on colo Dr. David Alan Gilbert (git)
2015-03-05 13:31 ` Dr. David Alan Gilbert (git) [this message]
2015-03-06 1:48 ` zhanghailiang
2015-03-06 1:52 ` zhanghailiang
2015-03-06 18:30 ` Dr. David Alan Gilbert
2015-03-09 2:37 ` Wen Congyang
2015-03-09 8:55 ` Dr. David Alan Gilbert
2015-03-09 9:01 ` Wen Congyang
2015-03-11 3:11 ` zhanghailiang
2015-03-11 9:06 ` Dr. David Alan Gilbert
2015-03-11 9:31 ` zhanghailiang
2015-03-11 10:07 ` Dr. David Alan Gilbert
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=1425562294-1616-2-git-send-email-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=eddie.dong@intel.com \
--cc=luis@cs.umu.se \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=yunhong.jiang@intel.com \
--cc=zhang.zhanghailiang@huawei.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).