You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2015/01/21 18:05:16 UTC

svn commit: r1653605 - in /qpid/dispatch/trunk/python: qpid_dispatch/management/qdrouter.json qpid_dispatch_internal/router/link.py qpid_dispatch_internal/router/node.py

Author: tross
Date: Wed Jan 21 17:05:16 2015
New Revision: 1653605

URL: http://svn.apache.org/r1653605
Log:
DISPATCH-100 - Accelerate the RA interval during topology fluctuations.

Modified:
    qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json
    qpid/dispatch/trunk/python/qpid_dispatch_internal/router/link.py
    qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py

Modified: qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json?rev=1653605&r1=1653604&r2=1653605&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch/management/qdrouter.json Wed Jan 21 17:05:16 2015
@@ -172,7 +172,12 @@
                 "raInterval": {
                     "type": "Integer",
                     "default": 30,
-                    "description": "Interval in seconds between Router-Advertisements sent to all routers."
+                    "description": "Interval in seconds between Router-Advertisements sent to all routers in a stable network."
+                },
+                "raIntervalFlux": {
+                    "type": "Integer",
+                    "default": 4,
+                    "description": "Interval in seconds between Router-Advertisements sent to all routers during topology fluctuations."
                 },
                 "remoteLsMaxAge": {
                     "type": "Integer",

Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/router/link.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/router/link.py?rev=1653605&r1=1653604&r2=1653605&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/router/link.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/router/link.py Wed Jan 21 17:05:16 2015
@@ -28,7 +28,8 @@ class LinkStateEngine(object):
         self.container = container
         self.node_tracker = container.node_tracker
         self.id = self.container.id
-        self.ra_interval = self.container.config.raInterval
+        self.ra_interval_stable = self.container.config.raInterval
+        self.ra_interval_flux   = self.container.config.raIntervalFlux
         self.last_ra_time = 0
         self.mobile_seq   = 0
 
@@ -38,7 +39,10 @@ class LinkStateEngine(object):
 
 
     def tick(self, now):
-        if now - self.last_ra_time >= self.ra_interval:
+        interval = self.ra_interval_stable
+        if self.node_tracker.in_flux_mode(now):
+            interval = self.ra_interval_flux
+        if now - self.last_ra_time >= interval:
             self.send_ra(now)
 
 

Modified: qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py?rev=1653605&r1=1653604&r2=1653605&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py (original)
+++ qpid/dispatch/trunk/python/qpid_dispatch_internal/router/node.py Wed Jan 21 17:05:16 2015
@@ -35,6 +35,8 @@ class NodeTracker(object):
         self.link_state            = LinkState(None, self.my_id, 0, [])
         self.link_state_changed    = False
         self.recompute_topology    = False
+        self.last_topology_change  = 0
+        self.flux_mode             = False
         self.nodes                 = {}  # id => RouterNode
         self.nodes_by_link_id      = {}  # link-id => node-id
         self.maskbits              = []
@@ -44,6 +46,7 @@ class NodeTracker(object):
         self.maskbits[0]      = True
         self.neighbor_max_age = self.container.config.helloMaxAge
         self.ls_max_age       = self.container.config.remoteLsMaxAge
+        self.flux_interval    = self.container.config.raIntervalFlux * 2
 
 
     def _do_expirations(self, now):
@@ -103,6 +106,15 @@ class NodeTracker(object):
         self._do_expirations(now)
 
         ##
+        ## Enter flux mode if things are changing
+        ##
+        if self.link_state_changed or self.recompute_topology:
+            self.last_topology_change = now
+            if not self.flux_mode:
+                self.flux_mode = True
+                self.container.log(LOG_TRACE, "Entered Router Flux Mode")
+
+        ##
         ## Handle local link state changes
         ##
         if self.link_state_changed:
@@ -209,6 +221,14 @@ class NodeTracker(object):
                 self.link_state_changed = True
 
 
+    def in_flux_mode(self, now):
+        result = (now - self.last_topology_change) <= self.flux_interval
+        if not result and self.flux_mode:
+            self.flux_mode = False
+            self.container.log(LOG_TRACE, "Exited Router Flux Mode")
+        return result
+
+
     def ra_received(self, node_id, ls_seq, mobile_seq, instance, now):
         """
         Invoked when a router advertisement is received from another router.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org