Make statistic queue size configurable via config.ini 19/619/1
authorChi-Vien Ly <chivly@cisco.com>
Fri, 19 Jul 2013 17:34:58 +0000 (10:34 -0700)
committerChi-Vien Ly <chivly@cisco.com>
Fri, 19 Jul 2013 17:34:58 +0000 (10:34 -0700)
Currently the queue size is fixed at 64. For large network support, this can't accommodate large network support. This enhancement is to make this size configurable through config.ini. A new system parameter is created "of.statsQueueSize" and is default to 64 (same as today).

Change-Id: I0f9c02ee3228a51ba3ec8ad2047dfff8ddae50a1
Signed-off-by: Chi-Vien Ly <chivly@cisco.com>
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java

index 6bf09bb368678b3be59a652bb192da49df5367e4..b99b4bfdcaf40aefc2aae1daa0c340f97e96d218 100644 (file)
@@ -50,6 +50,8 @@ org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml
 # of.messageResponseTimer=2000
 # The switch liveness timeout value (default 60500 msec)
 # of.switchLivenessTimeout=60500
+# The size of the queue holding pending statistics requests (default 64). For large networks of n switches, it is recommended to set the queue size to n
+# of.statsQueueSize = 64
 # The flow statistics polling interval in second (default 10 sec)
 # of.flowStatsPollInterval=10
 # The port statistics polling interval in second (default 5 sec)
index 3c02c1762875eceb1ba226f8b333584af9b852bf..bae49d511a2f853f61d428f0751ea7b231539831 100644 (file)
@@ -155,6 +155,20 @@ IInventoryShimExternalListener, CommandProvider {
         }
     }
 
+    private short getStatsQueueSize() {
+        String statsQueueSizeStr = System.getProperty("of.statsQueueSize");
+        short statsQueueSize = INITIAL_SIZE;
+        if (statsQueueSizeStr != null) {
+            try {
+                statsQueueSize = Short.parseShort(statsQueueSizeStr);
+                if (statsQueueSize <= 0) {
+                    statsQueueSize = INITIAL_SIZE;
+                }
+            } catch (Exception e) {
+            }
+        }
+        return statsQueueSize;
+    }
     /**
      * Function called by the dependency manager when all the required
      * dependencies are satisfied
@@ -166,8 +180,8 @@ IInventoryShimExternalListener, CommandProvider {
         portStatistics = new ConcurrentHashMap<Long, List<OFStatistics>>();
         tableStatistics = new ConcurrentHashMap<Long, List<OFStatistics>>();
         dummyList = new ArrayList<OFStatistics>(1);
+        pendingStatsRequests = new LinkedBlockingQueue<StatsRequest>(getStatsQueueSize());
         statisticsTimerTicks = new ConcurrentHashMap<Long, StatisticsTicks>(INITIAL_SIZE);
-        pendingStatsRequests = new LinkedBlockingQueue<StatsRequest>(INITIAL_SIZE);
         switchPortStatsUpdated = new LinkedBlockingQueue<Long>(INITIAL_SIZE);
         switchSupportsVendorExtStats = new ConcurrentHashMap<Long, Boolean>(INITIAL_SIZE);
         txRates = new HashMap<Long, Map<Short, TxRates>>(INITIAL_SIZE);