camel-users mailing list archives

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

Yeah we should optimize this. I have logged a JIRA
https://issues.apache.org/jira/browse/CAMEL-5392

On Mon, Jun 25, 2012 at 12:13 AM, mhillary <mark@no33.co.uk> 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: http://camel.465427.n5.nabble.com/Bean-Expression-Performance-tp5715003.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message