Claus Ibsen created CAMEL-26441:
-----------------------------------

             Summary: camel-launcher - The distribution runs the Camel CLI from 
the Spring Boot fat jar, which is slower and has no class data sharing
                 Key: CAMEL-26441
                 URL: https://issues.apache.org/jira/browse/CAMEL-26441
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
            Reporter: Claus Ibsen
             Fix For: 4.24.0


The zip and tar of the Camel CLI (camel-launcher, which Homebrew, SDKMAN, 
WinGet, Scoop, Chocolatey, the web installer and camel self-update install) run 
the Spring Boot fat jar. Its class loader reads the 347 nested jars, which 
costs about 110 ms on every command, and about 280 ms when all commands load. 
The class data sharing archive of the JVM cannot hold classes of that class 
loader either.

Measured (JDK 25, wall clock, median of 9, with CAMEL-26440):
||command||fat jar||lib/||lib/ and a CDS archive||
|camel version|290 ms|176 ms|150 ms|
|camel generate|302 ms|173 ms|150 ms|
|camel --help|785 ms|510 ms|340 ms|

The fix:
* the zip and tar have {{lib/}} with the jars, and a thin 
{{camel-launcher-<version>.jar}} whose manifest has the classpath; 
{{bin/camel.sh}} and {{bin/camel.bat}} run {{java -jar 
lib/camel-launcher-<version>.jar}};
* the scripts add a dynamic CDS archive per command 
({{-XX:+AutoCreateSharedArchive}}, Java 19+) in the cache directory of the 
user, which the JVM creates on the first run of a command and again when the 
JDK changes; {{CAMEL_CDS=false}} turns it off;
* the fat jar stays the Maven artifact, for {{java -jar}} and the container 
image.

The JDK 25 AOT cache may follow later.

Related: CAMEL-23810, CAMEL-26440.

_Claude Code on behalf of davsclaus (Claus Ibsen)_



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

Reply via email to