camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Bean Expression Performance
Date Mon, 25 Jun 2012 07:00:07 GMT

Yeah we should optimize this. I have logged a JIRA

On Mon, Jun 25, 2012 at 12:13 AM, mhillary <> wrote:
> Hi All,
> I've been investigating some performance issues on a project that's using
> Camel. As part of this I've noticed that bean expressions execute far more
> slowly than expected. For example the following line takes over 1ms in our
> tests whereas using a processor to do the same thing takes something like
> 0.001ms;
> setHeader("key", bean("java.util.UUID", "randomUUID"))
> We measured this by setting a header before the line with the value of
> System.nanoTime() and retrieving this value in the after the line had
> executed. We also ran several 1000's of messages and got the same results
> every time. This doesn't seem to be a problem with bean definitions.
> I've dug into the code and think I've found the problem. When a
> BeanProcessor is created a BeanHolder is also created and kept as a member
> variable. The BeanHolder contains a BeanInfo object that actually performs
> the introspection of the target bean. This means for a BeanProcessor the
> target bean is only introspected once. However for a BeanExpression the
> BeanHolder is created in the evaluate method and therefore a new BeanInfo
> object is created for every message and the target bean gets introspected
> for every message.
> My question is; is there a reason for this or could the BeanExpression
> implementation change to cache the BeanHolder object?
> Thanks,
> Mark Hillary
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message