aboutsummaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2013-03-21 19:04:52 -0700
committerEthan Jackson <ethan@nicira.com>2013-04-01 16:01:29 -0700
commit8ed3c277e0990157652ce5557ccc8e0396deb694 (patch)
treecc2224dc5ec4290ea2b1ce1ac9813a107a5b52f7 /ofproto
parent3ff576b335ca6cad1dfc1d916c9cc5a98297f2ef (diff)
ofproto-dpif: Push statistics less frequently.
The most natural place to push facet statistics is in update_stats() where they're pulled from the datapath. However, under load, update_stats() can be called as many as 10 times per second causing us to push statistics so frequently it hurts performance. By pushing statistics much less frequently, this patch generates a roughly 8% improvement in TCP_CRR performance. Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index f0edfe67..2ea439c4 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -903,6 +903,7 @@ lookup_ofproto_dpif_by_port_name(const char *name)
static int
type_run(const char *type)
{
+ static long long int push_timer = LLONG_MIN;
struct dpif_backer *backer;
char *devname;
int error;
@@ -916,6 +917,16 @@ type_run(const char *type)
dpif_run(backer->dpif);
+ /* The most natural place to push facet statistics is when they're pulled
+ * from the datapath. However, when there are many flows in the datapath,
+ * this expensive operation can occur so frequently, that it reduces our
+ * ability to quickly set up flows. To reduce the cost, we push statistics
+ * here instead. */
+ if (time_msec() > push_timer) {
+ push_timer = time_msec() + 2000;
+ push_all_stats();
+ }
+
if (backer->need_revalidate
|| !tag_set_is_empty(&backer->revalidate_set)) {
struct tag_set revalidate_set = backer->revalidate_set;
@@ -4220,7 +4231,6 @@ update_subfacet_stats(struct subfacet *subfacet,
facet_account(facet);
facet->accounted_bytes = facet->byte_count;
}
- facet_push_stats(facet);
}
/* 'key' with length 'key_len' bytes is a flow in 'dpif' that we know nothing