Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 32FDC200CC8 for ; Thu, 29 Jun 2017 18:56:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 31F44160BC6; Thu, 29 Jun 2017 16:56:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 59DE0160BED for ; Thu, 29 Jun 2017 18:56:41 +0200 (CEST) Received: (qmail 55720 invoked by uid 500); 29 Jun 2017 16:56:40 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 55703 invoked by uid 99); 29 Jun 2017 16:56:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jun 2017 16:56:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 67F8DE3AA9; Thu, 29 Jun 2017 16:56:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Thu, 29 Jun 2017 16:56:41 -0000 Message-Id: In-Reply-To: <06663c90c5134924800e9918e894b8cb@git.apache.org> References: <06663c90c5134924800e9918e894b8cb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] activemq-artemis git commit: ARTEMIS-1261 Adjust default confirmation-window-size for bridges archived-at: Thu, 29 Jun 2017 16:56:42 -0000 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. Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/06986e4e Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/06986e4e Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/06986e4e Branch: refs/heads/master Commit: 06986e4ee1eb32fc2642b111ca3955518f684adb Parents: aa93214 Author: Howard Gao Authored: Thu Jun 29 12:03:38 2017 +0800 Committer: Clebert Suconic Committed: Thu Jun 29 12:56:16 2017 -0400 ---------------------------------------------------------------------- .../config/ActiveMQDefaultConfiguration.java | 4 +-- .../core/config/impl/ConfigurationImpl.java | 26 ++++++++++++++++++++ .../core/server/ActiveMQServerLogger.java | 4 +++ .../cluster/impl/ClusterConnectionImpl.java | 5 ++++ .../core/config/impl/FileConfigurationTest.java | 9 +++++++ 5 files changed, 46 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06986e4e/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 2ff6a0a..899dc2c 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 @@ -304,7 +304,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; @@ -348,7 +348,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/06986e4e/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 f0a6067..9195cff 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 @@ -79,6 +79,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 ----------------------------------------------------------------------------- @@ -2058,6 +2064,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/06986e4e/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 461c662..431302f 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 @@ -1590,4 +1590,8 @@ public interface ActiveMQServerLogger extends BasicLogger { @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 () appears to be too large {0}. It should be no greater than the number of messages that can be squeezed into conformation buffer () {1}.", format = Message.Format.MESSAGE_FORMAT) + void duplicateCacheSizeWarning(int idCacheSize, int confirmationWindowSize); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06986e4e/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 d267341..2f1fe87 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 @@ -46,6 +46,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; @@ -821,6 +822,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 ----------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/06986e4e/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java index 1d1f53b..ddff9af 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java @@ -634,6 +634,15 @@ public class FileConfigurationTest extends ConfigurationImplTest { assertTrue(brokerPlugins.get(1) instanceof EmptyPlugin2); } + @Test + public void testDefaultConstraints() { + int defaultConfirmationWinSize = ActiveMQDefaultConfiguration.getDefaultClusterConfirmationWindowSize(); + int defaultIdCacheSize = ActiveMQDefaultConfiguration.getDefaultIdCacheSize(); + assertTrue("check failed, " + defaultConfirmationWinSize + ":" + defaultIdCacheSize, ConfigurationImpl.checkoutDupCacheSize(defaultConfirmationWinSize, defaultIdCacheSize)); + defaultConfirmationWinSize = ActiveMQDefaultConfiguration.getDefaultBridgeConfirmationWindowSize(); + assertTrue("check failed, " + defaultConfirmationWinSize + ":" + defaultIdCacheSize, ConfigurationImpl.checkoutDupCacheSize(defaultConfirmationWinSize, defaultIdCacheSize)); + } + @Override protected Configuration createConfiguration() throws Exception { FileConfiguration fc = new FileConfiguration();