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:22:25 UTC
[camel] branch master updated: CAMEL-14596: Update cache size
documentation
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 4a17ef2 CAMEL-14596: Update cache size documentation
4a17ef2 is described below
commit 4a17ef2aa6ce1bbfe60f358b450d483240c62f78
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Feb 21 15:22:06 2020 +0100
CAMEL-14596: Update cache size documentation
---
.../src/main/java/org/apache/camel/DynamicRouter.java | 18 ++++++++++++++++--
.../src/main/java/org/apache/camel/RecipientList.java | 16 +++++++++++++++-
.../src/main/java/org/apache/camel/RoutingSlip.java | 18 ++++++++++++++++--
3 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/core/camel-api/src/main/java/org/apache/camel/DynamicRouter.java b/core/camel-api/src/main/java/org/apache/camel/DynamicRouter.java
index f319ff2..a1be6f7 100644
--- a/core/camel-api/src/main/java/org/apache/camel/DynamicRouter.java
+++ b/core/camel-api/src/main/java/org/apache/camel/DynamicRouter.java
@@ -53,8 +53,22 @@ public @interface DynamicRouter {
boolean ignoreInvalidEndpoints() default false;
/**
- * Sets the maximum size used by the {@link org.apache.camel.spi.ProducerCache} which is used
- * to cache and reuse producers when using this dynamic router, when uris are reused.
+ * Sets the maximum size used by the
+ * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
+ * reuse producers when using this dynamic router, 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.
*/
int cacheSize() default 0;
}
diff --git a/core/camel-api/src/main/java/org/apache/camel/RecipientList.java b/core/camel-api/src/main/java/org/apache/camel/RecipientList.java
index 3e77b51..2e1aa3d 100644
--- a/core/camel-api/src/main/java/org/apache/camel/RecipientList.java
+++ b/core/camel-api/src/main/java/org/apache/camel/RecipientList.java
@@ -120,8 +120,22 @@ public @interface RecipientList {
long timeout() default 0;
/**
- * Sets the maximum size used by the producer cache which is used to cache and
+ * Sets the maximum size used by the
+ * {@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.
*/
int cacheSize() default 0;
diff --git a/core/camel-api/src/main/java/org/apache/camel/RoutingSlip.java b/core/camel-api/src/main/java/org/apache/camel/RoutingSlip.java
index 3fd6acd..927a3e0 100644
--- a/core/camel-api/src/main/java/org/apache/camel/RoutingSlip.java
+++ b/core/camel-api/src/main/java/org/apache/camel/RoutingSlip.java
@@ -55,8 +55,22 @@ public @interface RoutingSlip {
boolean ignoreInvalidEndpoints() default false;
/**
- * Sets the maximum size used by the {@link org.apache.camel.spi.ProducerCache} which is used
- * to cache and reuse producers when using this routing slip, when uris are reused.
+ * Sets the maximum size used by the
+ * {@link org.apache.camel.spi.ProducerCache} which is used to cache and
+ * reuse producers when using this routing slip, 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.
*/
int cacheSize() default 0;