Federico Mariani created CAMEL-25267:
----------------------------------------

             Summary: camel-management - ManagedRoute.processorIds is 
quadratic, the route dev console with processors takes seconds on large 
integrations
                 Key: CAMEL-25267
                 URL: https://issues.apache.org/jira/browse/CAMEL-25267
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Federico Mariani


{{ManagedRoute.processorIds()}} queries the JMX MBeans of *all* processors of 
the CamelContext, creates a proxy for each one and keeps those of its own 
route. The route dev console with {{processors=true}} calls it for every route 
({{RouteDevConsole.includeProcessorsJson}}), so it creates routes × processors 
proxies: quadratic in the size of the integration.

With 316 YAML routes (about 4000 processors) one call of the route console with 
{{processors=true}} took about 30 s (thread dumps show the time in 
{{DefaultManagementAgent.newProxyClient}} / {{isRegistered}} under 
{{ManagedRoute.processorIds}}).

Who is affected:
* camel-cli-connector collects this as part of the status snapshot: every poll 
of the file transport (so {{camel get}} / {{camel cmd}} are delayed by the same 
amount, the connector thread is busy almost all the time) and every snapshot of 
the WebSocket transport (CAMEL-25197, where it starved the heartbeat).
* anything else calling {{processorIds()}} per route (e.g. the {{route}} dev 
console over HTTP, JMX clients).

Possible fixes:
* collect the processor ids of a route from the route itself (its processors / 
model) instead of a JMX query of the whole context, or query only once and 
group by route id;
* avoid one {{newProxyClient}} per processor when only the id and route id are 
needed.

Reproducer: a Camel Main application with a few hundred routes of ~10 
processors each, JMX enabled, then call the route dev console with 
{{processors=true}} (or run it with camel-cli-connector and look at the status).

_Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to