Claus Ibsen created CAMEL-26935:
-----------------------------------
Summary: camel-jbang - make the Camel CLI faster for AI agents
Key: CAMEL-26935
URL: https://issues.apache.org/jira/browse/CAMEL-26935
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.24.0
Measured on 2026-11-13 with the unpacked 4.24.0-SNAPSHOT camel-launcher on
macOS (Apple M4 Pro, JDK 25), warm CDS archives, medians of 5-9 runs on a
machine with other load (treat as +/-30 %). Estimates are marked as such. Paths
are relative to {{dsl/camel-jbang/}}.
An AI coding agent drives the Camel CLI with many short commands, each a new
JVM. A typical loop of 9 commands (doc, validate yaml, run --background, get
route, get health, get error, cmd send, log, stop) takes *5.96 s* today. For
get, ps, log and doc, 90-98 % of a call is JVM bootstrap: the work itself takes
3-50 ms in a warm JVM.
h3. The loop today
||Command||Wall||Classes||
|doc timer|0.26 s|3,424|
|validate yaml|0.41-0.44 s|4,876|
|run --background|2.75-2.88 s (routes are up at 1.05-1.4 s)|5,005 in the parent|
|ps|0.25 s|3,397|
|get route --json|0.27-0.29 s|3,629|
|cmd send|0.75 s (0.46 s without color)|5,244|
|log --tail=20|0.48 s (0.26 s without color)|3,794|
|stop|0.57-0.66 s|3,241|
{{java -version}} is 0.04 s and {{camel version}} 0.15 s. With an empty cache
the first loop takes 12.3 s and leaves 177 MB of CDS archives.
h3. Where the time goes
* The status file is written every 1 s and {{run --background}} polls it every
500 ms: it returns 1.3-1.7 s after the routes are up.
* {{printColored}} builds a JLine terminal through {{AnsiConsole.out()}} even
when the output is piped: 0.16-0.17 s.
* log4j is initialized only to turn logging off: 0.07-0.09 s, about 790 classes.
* The action protocol polls every 100 ms on both sides: about 0.1 s per {{cmd}}
action, in any client.
* aesh opens all 343 jars on the first resource lookup: about 50 ms (18 ms with
one jar).
* C2 JIT: the user CPU is twice the wall time.
* A CDS archive made by a first call without a running integration lacks
1,400-1,760 classes and is never refreshed.
h3. Sub-tasks
The quick wins (sub-tasks 1-4, plus the C1 part of 2) take the loop from 5.96 s
to about 3 s (estimate built from the measured per-step gains). The bigger
items follow. Related: CAMEL-26913 (startup and config), CAMEL-25388 (agent
readiness), and the bug tickets filed from the same scan.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)