Claus Ibsen created CAMEL-26899:
-----------------------------------

             Summary: camel-core - dynamic EIPs: do not normalize the same 
endpoint URI again on every exchange
                 Key: CAMEL-26899
                 URL: https://issues.apache.org/jira/browse/CAMEL-26899
             Project: Camel
          Issue Type: Sub-task
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.25.0


The dynamic EIPs normalize their endpoint URI on every exchange, even when the 
expression gives the same URI every time:

* recipientList, routingSlip and dynamicRouter: 
{{ProcessorHelper.prepareRecipient}} calls 
{{CamelContextExtension.normalizeUri(uri)}}.
* toD, enrich and wireTap: {{SendDynamicProcessor}} creates a 
{{NormalizedUri.newNormalizedUri(uri, false)}}. Enrich always goes through 
SendDynamicProcessor, also for a constant URI.

Measured in CAMEL-25132 (on 4.23.0-SNAPSHOT): 49 ns and 216 B for {{mock:x}}, 
and about 1.3 KB with query parameters.

Idea: a small per-processor cache from the String URI to its normalized form (a 
last-hit entry, or a bounded LRU sized like the producer cache). Things to keep:
* The {{allowedSchemes}} check and the placeholder handling must run as today. 
CAMEL-25810 changes how placeholders in dynamic URIs are resolved in this same 
code: land this after it, and key the cache on the URI as the expression 
returned it.
* Bound the cache, as dynamic URIs can be unbounded (one URI per message).
* Add a test that the same endpoint is resolved, and a micro-benchmark or 
allocation test showing the gain.

Part of CAMEL-26898; see CAMEL-25132 for the method and numbers.

_Claude Code on behalf of davsclaus_




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to