ammachado opened a new pull request, #31383: URL: https://github.com/apache/camel/pull/31383
# Description A fourth round on [CAMEL-26818](https://issues.apache.org/jira/browse/CAMEL-26818), driven by measurements of the module (surefire reports per class and per fork) and JFR profiles of its slowest classes. Test code only. ## Changes - **`SemanticCommandTest`: 16.3 s -> 2.6 s.** The JFR profile showed almost no CPU: the class was waiting. The responder that plays the integration waits three times per request with Awaitility. In Awaitility 4.3.0, the default fixed poll interval of 100 ms is also the poll delay (`ConditionFactory.definePollDelay`), so each wait slept 100 ms before it looked, even when the file was already there: about 300 ms for each of ~48 requests. The waits poll every 10 ms, as `ActionCommandTestSupport` and `DebugCommandTest` already do. - **`CatalogDocExamplesTest`: 15.6 s -> about 10 s.** `new DefaultCamelCatalog()` has no cache (`this(false)`), so each of the 1700+ examples parsed the JSON of its components again: 92% of the CPU of the test. The test catalog is created with the cache, as `CatalogLoader` does for the catalogs of the CLI. The parallel stream removed in the review of #30215 stays out. ## Measurements (18-core Mac, full module, both surefire executions, 3517 tests, all green) | | wall | user CPU | |---|---|---| | before (2 runs) | 83 s (with recompile) / 69 s | 244 s / 199 s | | after (2 runs) | 79 s (with recompile) / 70 s | 241 s / 210 s | | after, `-Dcamel.surefire.forkCount=8` (1 run) | **44 s** | 224 s | The module wall time barely moves with 4 forks, for a reason worth knowing before the next round: - The 4 forks are **already balanced**: each is busy 54-58 s and they finish within ~3 s of each other. The serial fork has ~1 s of work left. Reordering or untagging serial tests would not help. - Each fork is **CPU bound on one core** (~200 s CPU over ~55 s, i.e. ~3.6 busy cores), so a class made faster only shortens the module by roughly its saving divided by 4. - **`forkCount=8` gives 44 s instead of ~70 s for +7% CPU.** 65a17aff6dc5 found no gain at 8 and 12 because the serial tail was the bottleneck then; that tail is gone now. This PR leaves the pom at 4 forks, since 4 was chosen to spare CPU on CI and I do not know the core count of the CI machines. @apupier, your call whether to raise it. ## Looked at and not changed - Exports are the largest remaining cost (~63 s of ~219 s of class time). About half of an export is `Exporter.runSilently` (the KameletMain dry run that finds the dependencies). For Spring Boot, ~24% more is `SpringBootExporter.createMavenPom`: each export loads a new Spring Boot catalog, and `modelFromMavenGAV` scans and parses the component JSON of that fresh catalog for each dependency. A memo of the starter lookup saved only ~1 s (most lookups are first-time misses), so it is not included. Caching the loaded catalog per version would help more but keeps downloaded classloaders alive for the JVM. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. Not from the root folder: `dsl/camel-jbang/camel-jbang-core` was built and tested (`mvn test`, which formats the sources) and `mvn formatter:format impsort:sort` was run on it; `git status` was clean afterwards. The change touches two test classes only. # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. 🤖 Generated with [Claude Code](https://claude.com/claude-code) on behalf of Adriano Machado (@ammachado) _This was generated by an AI agent and may contain inaccuracies. Please verify before relying on it._ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
