[
https://issues.apache.org/jira/browse/CAMEL-19398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17727942#comment-17727942
]
Otavio Rodolfo Piske commented on CAMEL-19398:
----------------------------------------------
[~davsclaus] thanks for the tip about YourKit profiler. I need to look at it
... I have never used it!
I don't have the test published yet ... I need to clean it up before sending to
the camel-performance repo ... but I can explain a bit about what is happening.
What I found out is that when you send different types of data (String,
integer, File, etc) to a route (in my test, it is a content-based-router), at
some point it tries to convert the data.
This starts in the
[tryConvertTo|https://github.com/apache/camel/blob/main/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java#L289-L340]
method which calls doConvert which eventually calls
[ObjectConverter.toInteger|https://github.com/apache/camel/blob/main/core/camel-base/src/main/java/org/apache/camel/converter/ObjectConverter.java#L191-L194].
The problem is that if the converter throws an exception, that exception then
gets wrapped in other exceptions and then re-thrown. And, because this is
happening most (all??) the time in this scenario ... the impact on performance
is huge.
This will cause a NumberFormatException to be thrown.
i.e.: by implementing a content-based-router)
I investigated further and I actually understood what is happening
> camel-core: type converter performs slowly due to exception-based flow control
> ------------------------------------------------------------------------------
>
> Key: CAMEL-19398
> URL: https://issues.apache.org/jira/browse/CAMEL-19398
> Project: Camel
> Issue Type: Task
> Components: camel-core
> Reporter: Otavio Rodolfo Piske
> Assignee: Otavio Rodolfo Piske
> Priority: Major
> Attachments:
> profile-cbr-text-2023-05-29-4.0.0-SNAPSHOT-2023-05-29-070154.html
>
>
> It looks like, when consuming data of different types, our type converters
> perform extremely slowly. For instance, in a test sending data of different
> types (Strings, Integers, Beans, etc) in a machine that easily routes 800k
> exchanges per sec, with a CBR, it decreases to as much as 49k exchanges/sec.
> Analyzing the frame graphs for this (attached) we can see that there is a
> significant amount of time spent dealing with handling exceptions.
> Camel's ability to use the processing power available in the machine seems to
> be severely affected by this:
> {noformat}
> 39132464047 instructions # 0.80 insn per cycle
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)