Tune eos gossip/notification intervals 73/97973/3
authorTomas Cere <tomas.cere@pantheon.tech>
Tue, 19 Oct 2021 08:54:47 +0000 (10:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 21 Oct 2021 06:02:52 +0000 (08:02 +0200)
Looks like eos gossips take much too long, so lets
lower these so we have faster response times all around.

JIRA: CONTROLLER-2004
Change-Id: I3daf8d207a6b51b16e6b8cb3f7dcefd55e6626cf
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/eos-dom-akka/pom.xml
opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/AbstractNativeEosTest.java
opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/SingleNodeTest.java
opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/service/ClusterSingletonIntegrationTest.java [moved from opendaylight/md-sal/sal-distributed-eos-native/src/test/java/org/opendaylight/controller/cluster/akka/eos/service/ClusterSingletonIntegrationTest.java with 97% similarity]
opendaylight/md-sal/eos-dom-akka/src/test/resources/application.conf
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf

index 64cdc00f6f16e2686d4d81d55ec4ae6aec0cd8ad..39a57ca154417e19538a6c53cb9132a3a62f96d3 100644 (file)
             <groupId>org.awaitility</groupId>
             <artifactId>awaitility</artifactId>
         </dependency>
             <groupId>org.awaitility</groupId>
             <artifactId>awaitility</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>mdsal-singleton-common-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>mdsal-singleton-dom-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
     </dependencies>
 </project>
index 576a9c1d12f07a1a765118ddcebf4cd3a09e507b..5af0e2afdbffffa48aea202e4b2827ae998db2f0 100644 (file)
@@ -288,7 +288,17 @@ public abstract class AbstractNativeEosTest {
     }
 
     protected static void verifyNoNotifications(final MockEntityOwnershipListener listener) {
     }
 
     protected static void verifyNoNotifications(final MockEntityOwnershipListener listener) {
-        await().pollDelay(2, TimeUnit.SECONDS).until(() -> listener.getChanges().isEmpty());
+        verifyNoNotifications(listener, 2);
+    }
+
+    protected static void verifyNoNotifications(final MockEntityOwnershipListener listener, long delaySeconds) {
+        await().pollDelay(delaySeconds, TimeUnit.SECONDS).until(() -> listener.getChanges().isEmpty());
+    }
+
+    protected static void verifyNoAdditionalNotifications(
+            final MockEntityOwnershipListener listener, long delaySeconds) {
+        listener.resetListener();
+        verifyNoNotifications(listener, delaySeconds);
     }
 
     protected static final class ClusterNode {
     }
 
     protected static final class ClusterNode {
@@ -367,6 +377,10 @@ public abstract class AbstractNativeEosTest {
         public List<DOMEntityOwnershipChange> getChanges() {
             return changes;
         }
         public List<DOMEntityOwnershipChange> getChanges() {
             return changes;
         }
+
+        public void resetListener() {
+            changes.clear();
+        }
     }
 
     protected static final class MockNativeEntityOwnershipService extends AkkaEntityOwnershipService {
     }
 
     protected static final class MockNativeEntityOwnershipService extends AkkaEntityOwnershipService {
index 4d04530b10dd4ebef88882a136efc8c339b830a9..e4971785f30879e970d1ebb11eafc7529d25f7b1 100644 (file)
@@ -53,6 +53,7 @@ public class SingleNodeTest extends AbstractNativeEosTest {
 
         registerCandidates(clusterNode, ENTITY_1, "member-2", "member-3");
         verifyListenerState(listener, ENTITY_1, true, true, false);
 
         registerCandidates(clusterNode, ENTITY_1, "member-2", "member-3");
         verifyListenerState(listener, ENTITY_1, true, true, false);
+        verifyNoAdditionalNotifications(listener, 5);
 
         unregisterCandidates(clusterNode, ENTITY_1, "member-1");
         verifyListenerState(listener, ENTITY_1, true, false, true);
 
         unregisterCandidates(clusterNode, ENTITY_1, "member-1");
         verifyListenerState(listener, ENTITY_1, true, false, true);
@@ -68,6 +69,7 @@ public class SingleNodeTest extends AbstractNativeEosTest {
 
         final MockEntityOwnershipListener listener = registerListener(clusterNode, ENTITY_1);
         verifyListenerState(listener, ENTITY_1, true, true, false);
 
         final MockEntityOwnershipListener listener = registerListener(clusterNode, ENTITY_1);
         verifyListenerState(listener, ENTITY_1, true, true, false);
+        verifyNoAdditionalNotifications(listener, 5);
 
         unregisterCandidates(clusterNode, ENTITY_1, "member-1", "member-2");
         verifyListenerState(listener, ENTITY_1, true, false, true);
 
         unregisterCandidates(clusterNode, ENTITY_1, "member-1", "member-2");
         verifyListenerState(listener, ENTITY_1, true, false, true);
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.cluster.akka.eos.service;
+package org.opendaylight.controller.eos.akka.service;
 
 import static org.awaitility.Awaitility.await;
 import static org.junit.Assert.assertFalse;
 
 import static org.awaitility.Awaitility.await;
 import static org.junit.Assert.assertFalse;
@@ -27,7 +27,7 @@ import org.awaitility.Awaitility;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.controller.cluster.akka.eos.AbstractNativeEosTest;
+import org.opendaylight.controller.eos.akka.AbstractNativeEosTest;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
 import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
@@ -40,7 +40,7 @@ public class ClusterSingletonIntegrationTest extends AbstractNativeEosTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(ClusterSingletonIntegrationTest.class);
 
 
     private static final Logger LOG = LoggerFactory.getLogger(ClusterSingletonIntegrationTest.class);
 
-    private MockNativeEntityOwnershipService node1;
+    private AbstractNativeEosTest.MockNativeEntityOwnershipService node1;
     private MockNativeEntityOwnershipService node2;
     private MockNativeEntityOwnershipService node3;
 
     private MockNativeEntityOwnershipService node2;
     private MockNativeEntityOwnershipService node3;
 
index 71c983a3fc42a7a0a32d74fd6832c8211b25be34..ff23633e5e5793b7f0de0c9938e6c70122a0a266 100644 (file)
@@ -20,6 +20,18 @@ akka {
       "member-1"
     ]
     downing-provider-class = "akka.cluster.sbr.SplitBrainResolverProvider"
       "member-1"
     ]
     downing-provider-class = "akka.cluster.sbr.SplitBrainResolverProvider"
+
+    distributed-data {
+        # How often the Replicator should send out gossip information.
+        # This value controls how quickly Entity Ownership Service data is replicated
+        # across cluster nodes.
+        gossip-interval = 100 ms
+
+        # How often the subscribers will be notified of changes, if any.
+        # This value controls how quickly Entity Ownership Service decisions are
+        # propagated within a node.
+        notify-subscribers-interval = 20 ms
+      }
   }
 }
 
   }
 }
 
index ed6c7b9d64887970a8ad7837cb00d7d3079c9953..196517f697845e2c7a5d62a162ba0b3f2b27a3d9 100644 (file)
@@ -126,6 +126,18 @@ odl-cluster-data {
       use-dispatcher = cluster-dispatcher
 
       failure-detector.acceptable-heartbeat-pause = 3 s
       use-dispatcher = cluster-dispatcher
 
       failure-detector.acceptable-heartbeat-pause = 3 s
+
+      distributed-data {
+        # How often the Replicator should send out gossip information.
+        # This value controls how quickly Entity Ownership Service data is replicated
+        # across cluster nodes.
+        gossip-interval = 100 ms
+
+        # How often the subscribers will be notified of changes, if any.
+        # This value controls how quickly Entity Ownership Service decisions are
+        # propagated within a node.
+        notify-subscribers-interval = 20 ms
+      }
     }
 
     persistence {
     }
 
     persistence {