You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "kraythe ." <kr...@gmail.com> on 2014/05/01 19:04:59 UTC

Re: Fastest Data Holder

The question of efficiency should be thought of in an overall manner. Sure,
the map is faster but when we add on all the serialization, is it really
faster? JSON might be slower on access but the lack of needing to serialize
it all the time has its benefits. This is important if the message will be
crossing through JMS or some other means.

However there is a third option If the data is really large you could
instead use a "Claim Check" EIP pattern. That means you pass around a
reference to a data store external to the route (database, ehcache,
whatever) and then access the data in a route using a claim check. So if
you had a route that stuffed the message in a cache, sent around the check,
then another node could fetch the data out of the cache.

Look at the ehcache and claim check patterns.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Wed, Apr 30, 2014 at 5:13 AM, Muhammad Ichsan <ic...@gmail.com> wrote:

> OK. I really get your point. Great answer!
>
> Thanks
>
> On Wed, Apr 30, 2014 at 5:18 PM, Jens Breitenstein <ma...@j-b-s.de>
> wrote:
> > onder if performance is really a problem? An object makes handling of
> your
> > business logic in all your camel processors far easier (a map, a business
> > related class) in contrast to repeatingly parse XML again and again (in
> case
> > your logic is spread accross multiple processors). If you create an
> instance
> > ones and just send it immediately by JMS simply go for java's default
> > serialization and you are done without writing any additional code until
> > performance really matters
>
>
>
>
> --
> ~The best men are men who benefit to others
> http://www.michsan.web.id 一緒に勉強しましょう!
>
> Yang berkualitas memang beda rasanya!
> http://rizqi-cookies.com
>

Re: Fastest Data Holder

Posted by Muhammad Ichsan <ic...@gmail.com>.
Passing a JSON object across many processors can be costly too. Since the
processors usually parse the object so that they can evaluate its value or
add new values to it.

I think for the case in the same JVM, it's OK to use Java objects like
java.util.Map.
On May 2, 2014 1:05 AM, "kraythe ." <kr...@gmail.com> wrote:

> The question of efficiency should be thought of in an overall manner. Sure,
> the map is faster but when we add on all the serialization, is it really
> faster? JSON might be slower on access but the lack of needing to serialize
> it all the time has its benefits. This is important if the message will be
> crossing through JMS or some other means.
>
> However there is a third option If the data is really large you could
> instead use a "Claim Check" EIP pattern. That means you pass around a
> reference to a data store external to the route (database, ehcache,
> whatever) and then access the data in a route using a claim check. So if
> you had a route that stuffed the message in a cache, sent around the check,
> then another node could fetch the data out of the cache.
>
> Look at the ehcache and claim check patterns.
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
> <http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
>
>
> On Wed, Apr 30, 2014 at 5:13 AM, Muhammad Ichsan <ic...@gmail.com> wrote:
>
> > OK. I really get your point. Great answer!
> >
> > Thanks
> >
> > On Wed, Apr 30, 2014 at 5:18 PM, Jens Breitenstein <mailinglist@j-b-s.de
> >
> > wrote:
> > > onder if performance is really a problem? An object makes handling of
> > your
> > > business logic in all your camel processors far easier (a map, a
> business
> > > related class) in contrast to repeatingly parse XML again and again (in
> > case
> > > your logic is spread accross multiple processors). If you create an
> > instance
> > > ones and just send it immediately by JMS simply go for java's default
> > > serialization and you are done without writing any additional code
> until
> > > performance really matters
> >
> >
> >
> >
> > --
> > ~The best men are men who benefit to others
> > http://www.michsan.web.id 一緒に勉強しましょう!
> >
> > Yang berkualitas memang beda rasanya!
> > http://rizqi-cookies.com
> >
>