bridge: Rate-limit updates to "instant stats".
authorBen Pfaff <blp@nicira.com>
Tue, 19 Mar 2013 21:02:48 +0000 (14:02 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 20 Mar 2013 18:31:23 +0000 (11:31 -0700)
commitb785f89cc1b86ac92e624ef20366242bae963d5f
tree892e24a36fb32da0922d89b7a48f9c38e00a19b3
parentfedd47466df891d6fc1e694e3b21c1b24a5ea18c
bridge: Rate-limit updates to "instant stats".

Some information in the database must be kept as up-to-date as
possible to allow controllers to respond rapidly to network outages.
We call these statistics "instant" stats.

Until now, the instant stats have been updated on every trip through
the main loop.  This work scales with the number of interfaces that
ovs-vswitchd manages.  With CFM enabled on 5000 interfaces, even with
a low transmission rate, we see ovs-vswitchd using 100% CPU just to
maintain statistics, even with no actual changes.

This commit rate-limits updates to instant stats to at most 10 times
per second.  Earlier tests I did with similar patches showed a major
reduction in CPU usage.  I have not rerun those tests with this patch,
but I expect that the CPU usage should similarly decline.

CC: Ram Jothikumar <rjothikumar@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
vswitchd/bridge.c