aboutsummaryrefslogtreecommitdiff
path: root/vswitchd
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-11-28 10:35:15 -0800
committerBen Pfaff <blp@nicira.com>2011-11-28 10:35:15 -0800
commit5fcc0d004ae0aa080deed51c842d074a83ec1f67 (patch)
tree1b3938b503d8f792ee61c1d5a0d3ead30ad0337e /vswitchd
parent9b16c4394b940573d733c47fa7213bbe99a456d9 (diff)
ofproto: Add "fast path".
The key to getting good performance on the netperf CRR test seems to be to handle the first packet of each new flow as quickly as possible. Until now, we've only had one opportunity to do that on each trip through the main poll loop. One way to improve would be to make that poll loop circulate more quickly. My experiments show, however, that even just commenting out the slower parts of the poll loop yield minimal improvement. This commit takes another approach. Instead of making the poll loop overall faster, it invokes the performance-critical parts of it more than once during each poll loop. My measurements show that this commit improves netperf CRR performance by 24% versus the previous commit, for an overall improvement of 87% versus the baseline just before the commit that removed the poll_fd_woke(). With this commit, ovs-benchmark performance has also improved by 13% overall since that baseline.
Diffstat (limited to 'vswitchd')
-rw-r--r--vswitchd/bridge.c28
-rw-r--r--vswitchd/bridge.h3
-rw-r--r--vswitchd/ovs-vswitchd.c2
3 files changed, 22 insertions, 11 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index aadb0c7a..d2dcd027 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1782,13 +1782,28 @@ refresh_cfm_stats(void)
}
}
+/* Performs periodic activity required by bridges that needs to be done with
+ * the least possible latency.
+ *
+ * It makes sense to call this function a couple of times per poll loop, to
+ * provide a significant performance boost on some benchmarks with ofprotos
+ * that use the ofproto-dpif implementation. */
+void
+bridge_run_fast(void)
+{
+ struct bridge *br;
+
+ HMAP_FOR_EACH (br, node, &all_bridges) {
+ ofproto_run_fast(br->ofproto);
+ }
+}
+
void
bridge_run(void)
{
const struct ovsrec_open_vswitch *cfg;
bool vlan_splinters_changed;
- bool datapath_destroyed;
bool database_changed;
struct bridge *br;
@@ -1811,15 +1826,8 @@ bridge_run(void)
cfg = ovsrec_open_vswitch_first(idl);
/* Let each bridge do the work that it needs to do. */
- datapath_destroyed = false;
HMAP_FOR_EACH (br, node, &all_bridges) {
- int error = ofproto_run(br->ofproto);
- if (error) {
- static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
- VLOG_ERR_RL(&rl, "bridge %s: datapath was destroyed externally, "
- "forcing reconfiguration", br->name);
- datapath_destroyed = true;
- }
+ ofproto_run(br->ofproto);
}
/* Re-configure SSL. We do this on every trip through the main loop,
@@ -1847,7 +1855,7 @@ bridge_run(void)
}
}
- if (database_changed || datapath_destroyed || vlan_splinters_changed) {
+ if (database_changed || vlan_splinters_changed) {
if (cfg) {
struct ovsdb_idl_txn *txn = ovsdb_idl_txn_create(idl);
diff --git a/vswitchd/bridge.h b/vswitchd/bridge.h
index 32b581e2..2d388338 100644
--- a/vswitchd/bridge.h
+++ b/vswitchd/bridge.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009, 2010 Nicira Networks
+/* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ void bridge_init(const char *remote);
void bridge_exit(void);
void bridge_run(void);
+void bridge_run_fast(void);
void bridge_wait(void);
#endif /* bridge.h */
diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
index bdc35330..301d0739 100644
--- a/vswitchd/ovs-vswitchd.c
+++ b/vswitchd/ovs-vswitchd.c
@@ -92,7 +92,9 @@ main(int argc, char *argv[])
if (signal_poll(sighup)) {
vlog_reopen_log_file();
}
+ bridge_run_fast();
bridge_run();
+ bridge_run_fast();
unixctl_server_run(unixctl);
netdev_run();