[ 
https://issues.apache.org/jira/browse/CAMEL-26936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-26936 started by Claus Ibsen.
-------------------------------------------
> camel-jbang - camel run --background and camel_run report readiness up to 1.5 
> s late
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26936
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26936
>             Project: Camel
>          Issue Type: Sub-task
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             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/}}.
> {{run --background}} returns at 2.75-2.88 s, while the routes are started at 
> 1.05-1.40 s (10 runs, connector lag 0.83-0.89 s every time):
> * {{FileCliConnectorTransport}} writes the status file every 1 s ({{delay = 
> 1000}}, line 75), and its first {{statusTask()}} runs before the context has 
> started.
> * {{Run.runBackgroundProcess}} polls the status file every 500 ms (around 
> line 1358).
> * The MCP and TUI {{IntegrationLauncher}} polls the same file every 250 ms 
> ({{started()}} line 359, poll line 240), so {{camel_run}} has the same lag.
> Proposal:
> * Write the status file when the context has started (event driven), and 
> after each action, so a {{camel get}} right after a {{camel cmd}} is not 
> stale (today it shows the old totals in 3 of 4 tries).
> * Poll at 50-100 ms in {{runBackgroundProcess}} and {{IntegrationLauncher}}.
> Expected: -1.2 to -1.5 s per run (estimate from the measured lag plus the 
> average poll wait).
> Related, measured separately: the parent configures the whole run before it 
> forks ({{ProjectRunner.configure}} at Run.java:815, 5,005 classes, 
> {{--background-wait=false}} still 0.66-0.74 s), and on macOS a JVM that exits 
> while its child lives costs +0.3 s (a double fork takes 0.04 s). Forking 
> first and a double fork would save a further 0.3-0.6 s (estimate).
> _Claude Code on behalf of Claus Ibsen_



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

Reply via email to