[ovs-dev] [PATCH 6/8] bridge: Add configuration to disable the interface stats/status update to OVSDB.

Alex Wang alexw at nicira.com
Fri Apr 4 22:00:41 UTC 2014


This commit adds a new configuration "disable-stats-update" in
"other_config" of Open_Vswitch table.  When set, it allows user
to disable the statistics update to OVSDB.  This can greatly reduce
the cpu consumption when statistics is not used.

Signed-off-by: Alex Wang <alexw at nicira.com>
---
 vswitchd/bridge.c    |   12 ++++++++++--
 vswitchd/vswitch.xml |    5 +++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index c3e8588..ba680cd 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -161,6 +161,9 @@ static unsigned int idl_seqno;
 /* Track changes to port connectivity. */
 static uint64_t connectivity_seqno = LLONG_MIN;
 
+/* Statistics update disabled? */
+static bool disable_stats_update = false;
+
 /* Each time this timer expires, the bridge fetches interface and mirror
  * statistics and pushes them into the database. */
 #define IFACE_STATS_INTERVAL (5 * 1000) /* In milliseconds. */
@@ -2333,8 +2336,10 @@ bridge_run(void)
         }
     }
 
+    disable_stats_update = smap_get_bool(&cfg->other_config,
+                                         "disable-stats-update", false);
     /* Refresh interface and mirror stats if necessary. */
-    if (time_msec() >= iface_stats_timer) {
+    if (time_msec() >= iface_stats_timer && !disable_stats_update) {
         if (cfg) {
             struct ovsdb_idl_txn *txn;
 
@@ -2418,7 +2423,10 @@ bridge_wait(void)
         HMAP_FOR_EACH (br, node, &all_bridges) {
             ofproto_wait(br->ofproto);
         }
-        poll_timer_wait_until(iface_stats_timer);
+
+        if (!disable_stats_update) {
+            poll_timer_wait_until(iface_stats_timer);
+        }
     }
 
     system_stats_wait();
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 78594e7..b9f8042 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -72,6 +72,11 @@
         host as displayed by <code>xe host-list</code>.
       </column>
 
+      <column name="other_config" key="disable-stats-update"
+              type='{"type": "boolean"}'>
+        Disable the statistics update to OVSDB.  Default is false.
+      </column>
+
       <column name="other_config" key="flow-restore-wait"
               type='{"type": "boolean"}'>
         <p>
-- 
1.7.9.5




More information about the dev mailing list