From 6e76bb44514ea79524f46ff283ea0d0d4ad8c7f8 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Fri, 12 Feb 2016 09:08:15 -0500 Subject: [PATCH] Bug 5329: Add factory akka.conf Added a factory akka.conf file that is shipped to configuration/factory/akka.conf. This file contains all the necessary akka settings. Modified the FileAkkaConfigurationReader to load the existing configuration/initial/akka.conf file with the factory file as the fallback. In this manner akka will overlay/merge the initial file with the factory file. I pared down the initial file to only contain the settings that users would normally set or configure to setup a cluster, ie hostname, port, seed-nodes, roles. In the features.xml, the factory file is configured to always overwrite so changes are picked up on upgrade. We still preserve the initial file. Change-Id: I8e80161e21d0ad0e26f1efa1023c670b3a5ef6bc Signed-off-by: Tom Pantelis --- features/mdsal/src/main/features/features.xml | 1 + .../actor/FileAkkaConfigurationReader.java | 17 ++-- .../md-sal/sal-clustering-config/pom.xml | 5 ++ .../src/main/resources/initial/akka.conf | 67 +-------------- .../main/resources/initial/factory-akka.conf | 85 +++++++++++++++++++ 5 files changed, 104 insertions(+), 71 deletions(-) create mode 100644 opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf diff --git a/features/mdsal/src/main/features/features.xml b/features/mdsal/src/main/features/features.xml index e8821f232a..489f174bec 100644 --- a/features/mdsal/src/main/features/features.xml +++ b/features/mdsal/src/main/features/features.xml @@ -93,6 +93,7 @@ mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/config mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/entityownershipconfig mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/akkaconf + mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/factoryakkaconf mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleshardconf mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleconf mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/cfg/datastore diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java index 384ba81526..1e3adf9d39 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java @@ -14,12 +14,19 @@ import com.typesafe.config.ConfigFactory; import java.io.File; public class FileAkkaConfigurationReader implements AkkaConfigurationReader { - private static final String DEFAULT_AKKA_CONF_PATH = "./configuration/initial/akka.conf"; + private static final String CUSTOM_AKKA_CONF_PATH = "./configuration/initial/akka.conf"; + private static final String FACTORY_AKKA_CONF_PATH = "./configuration/factory/akka.conf"; - @Override public Config read() { - File configFile = new File(DEFAULT_AKKA_CONF_PATH); - Preconditions.checkState(configFile.exists(), "%s is missing", configFile); - return ConfigFactory.parseFile(configFile); + @Override + public Config read() { + File customConfigFile = new File(CUSTOM_AKKA_CONF_PATH); + Preconditions.checkState(customConfigFile.exists(), "%s is missing", customConfigFile); + File factoryConfigFile = new File(FACTORY_AKKA_CONF_PATH); + if(factoryConfigFile.exists()) { + return ConfigFactory.parseFile(customConfigFile).withFallback(ConfigFactory.parseFile(factoryConfigFile)); + } + + return ConfigFactory.parseFile(customConfigFile); } } diff --git a/opendaylight/md-sal/sal-clustering-config/pom.xml b/opendaylight/md-sal/sal-clustering-config/pom.xml index 48cd1c6ed0..2fd000b6fa 100644 --- a/opendaylight/md-sal/sal-clustering-config/pom.xml +++ b/opendaylight/md-sal/sal-clustering-config/pom.xml @@ -46,6 +46,11 @@ xml akkaconf + + ${project.build.directory}/classes/initial/factory-akka.conf + xml + factoryakkaconf + ${project.build.directory}/classes/initial/module-shards.conf xml diff --git a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf index b15b5bc30c..852171285c 100644 --- a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf +++ b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf @@ -1,87 +1,22 @@ odl-cluster-data { - bounded-mailbox { - mailbox-type = "org.opendaylight.controller.cluster.common.actor.MeteredBoundedMailbox" - mailbox-capacity = 1000 - mailbox-push-timeout-time = 100ms - } - - metric-capture-enabled = true - - notification-dispatcher { - # Dispatcher is the name of the event-based dispatcher - type = Dispatcher - # What kind of ExecutionService to use - executor = "fork-join-executor" - # Configuration for the fork join pool - fork-join-executor { - # Min number of threads to cap factor-based parallelism number to - parallelism-min = 2 - # Parallelism (threads) ... ceil(available processors * factor) - parallelism-factor = 3.0 - # Max number of threads to cap factor-based parallelism number to - parallelism-max = 15 - } - # Throughput defines the maximum number of messages to be - # processed per actor before the thread jumps to the next actor. - # Set to 1 for as fair as possible. - throughput = 1 - } - akka { - loglevel = "INFO" - loggers = ["akka.event.slf4j.Slf4jLogger"] - logger-startup-timeout = 300s - - actor { - provider = "akka.cluster.ClusterActorRefProvider" - serializers { - java = "akka.serialization.JavaSerializer" - proto = "akka.remote.serialization.ProtobufSerializer" - readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer" - } - - serialization-bindings { - "com.google.protobuf.Message" = proto - "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal - } - - default-dispatcher { - # Setting throughput to 1 makes the dispatcher fair. It processes 1 message from - # the mailbox before moving on to the next mailbox - throughput = 1 - } - - default-mailbox { - # When not using a BalancingDispatcher it is recommended that we use the SingleConsumerOnlyUnboundedMailbox - # as it is the most efficient for multiple producer/single consumer use cases - mailbox-type="akka.dispatch.SingleConsumerOnlyUnboundedMailbox" - } - } remote { - log-remote-lifecycle-events = off netty.tcp { hostname = "127.0.0.1" port = 2550 - maximum-frame-size = 419430400 - send-buffer-size = 52428800 - receive-buffer-size = 52428800 } } cluster { seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:2550"] - - seed-node-timeout = 12s - - auto-down-unreachable-after = 30s roles = [ "member-1" ] } - + persistence { # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by # modifying the following two properties. The directory location specified may be a relative or absolute path. 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 new file mode 100644 index 0000000000..eb4903e552 --- /dev/null +++ b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf @@ -0,0 +1,85 @@ + +odl-cluster-data { + bounded-mailbox { + mailbox-type = "org.opendaylight.controller.cluster.common.actor.MeteredBoundedMailbox" + mailbox-capacity = 1000 + mailbox-push-timeout-time = 100ms + } + + metric-capture-enabled = true + + notification-dispatcher { + # Dispatcher is the name of the event-based dispatcher + type = Dispatcher + # What kind of ExecutionService to use + executor = "fork-join-executor" + # Configuration for the fork join pool + fork-join-executor { + # Min number of threads to cap factor-based parallelism number to + parallelism-min = 2 + # Parallelism (threads) ... ceil(available processors * factor) + parallelism-factor = 3.0 + # Max number of threads to cap factor-based parallelism number to + parallelism-max = 15 + } + # Throughput defines the maximum number of messages to be + # processed per actor before the thread jumps to the next actor. + # Set to 1 for as fair as possible. + throughput = 1 + } + + akka { + loglevel = "INFO" + loggers = ["akka.event.slf4j.Slf4jLogger"] + logger-startup-timeout = 300s + + actor { + provider = "akka.cluster.ClusterActorRefProvider" + serializers { + java = "akka.serialization.JavaSerializer" + proto = "akka.remote.serialization.ProtobufSerializer" + readylocal = "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransactionSerializer" + } + + serialization-bindings { + "com.google.protobuf.Message" = proto + "org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction" = readylocal + } + + default-dispatcher { + # Setting throughput to 1 makes the dispatcher fair. It processes 1 message from + # the mailbox before moving on to the next mailbox + throughput = 1 + } + + default-mailbox { + # When not using a BalancingDispatcher it is recommended that we use the SingleConsumerOnlyUnboundedMailbox + # as it is the most efficient for multiple producer/single consumer use cases + mailbox-type="akka.dispatch.SingleConsumerOnlyUnboundedMailbox" + } + } + remote { + log-remote-lifecycle-events = off + netty.tcp { + hostname = "127.0.0.1" + port = 2550 + maximum-frame-size = 419430400 + send-buffer-size = 52428800 + receive-buffer-size = 52428800 + } + } + + cluster { + seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:2550"] + + seed-node-timeout = 12s + + auto-down-unreachable-after = 30s + + roles = [ + "member-1" + ] + + } + } +} -- 2.36.6