Claus Ibsen created CAMEL-25447:
-----------------------------------
Summary: camel-cli-connector - answer actions in about 100 ms
instead of once a second
Key: CAMEL-25447
URL: https://issues.apache.org/jira/browse/CAMEL-25447
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.24.0
The file transport of camel-cli-connector looks for action files once per loop,
and the loop runs every second (fixed delay 1000 ms) after writing the status
file. So every action to a running integration waits up to a second before the
integration sees it, whatever the client: camel get / camel cmd, the
camel-jbang monitor, the MCP server, camel ask.
Measured (CAMEL-25438): an action takes about 1 s whatever its size
(thread-dump, bean, startup-recorder, type-converters of 41 KB); the status
file is rewritten every ~1015 ms.
Proposal: check for action files on a schedule of its own, about every 100 ms,
on the same single connector thread, and keep the status file (and the trace
task) at its current interval. Debug mode already runs the whole loop at 100 ms.
* Cost: a scan of ~/.camel for <pid>-action*.json, about 0.04 ms with 127 files
there: negligible at 10 per second. No extra thread, no TCP port (unlike the
websocket transport).
* Gain: an action drops from ~1 s to ~0.1 s for every client.
* Care: the connector runs inside every integration that has it (Camel Main,
Spring Boot, Quarkus), so this is a runtime change. A slow action (jfr, up to
30 s) still holds up the loop, as today.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)