Enterprise Java

Apache Camel 3.1 – More camel-core optimizations coming (Part 3)

I have previously blogged about the optimizations we are doing in the next Camel 3.1 release

Today I wanted to give a short update on the latest development we have done, as we are closing down on being ready to build and release Camel 3.1 as early as end of this week or the following.

Since part 2, we managed to find additional 10% reduction on object allocations during routing.

We have also continued the effort of configuring Camel via source code generated configurers that performs direct Java method calls vs using java bean reflections. Now all components, data formats, languages, and EIP patterns is complete. Only in more advanced use-cases where configuration is based on nested complex objects that are dynamically configured would be outside the scope of the source code configures and Camel fallback to use reflection.

We also found a way to optimize property placeholder resolution on EIPs to avoid using source code generated configurers which means that there are 200 classes less to load on the classpath, and about 90kb of memory is saved. This is great as these classes and memory were only used during bootstrap of Camel, and now they are all gone.

We also managed to further modulaize camel-core, so JAXB and XML routes are optional.

Even for XML routes (not Spring or Blueprint as they have their own DOM XML parser) we have created an alternative, fast and light-weight pull based parser. The camel-example-main-xml is using this and by comparing JAXB vs Camel XML then its 6x faster (approx 1500 millis vs 250) and loads 700 classes less than JAXB.

However for non XML users (eg using Java DSL) then JAXB can be avoided on the classpath at all, and you can have tiny Camel applications, such as camel-example-main-tiny with the following dependency tree (
bold are Camel JARs; the example uses the bean and timer components)

[INFO] org.apache.camel.example:camel-example-main-tiny:jar:3.1.0-SNAPSHOT

[INFO] +- org.apache.camel:camel-main:jar:3.1.0-SNAPSHOT:compile

[INFO] |  +- org.apache.camel:camel-api:jar:3.1.0-SNAPSHOT:compile

[INFO] |  +- org.apache.camel:camel-base:jar:3.1.0-SNAPSHOT:compile

[INFO] |  +- org.apache.camel:camel-core-engine:jar:3.1.0-SNAPSHOT:compile

[INFO] |  +- org.apache.camel:camel-management-api:jar:3.1.0-SNAPSHOT:compile

[INFO] |  +- org.apache.camel:camel-support:jar:3.1.0-SNAPSHOT:compile

[INFO] |  \- org.apache.camel:camel-util:jar:3.1.0-SNAPSHOT:compile

[INFO] +- org.apache.camel:camel-bean:jar:3.1.0-SNAPSHOT:compile

[INFO] +- org.apache.camel:camel-timer:jar:3.1.0-SNAPSHOT:compile

[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.13.0:compile

[INFO] +- ch.qos.logback:logback-core:jar:1.2.3:compile

[INFO] \- ch.qos.logback:logback-classic:jar:1.2.3:compile

[INFO]    \- org.slf4j:slf4j-api:jar:1.7.30:compile

I ran this example with the profiler and configured it to use 10MB as max heap (-Xmx10M) and as the summary shows this can easily be done. About 5mb is used in the heap.

There has also been a few other minor improvements to avoid using Camel 2.x based type converter scanning by default. This reduces a scan on the classpath.

Okay its time to end this blog series and finish up the last bits so we can get Camel 3.1 released.

Published on Java Code Geeks with permission by Claus Ibsen, partner at our JCG program. See the original article here: Apache Camel 3.1 – More camel-core optimizations coming (Part 3)

Opinions expressed by Java Code Geeks contributors are their own.

Claus Ibsen

Claus Ibsen is a principal software engineer from Red Hat. Claus is working full time as Apache Camel committer. And is author of the "Camel in Action" book.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
ElenaGillbert
4 years ago

Hi…
We have also continued the effort of configuring Camel via source code generated configurers that performs direct Java method calls vs using java bean reflections. Now all components, data formats, languages, and EIP patterns is complete. Only in more advanced use-cases where configuration is based on nested complex objects that are dynamically configured would be outside the scope of the source code configures and Camel fallback to use reflection.

Back to top button