From 3a526427c93dc44700ca476e57f0cea6eadfb2a7 Mon Sep 17 00:00:00 2001 From: Tomas Cere Date: Tue, 19 Oct 2021 10:54:47 +0200 Subject: [PATCH] Tune eos gossip/notification intervals 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 Signed-off-by: Robert Varga --- opendaylight/md-sal/eos-dom-akka/pom.xml | 11 +++++++++++ .../eos/akka/AbstractNativeEosTest.java | 16 +++++++++++++++- .../controller/eos/akka/SingleNodeTest.java | 2 ++ .../service/ClusterSingletonIntegrationTest.java | 6 +++--- .../src/test/resources/application.conf | 12 ++++++++++++ .../src/main/resources/initial/factory-akka.conf | 12 ++++++++++++ 6 files changed, 55 insertions(+), 4 deletions(-) rename opendaylight/md-sal/{sal-distributed-eos-native/src/test/java/org/opendaylight/controller/cluster/akka/eos => eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka}/service/ClusterSingletonIntegrationTest.java (97%) diff --git a/opendaylight/md-sal/eos-dom-akka/pom.xml b/opendaylight/md-sal/eos-dom-akka/pom.xml index 64cdc00f6f..39a57ca154 100644 --- a/opendaylight/md-sal/eos-dom-akka/pom.xml +++ b/opendaylight/md-sal/eos-dom-akka/pom.xml @@ -90,5 +90,16 @@ org.awaitility awaitility + + + org.opendaylight.mdsal + mdsal-singleton-common-api + test + + + org.opendaylight.mdsal + mdsal-singleton-dom-impl + test + diff --git a/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/AbstractNativeEosTest.java b/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/AbstractNativeEosTest.java index 576a9c1d12..5af0e2afdb 100644 --- a/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/AbstractNativeEosTest.java +++ b/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/AbstractNativeEosTest.java @@ -288,7 +288,17 @@ public abstract class AbstractNativeEosTest { } 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 { @@ -367,6 +377,10 @@ public abstract class AbstractNativeEosTest { public List getChanges() { return changes; } + + public void resetListener() { + changes.clear(); + } } protected static final class MockNativeEntityOwnershipService extends AkkaEntityOwnershipService { diff --git a/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/SingleNodeTest.java b/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/SingleNodeTest.java index 4d04530b10..e4971785f3 100644 --- a/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/SingleNodeTest.java +++ b/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/SingleNodeTest.java @@ -53,6 +53,7 @@ public class SingleNodeTest extends AbstractNativeEosTest { 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); @@ -68,6 +69,7 @@ public class SingleNodeTest extends AbstractNativeEosTest { 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); diff --git a/opendaylight/md-sal/sal-distributed-eos-native/src/test/java/org/opendaylight/controller/cluster/akka/eos/service/ClusterSingletonIntegrationTest.java b/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/service/ClusterSingletonIntegrationTest.java similarity index 97% rename from opendaylight/md-sal/sal-distributed-eos-native/src/test/java/org/opendaylight/controller/cluster/akka/eos/service/ClusterSingletonIntegrationTest.java rename to opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/service/ClusterSingletonIntegrationTest.java index bef4304460..90bfb88b20 100644 --- a/opendaylight/md-sal/sal-distributed-eos-native/src/test/java/org/opendaylight/controller/cluster/akka/eos/service/ClusterSingletonIntegrationTest.java +++ b/opendaylight/md-sal/eos-dom-akka/src/test/java/org/opendaylight/controller/eos/akka/service/ClusterSingletonIntegrationTest.java @@ -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 */ -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; @@ -27,7 +27,7 @@ import org.awaitility.Awaitility; 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; @@ -40,7 +40,7 @@ public class ClusterSingletonIntegrationTest extends AbstractNativeEosTest { private static final Logger LOG = LoggerFactory.getLogger(ClusterSingletonIntegrationTest.class); - private MockNativeEntityOwnershipService node1; + private AbstractNativeEosTest.MockNativeEntityOwnershipService node1; private MockNativeEntityOwnershipService node2; private MockNativeEntityOwnershipService node3; diff --git a/opendaylight/md-sal/eos-dom-akka/src/test/resources/application.conf b/opendaylight/md-sal/eos-dom-akka/src/test/resources/application.conf index 71c983a3fc..ff23633e5e 100644 --- a/opendaylight/md-sal/eos-dom-akka/src/test/resources/application.conf +++ b/opendaylight/md-sal/eos-dom-akka/src/test/resources/application.conf @@ -20,6 +20,18 @@ akka { "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 + } } } diff --git a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf index ed6c7b9d64..196517f697 100644 --- a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf +++ b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf @@ -126,6 +126,18 @@ odl-cluster-data { 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 { -- 2.36.6