[ovs-dev] [v3 3/3] ovsdb: Add per transaction commit instruction counter

Andy Zhou azhou at nicira.com
Wed Jul 15 22:47:35 UTC 2015


Measure user space only instruction counters for commit each
transaction. This measurement is mainly useful for
tuning OVSDB internal implementation, such as how OVSDB scales over
number of client connections.

A simple usage example:

ovs-appctl -t ovsdb-server ovsdb-server/perf-counters-clear
ovs-vsctl add-port br0 p3
ovs-appctl -t ovsdb-server ovsdb-server/perf-counters-show
ovsdb_txn_commit            2      906922 453461.0

The commands above show that the 'add-port br p3' command caused ovsdb
to execute 2 transactions. Each transaction takes 453461 instructions,
total 906922 instructions. The number will vary based on number of
ovsdb clients connected.

Signed-off-by: Andy Zhou <azhou at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>
---
 ovsdb/transaction.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
index 9e03963..83ddaff 100644
--- a/ovsdb/transaction.c
+++ b/ovsdb/transaction.c
@@ -27,6 +27,7 @@
 #include "ovsdb.h"
 #include "row.h"
 #include "table.h"
+#include "perf-counter.h"
 #include "uuid.h"
 
 struct ovsdb_txn {
@@ -747,8 +748,8 @@ check_index_uniqueness(struct ovsdb_txn *txn OVS_UNUSED,
     return NULL;
 }
 
-struct ovsdb_error *
-ovsdb_txn_commit(struct ovsdb_txn *txn, bool durable)
+static struct ovsdb_error *
+ovsdb_txn_commit_(struct ovsdb_txn *txn, bool durable)
 {
     struct ovsdb_replica *replica;
     struct ovsdb_error *error;
@@ -821,6 +822,15 @@ ovsdb_txn_commit(struct ovsdb_txn *txn, bool durable)
     return NULL;
 }
 
+struct ovsdb_error *
+ovsdb_txn_commit(struct ovsdb_txn *txn, bool durable)
+{
+   struct ovsdb_error *err;
+
+   PERF(__func__, err = ovsdb_txn_commit_(txn, durable));
+   return err;
+}
+
 void
 ovsdb_txn_for_each_change(const struct ovsdb_txn *txn,
                           ovsdb_txn_row_cb_func *cb, void *aux)
-- 
1.9.1




More information about the dev mailing list