[
https://issues.apache.org/jira/browse/CAMEL-28062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-28062 started by Aurélien Pupier.
-----------------------------------------------
> camel-core - DefaultShutdownStrategy: a graceful stop or suspend waits a full
> second for inflight exchanges that complete within milliseconds
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-28062
> URL: https://issues.apache.org/jira/browse/CAMEL-28062
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Aurélien Pupier
> Assignee: Aurélien Pupier
> Priority: Major
>
> When a route is stopped or suspended while exchanges are inflight,
> {{DefaultShutdownStrategy}} checks the inflight count and then sleeps a
> hard-coded 1 second ({{loopDelaySeconds = 1}}) before it checks again. An
> inflight exchange that completes after a few milliseconds still costs the
> whole second: every graceful stop, suspend, route reload or context shutdown
> with an inflight exchange takes at least 1 second more than needed.
> Found while investigating the test time of camel-aws2-kinesis (CAMEL-28061):
> the 11 tests of {{KinesisConsumerSuspendedBatchTest}} and its subclass each
> stop or suspend a route with an inflight exchange, and each one lost about 1
> second in this wait.
> Measured with a temporary experiment (system property for the poll interval,
> the INFO line "Waiting as there are still N inflight and pending
> exchanges..." still logged once per second):
> ||poll interval||SuspendedBatchTest (5
> tests)||SuspendedBatchPooledExchangeTest (6 tests)||per test||
> |1000 ms (today)|5.93 s|8.21 s|~1.22 s|
> |100 ms|1.84 s|3.20 s|~0.33 s|
> |50 ms|1.64 s|3.01 s|~0.30 s|
> |10 ms|1.43 s|2.81 s|~0.25 s|
> So 100 ms saves about 9 s of the 14 s of these two classes, and 10 ms only
> about 1 s more.
> Proposal:
> * poll the inflight exchanges at a short interval (about 100 ms), and keep
> the INFO message once per second, so the log output and its "timeout in N
> seconds" text do not change;
> * decide whether the interval is a new option of the shutdown strategy (for
> instance on {{ShutdownStrategy}} / {{camel.main.shutdown...}}), or just a
> constant;
> * run the tests of the whole project before and after, to compare the time
> and to find the tests that relied on the 1 second pacing.
> The poll adds no work for a shutdown without inflight exchanges (the loop
> ends at the first check).
> _Created by Bob (AI assistant) on behalf of Aurélien Pupier (apupier)._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)