summaryrefslogtreecommitdiffstats
path: root/sbin/hastd
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-05-23 21:15:19 +0000
committerpjd <pjd@FreeBSD.org>2011-05-23 21:15:19 +0000
commit42a14e17b5ae3fb20e7c5cba42663f088ae9fa19 (patch)
tree8bdba7aed6120f1649d55702a6e914918cfa0c9c /sbin/hastd
parentbef2f8f5d1658b0cc6ec6bbe5c1b792020c86ee9 (diff)
downloadFreeBSD-src-42a14e17b5ae3fb20e7c5cba42663f088ae9fa19.zip
FreeBSD-src-42a14e17b5ae3fb20e7c5cba42663f088ae9fa19.tar.gz
Keep statistics on number of BIO_READ, BIO_WRITE, BIO_DELETE and BIO_FLUSH
requests as well as number of activemap updates. Number of BIO_WRITEs and activemap updates are especially interesting, because if those two are too close to each other, it means that your workload needs bigger number of dirty extents. Activemap should be updated as rarely as possible. MFC after: 1 week
Diffstat (limited to 'sbin/hastd')
-rw-r--r--sbin/hastd/control.c17
-rw-r--r--sbin/hastd/hast.h11
-rw-r--r--sbin/hastd/primary.c11
-rw-r--r--sbin/hastd/secondary.c14
4 files changed, 53 insertions, 0 deletions
diff --git a/sbin/hastd/control.c b/sbin/hastd/control.c
index dce2d53..4d00403 100644
--- a/sbin/hastd/control.c
+++ b/sbin/hastd/control.c
@@ -199,6 +199,16 @@ control_status_worker(struct hast_resource *res, struct nv *nvout,
"extentsize%u", no);
nv_add_uint32(nvout, nv_get_uint32(cnvin, "keepdirty"),
"keepdirty%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_read"),
+ "stat_read%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_write"),
+ "stat_write%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_delete"),
+ "stat_delete%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush"),
+ "stat_flush%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_activemap_update"),
+ "stat_activemap_update%u", no);
end:
if (cnvin != NULL)
nv_free(cnvin);
@@ -446,6 +456,13 @@ ctrl_thread(void *arg)
nv_add_uint32(nvout, (uint32_t)0, "keepdirty");
nv_add_uint64(nvout, (uint64_t)0, "dirty");
}
+ nv_add_uint64(nvout, res->hr_stat_read, "stat_read");
+ nv_add_uint64(nvout, res->hr_stat_write, "stat_write");
+ nv_add_uint64(nvout, res->hr_stat_delete,
+ "stat_delete");
+ nv_add_uint64(nvout, res->hr_stat_flush, "stat_flush");
+ nv_add_uint64(nvout, res->hr_stat_activemap_update,
+ "stat_activemap_update");
nv_add_int16(nvout, 0, "error");
break;
case CONTROL_RELOAD:
diff --git a/sbin/hastd/hast.h b/sbin/hastd/hast.h
index 3f26162..a62b63a 100644
--- a/sbin/hastd/hast.h
+++ b/sbin/hastd/hast.h
@@ -218,6 +218,17 @@ struct hast_resource {
/* Locked used to synchronize access to hr_amp. */
pthread_mutex_t hr_amp_lock;
+ /* Number of BIO_READ requests. */
+ uint64_t hr_stat_read;
+ /* Number of BIO_WRITE requests. */
+ uint64_t hr_stat_write;
+ /* Number of BIO_DELETE requests. */
+ uint64_t hr_stat_delete;
+ /* Number of BIO_FLUSH requests. */
+ uint64_t hr_stat_flush;
+ /* Number of activemap updates. */
+ uint64_t hr_stat_activemap_update;
+
/* Next resource. */
TAILQ_ENTRY(hast_resource) hr_next;
};
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c
index d8eb664..1f6585c 100644
--- a/sbin/hastd/primary.c
+++ b/sbin/hastd/primary.c
@@ -1117,6 +1117,7 @@ ggate_recv_thread(void *arg)
*/
switch (ggio->gctl_cmd) {
case BIO_READ:
+ res->hr_stat_read++;
pjdlog_debug(2,
"ggate_recv: (%p) Moving request to the send queue.",
hio);
@@ -1145,6 +1146,7 @@ ggate_recv_thread(void *arg)
QUEUE_INSERT1(hio, send, ncomp);
break;
case BIO_WRITE:
+ res->hr_stat_write++;
if (res->hr_resuid == 0) {
/*
* This is first write, initialize localcnt and
@@ -1183,12 +1185,21 @@ ggate_recv_thread(void *arg)
mtx_lock(&res->hr_amp_lock);
if (activemap_write_start(res->hr_amp,
ggio->gctl_offset, ggio->gctl_length)) {
+ res->hr_stat_activemap_update++;
(void)hast_activemap_flush(res);
}
mtx_unlock(&res->hr_amp_lock);
/* FALLTHROUGH */
case BIO_DELETE:
case BIO_FLUSH:
+ switch (ggio->gctl_cmd) {
+ case BIO_DELETE:
+ res->hr_stat_delete++;
+ break;
+ case BIO_FLUSH:
+ res->hr_stat_flush++;
+ break;
+ }
pjdlog_debug(2,
"ggate_recv: (%p) Moving request to the send queues.",
hio);
diff --git a/sbin/hastd/secondary.c b/sbin/hastd/secondary.c
index 176d047..1597af8 100644
--- a/sbin/hastd/secondary.c
+++ b/sbin/hastd/secondary.c
@@ -612,6 +612,20 @@ recv_thread(void *arg)
QUEUE_INSERT(send, hio);
continue;
}
+ switch (hio->hio_cmd) {
+ case HIO_READ:
+ res->hr_stat_read++;
+ break;
+ case HIO_WRITE:
+ res->hr_stat_write++;
+ break;
+ case HIO_DELETE:
+ res->hr_stat_delete++;
+ break;
+ case HIO_FLUSH:
+ res->hr_stat_flush++;
+ break;
+ }
reqlog(LOG_DEBUG, 2, -1, hio,
"recv: (%p) Got request header: ", hio);
if (hio->hio_cmd == HIO_KEEPALIVE) {
OpenPOWER on IntegriCloud