You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/02/21 14:17:35 UTC

[camel] branch master updated: CAMEL-14604: Update cacheSize docs

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 56b9de8  CAMEL-14604: Update cacheSize docs
56b9de8 is described below

commit 56b9de811218a4e5d3fa83ba0c4988718012eba9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 21 15:17:19 2020 +0100

    CAMEL-14604: Update cacheSize docs
---
 .../resources/org/apache/camel/model/toD.json      |  2 +-
 .../resources/org/apache/camel/model/wireTap.json  |  2 +-
 .../apache/camel/model/ToDynamicDefinition.java    | 34 +++++++++++++++++++---
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/toD.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/toD.json
index 2406cb4..94d8359 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/toD.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/toD.json
@@ -13,7 +13,7 @@
   "properties": {
     "uri": { "kind": "attribute", "displayName": "Uri", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The uri of the endpoint to send to. The uri can be dynamic computed using the org.apache.camel.language.simple.SimpleLanguage expression." },
     "pattern": { "kind": "attribute", "displayName": "Pattern", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOptionalOut", "InOut" ], "deprecated": false, "secret": false, "description": "Sets the optional ExchangePattern used to invoke this endpoint" },
-    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ConsumerCache which is used to cache and reuse producers." },
+    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this recipient list, when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then [...]
     "ignoreInvalidEndpoint": { "kind": "attribute", "displayName": "Ignore Invalid Endpoint", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Ignore the invalidate endpoint exception when try to create a producer with that endpoint" },
     "allowOptimisedComponents": { "kind": "attribute", "displayName": "Allow Optimised Components", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue": true, "description": "Whether to allow components to optimise toD if they are org.apache.camel.spi.SendDynamicAware ." },
     "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the id of this node" },
diff --git a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/wireTap.json b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/wireTap.json
index 31f676e..7238398 100644
--- a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/wireTap.json
+++ b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/wireTap.json
@@ -19,7 +19,7 @@
     "onPrepareRef": { "kind": "attribute", "displayName": "On Prepare Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Uses the Processor when preparing the org.apache.camel.Exchange to be send. This can be used to deep-clone messages that should be send, or any custom logic needed before the exchange is send." },
     "uri": { "kind": "attribute", "displayName": "Uri", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The uri of the endpoint to send to. The uri can be dynamic computed using the org.apache.camel.language.simple.SimpleLanguage expression." },
     "pattern": { "kind": "attribute", "displayName": "Pattern", "required": false, "type": "enum", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOptionalOut", "InOut" ], "deprecated": false, "secret": false, "description": "Sets the optional ExchangePattern used to invoke this endpoint" },
-    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ConsumerCache which is used to cache and reuse producers." },
+    "cacheSize": { "kind": "attribute", "displayName": "Cache Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "description": "Sets the maximum size used by the org.apache.camel.spi.ProducerCache which is used to cache and reuse producers when using this recipient list, when uris are reused. Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic endpoint is unique then [...]
     "ignoreInvalidEndpoint": { "kind": "attribute", "displayName": "Ignore Invalid Endpoint", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Ignore the invalidate endpoint exception when try to create a producer with that endpoint" },
     "allowOptimisedComponents": { "kind": "attribute", "displayName": "Allow Optimised Components", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue": true, "description": "Whether to allow components to optimise toD if they are org.apache.camel.spi.SendDynamicAware ." },
     "id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "Sets the id of this node" },
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/ToDynamicDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/ToDynamicDefinition.java
index 240d540..4afe095 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/ToDynamicDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/ToDynamicDefinition.java
@@ -103,8 +103,21 @@ public class ToDynamicDefinition extends NoOutputDefinition<ToDynamicDefinition>
 
     /**
      * Sets the maximum size used by the
-     * {@link org.apache.camel.spi.ConsumerCache} which is used to cache and
-     * reuse producers.
+     * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
+     * reuse producers when using this recipient list, when uris are reused.
+     *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
      *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.
@@ -116,8 +129,21 @@ public class ToDynamicDefinition extends NoOutputDefinition<ToDynamicDefinition>
 
     /**
      * Sets the maximum size used by the
-     * {@link org.apache.camel.spi.ConsumerCache} which is used to cache and
-     * reuse producers.
+     * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
+     * reuse producers when using this recipient list, when uris are reused.
+     *
+     * Beware that when using dynamic endpoints then it affects how well the cache can be utilized.
+     * If each dynamic endpoint is unique then its best to turn of caching by setting this to -1, which
+     * allows Camel to not cache both the producers and endpoints; they are regarded as prototype scoped
+     * and will be stopped and discarded after use. This reduces memory usage as otherwise producers/endpoints
+     * are stored in memory in the caches.
+     *
+     * However if there are a high degree of dynamic endpoints that have been used before, then it can
+     * benefit to use the cache to reuse both producers and endpoints and therefore the cache size
+     * can be set accordingly or rely on the default size (1000).
+     *
+     * If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size
+     * can help reduce memory usage to avoid storing too many non frequent used producers.
      *
      * @param cacheSize the cache size, use <tt>0</tt> for default cache size,
      *            or <tt>-1</tt> to turn cache off.