You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/07/25 16:12:33 UTC

activemq-artemis git commit: ARTEMIS-1261 Adjust default confirmation-window-size for bridges

Repository: activemq-artemis
Updated Branches:
  refs/heads/1.x 21f86a484 -> 004c86804


ARTEMIS-1261 Adjust default confirmation-window-size for bridges

The default id-cache-size is 20000 and the default
confirmation-window-size is 1MB. It turns out the 1MB
size is too small for id-cache-size.

To fix it we adjust the confirmation-window-size to 10MB. Also
a test is added to guarantee it won't break this rule when this
default value is to be changed to any new value.

(cherry picked from commit 06986e4ee1eb32fc2642b111ca3955518f684adb)


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/004c8680
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/004c8680
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/004c8680

Branch: refs/heads/1.x
Commit: 004c86804fd2ffbc53d52748a85fb9166afd951e
Parents: 21f86a4
Author: Howard Gao <ho...@gmail.com>
Authored: Thu Jun 29 12:03:38 2017 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Tue Jul 25 12:11:37 2017 -0400

----------------------------------------------------------------------
 .../config/ActiveMQDefaultConfiguration.java    |  4 +--
 .../core/config/impl/ConfigurationImpl.java     | 26 ++++++++++++++++++++
 .../core/server/ActiveMQServerLogger.java       |  6 +++++
 .../cluster/impl/ClusterConnectionImpl.java     |  5 ++++
 4 files changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/004c8680/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
index 5b4a37d..6188dbb 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java
@@ -307,7 +307,7 @@ public final class ActiveMQDefaultConfiguration {
    private static boolean DEFAULT_BRIDGE_DUPLICATE_DETECTION = true;
 
    // Once the bridge has received this many bytes, it sends a confirmation
-   private static int DEFAULT_BRIDGE_CONFIRMATION_WINDOW_SIZE = 1048576;
+   private static int DEFAULT_BRIDGE_CONFIRMATION_WINDOW_SIZE = 1024 * 1024 * 10;
 
    // Producer flow control
    private static int DEFAULT_BRIDGE_PRODUCER_WINDOW_SIZE = -1;
@@ -351,7 +351,7 @@ public final class ActiveMQDefaultConfiguration {
    private static int DEFAULT_CLUSTER_MAX_HOPS = 1;
 
    // The size (in bytes) of the window used for confirming data from the server connected to.
-   private static int DEFAULT_CLUSTER_CONFIRMATION_WINDOW_SIZE = 1048576;
+   private static int DEFAULT_CLUSTER_CONFIRMATION_WINDOW_SIZE = 1024 * 1024 * 10;
 
    // How long to wait for a reply if in the middle of a fail-over. -1 means wait forever.
    private static long DEFAULT_CLUSTER_CALL_FAILOVER_TIMEOUT = -1;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/004c8680/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
index da2e769..e9d5ede 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
@@ -75,6 +75,12 @@ public class ConfigurationImpl implements Configuration, Serializable {
 
    public static final JournalType DEFAULT_JOURNAL_TYPE = JournalType.ASYNCIO;
 
+   private static final int DEFAULT_JMS_MESSAGE_SIZE = 1864;
+
+   private static final int RANGE_SIZE_MIN = 0;
+
+   private static final int RANGE_SZIE_MAX = 4;
+
    private static final long serialVersionUID = 4077088945050267843L;
 
    // Attributes -----------------------------------------------------------------------------
@@ -1983,6 +1989,26 @@ public class ConfigurationImpl implements Configuration, Serializable {
       return this;
    }
 
+   public static boolean checkoutDupCacheSize(final int windowSize, final int idCacheSize) {
+      final int msgNumInFlight = windowSize / DEFAULT_JMS_MESSAGE_SIZE;
+
+      if (msgNumInFlight == 0) {
+         return true;
+      }
+
+      boolean sizeGood = false;
+
+      if (idCacheSize >= msgNumInFlight) {
+         int r = idCacheSize / msgNumInFlight;
+
+         // This setting is here to accomodate the current default setting.
+         if ( (r >= RANGE_SIZE_MIN) && (r <= RANGE_SZIE_MAX)) {
+            sizeGood = true;
+         }
+      }
+      return sizeGood;
+   }
+
    /**
     * It will find the right location of a subFolder, related to artemisInstance
     */

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/004c8680/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
index ed80b37..5ecaee6 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java
@@ -1566,5 +1566,11 @@ public interface ActiveMQServerLogger extends BasicLogger {
    void journalCannotFindPageTX(Long id);
 
 
+   @LogMessage(level = Logger.Level.INFO)
+   @Message(id = 224077, value = "UnDeploying queue {0}", format = Message.Format.MESSAGE_FORMAT)
+   void undeployQueue(SimpleString queueName);
 
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 224078, value = "The size of duplicate cache detection (<id_cache-size/>) appears to be too large {0}. It should be no greater than the number of messages that can be squeezed into conformation buffer (<confirmation-window-size/>) {1}.", format = Message.Format.MESSAGE_FORMAT)
+   void duplicateCacheSizeWarning(int idCacheSize, int confirmationWindowSize);
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/004c8680/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
index 4b9f0b7..9e96053 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java
@@ -45,6 +45,7 @@ import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
 import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal;
 import org.apache.activemq.artemis.core.client.impl.Topology;
 import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
+import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
 import org.apache.activemq.artemis.core.postoffice.Binding;
 import org.apache.activemq.artemis.core.postoffice.Bindings;
 import org.apache.activemq.artemis.core.postoffice.PostOffice;
@@ -814,6 +815,10 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
       if (start) {
          bridge.start();
       }
+
+      if ( !ConfigurationImpl.checkoutDupCacheSize(serverLocator.getConfirmationWindowSize(),server.getConfiguration().getIDCacheSize())) {
+         ActiveMQServerLogger.LOGGER.duplicateCacheSizeWarning(server.getConfiguration().getIDCacheSize(), serverLocator.getConfirmationWindowSize());
+      }
    }
 
    // Inner classes -----------------------------------------------------------------------------------