BUG 7310: Add configurable option to skip columns 68/49068/2
authorVishal Thapar <vishal.thapar@ericsson.com>
Wed, 7 Dec 2016 06:41:45 +0000 (12:11 +0530)
committerVishal Thapar <vishal.thapar@ericsson.com>
Thu, 22 Dec 2016 14:45:07 +0000 (20:15 +0530)
Adds a new cfg file to configure table columns to be skipped when monitoring updates from OVS
switch. Currently following tables and columns are configurable:

1. Manager: status

Change-Id: I6d869ca559cb69374dcdf75b60282c105af85806
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
southbound/southbound-features/pom.xml
southbound/southbound-features/src/main/features/features.xml
southbound/southbound-impl/pom.xml
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundConstants.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java
southbound/southbound-impl/src/main/resources/initial/southbound.cfg [new file with mode: 0644]
southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml

index e3491540d7339e9b5c2146518541f74d00159cab..946828a6a3c636452c6261c71d305275b5944001 100644 (file)
@@ -106,6 +106,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <artifactId>southbound-impl</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>southbound-impl</artifactId>
+      <version>${project.version}</version>
+      <type>cfg</type>
+      <classifier>config</classifier>
+    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>southbound-api</artifactId>
index 11d953dbf5fc7fafab2873649ccd0f9e4d03538a..123f2ac68f78369ad9b2c48ac68e5bcf122e3df6 100644 (file)
@@ -50,5 +50,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <feature version="${project.version}">odl-ovsdb-southbound-impl</feature>
     <bundle>mvn:org.opendaylight.ovsdb/utils.mdsal-utils/{{VERSION}}</bundle>
     <bundle>mvn:org.opendaylight.ovsdb/utils.southbound-utils/{{VERSION}}</bundle>
+    <configfile finalname="etc/org.opendaylight.ovsdb.southbound.cfg">mvn:org.opendaylight.ovsdb/southbound-impl/{{VERSION}}/cfg/config</configfile>
   </feature>
 </features>
index c4bece1dd5fe853b971521b86627a0137b7a802b..a451ca2ee3f1f03b81e77eb7dae89c4931925bbe 100644 (file)
@@ -145,6 +145,28 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           </properties>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/initial/southbound.cfg</file>
+                  <type>cfg</type>
+                  <classifier>config</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
index fdf6d2a1dd67bd1af166b7ac8623e98f3797673b..6e9665004e6947820f1374a3cbcab01e98282da5 100644 (file)
@@ -70,9 +70,9 @@ import org.slf4j.LoggerFactory;
 
 public class OvsdbConnectionInstance {
     private static final Logger LOG = LoggerFactory.getLogger(OvsdbConnectionInstance.class);
-    private OvsdbClient client;
+    private final OvsdbClient client;
     private ConnectionInfo connectionInfo;
-    private TransactionInvoker txInvoker;
+    private final TransactionInvoker txInvoker;
     private Map<DatabaseSchema,TransactInvoker> transactInvokers;
     private MonitorCallBack callback;
     private InstanceIdentifier<Node> instanceIdentifier;
index b6a6713f63e532184509a02754cf0589febc2482..7e4db86d40b7a9700e62e7f3b6a9264520df6a83 100755 (executable)
@@ -11,6 +11,7 @@ import com.google.common.collect.ImmutableBiMap;
 import com.google.common.collect.ImmutableCollection;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -153,11 +154,12 @@ public class SouthboundConstants {
 
     //Note: _version is an internal column of ovsdb schema, that gets updated
     //with every change in the row of the table.
+    // The "Manager" entry needs to be a modifiable list, SouthboundProvider::setSkipManagerStatus() modifies it
     static final ImmutableMap<String,List<String>> SKIP_COLUMN_FROM_TABLE
             = new ImmutableMap.Builder<String,List<String>>()
             .put("Open_vSwitch", Arrays.asList("statistics","_version"))
             .put("Port", Arrays.asList("statistics","_version"))
-            .put("Manager", Collections.singletonList("_version"))
+            .put("Manager", new ArrayList<>(Collections.singletonList("_version")))
             .put("SSL", Collections.singletonList("_version"))
             .put("QoS", Collections.singletonList("_version"))
             .put("Queue", Collections.singletonList("_version"))
index 0756378e0d10967be466b1379bbc66cf44874f00..4fff92754af2a486e178c70e8d33beb0b9d846b7 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.ovsdb.southbound;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
+import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
@@ -48,11 +49,12 @@ public class SouthboundProvider implements AutoCloseable {
     private OvsdbConnectionManager cm;
     private TransactionInvoker txInvoker;
     private OvsdbDataTreeChangeListener ovsdbDataTreeChangeListener;
-    private EntityOwnershipService entityOwnershipService;
+    private final EntityOwnershipService entityOwnershipService;
     private EntityOwnershipCandidateRegistration registration;
     private SouthboundPluginInstanceEntityOwnershipListener providerOwnershipChangeListener;
-    private OvsdbConnection ovsdbConnection;
+    private final OvsdbConnection ovsdbConnection;
     private final InstanceIdentifierCodec instanceIdentifierCodec;
+    private static final String SKIP_MONITORING_MANAGER_STATUS_PARAM = "skip-monitoring-manager-status";
 
     public SouthboundProvider(final DataBroker dataBroker,
             final EntityOwnershipService entityOwnershipServiceDependency,
@@ -145,8 +147,8 @@ public class SouthboundProvider implements AutoCloseable {
     }
 
     private class SouthboundPluginInstanceEntityOwnershipListener implements EntityOwnershipListener {
-        private SouthboundProvider sp;
-        private EntityOwnershipListenerRegistration listenerRegistration;
+        private final SouthboundProvider sp;
+        private final EntityOwnershipListenerRegistration listenerRegistration;
 
         SouthboundPluginInstanceEntityOwnershipListener(SouthboundProvider sp,
                 EntityOwnershipService entityOwnershipService) {
@@ -164,4 +166,24 @@ public class SouthboundProvider implements AutoCloseable {
         }
     }
 
+    public void updateConfigParameter(Map<String, Object> configParameters) {
+        if (configParameters != null && !configParameters.isEmpty()) {
+            LOG.debug("Config parameters received : {}", configParameters.entrySet());
+            for (Map.Entry<String, Object> paramEntry : configParameters.entrySet()) {
+                if (paramEntry.getKey().equalsIgnoreCase(SKIP_MONITORING_MANAGER_STATUS_PARAM)) {
+                    setSkipMonitoringManagerStatus(Boolean.parseBoolean((String)paramEntry.getValue()));
+                    break;
+                }
+            }
+        }
+    }
+
+    public void setSkipMonitoringManagerStatus(boolean flag) {
+        LOG.debug("skipManagerStatus set to {}", flag);
+        if (flag) {
+            SouthboundConstants.SKIP_COLUMN_FROM_TABLE.get("Manager").add("status");
+        } else {
+            SouthboundConstants.SKIP_COLUMN_FROM_TABLE.get("Manager").remove("status");
+        }
+    }
 }
diff --git a/southbound/southbound-impl/src/main/resources/initial/southbound.cfg b/southbound/southbound-impl/src/main/resources/initial/southbound.cfg
new file mode 100644 (file)
index 0000000..1299870
--- /dev/null
@@ -0,0 +1,14 @@
+######################################################
+# Performance Tuning Configuration Parameters        #
+######################################################
+# Setting "skip-monitoring-manager-status" value to "true" will skip
+# monitoring of "status" column of OVSDB database "Manager"
+# table of OVS switch. By default monitoring of the column is #enabled (default value "false").
+# NOTE: Setting it to true will reduce the number of updates
+# received by OVSDB plugin from OVS, that eventually help in
+# improving the performance of OVSDB southbound plugin.
+# However, it will impact functionality in a clustered HA
+# setup. So please use this option when you are running OVSDB
+# southbound plugin in single node and want to achieve better
+# performance.
+#skip-monitoring-manager-status = false
index e8fe07d7622ef417d7f5f1b6cb5dc198432ed1e3..824570c96a3c89e341ac3c3038f5093b2f8e6c89 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
   xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
   odl:use-default-for-reference-types="true">
 
   <reference id="dataBroker"
   <reference id="bindingNormalizedNodeSerializer"
     interface="org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer" />
 
+  <cm:property-placeholder persistent-id="org.opendaylight.ovsdb.southbound" update-strategy="none">
+    <cm:default-properties>
+      <cm:property name="skip-monitoring-manager-status" value="false"/>
+    </cm:default-properties>
+  </cm:property-placeholder>
+
   <bean id="southboundProvider"
     class="org.opendaylight.ovsdb.southbound.SouthboundProvider"
     init-method="init" destroy-method="close">
+   <cm:managed-properties persistent-id="org.opendaylight.ovsdb.southbound"
+                           update-strategy="component-managed"
+                           update-method="updateConfigParameter"/>
     <argument ref="dataBroker" />
     <argument ref="eos" />
     <argument ref="ovsdbConnection" />
     <argument ref="schemaService" />
     <argument ref="bindingNormalizedNodeSerializer" />
+    <property name="skipMonitoringManagerStatus" value="${skip-monitoring-manager-status}"/>
   </bean>
 
 </blueprint>