You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Edwin <ed...@gmail.com> on 2013/11/06 19:17:03 UTC

Performance impact of using streamCache="true" in a route

Hi Folks,

I'm using the CXFRS component in my route. I parse the response from a
webservice to extract 2 elements. I extracted the first element successfully
however, I receive a SAXParseException - premature end of file when an
attempt is made to extract the 2nd element. 

After reading online, I found that the response input stream can only be
read once and in order to read from it multiple times I should set
streamCache=true at the route level.

I'm wondering does this approach have much of an impact on performance?

Any thoughts are much appreciated.

Thanks,
Edwin 



--
View this message in context: http://camel.465427.n5.nabble.com/Performance-impact-of-using-streamCache-true-in-a-route-tp5742736.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Performance impact of using streamCache="true" in a route

Posted by Claus Ibsen <cl...@gmail.com>.
I guess only when the original stream is cached there may be a need
for more memory when the conversion undergoes.

Though from that point onwards you only keep one representation of the
data in-memory. Its just a CachedStream from Camel instead of
InputStream.

Mind that Camel will overflow big streams to disk by default. You can
configure this threshold or turn it off.


On Thu, Nov 7, 2013 at 11:57 AM, Edwin <ed...@gmail.com> wrote:
> Apologies, I should have been more specific on the concerns I have around
> performance. My route won't be writing any data to disk. I'm more concerned
> about the impact on the memory footprint of the route while stream cache is
> enabled.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Performance-impact-of-using-streamCache-true-in-a-route-tp5742736p5742777.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Performance impact of using streamCache="true" in a route

Posted by Edwin <ed...@gmail.com>.
Apologies, I should have been more specific on the concerns I have around
performance. My route won't be writing any data to disk. I'm more concerned
about the impact on the memory footprint of the route while stream cache is
enabled. 



--
View this message in context: http://camel.465427.n5.nabble.com/Performance-impact-of-using-streamCache-true-in-a-route-tp5742736p5742777.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Performance impact of using streamCache="true" in a route

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Not sure if you can say as there is much of an overhead, as you need
to access the data 2 times. And the incoming message is streamed so
you can only access it once. So to support the use-case you would
have to convert the data into a format you can re-read it.

The overhead comes if you spool the data to disk. There is a size
limit that triggers spooling to disk when you enable the stream cache.
You can read about it at the Camel web site.

On Wed, Nov 6, 2013 at 7:17 PM, Edwin <ed...@gmail.com> wrote:
> Hi Folks,
>
> I'm using the CXFRS component in my route. I parse the response from a
> webservice to extract 2 elements. I extracted the first element successfully
> however, I receive a SAXParseException - premature end of file when an
> attempt is made to extract the 2nd element.
>
> After reading online, I found that the response input stream can only be
> read once and in order to read from it multiple times I should set
> streamCache=true at the route level.
>
> I'm wondering does this approach have much of an impact on performance?
>
> Any thoughts are much appreciated.
>
> Thanks,
> Edwin
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Performance-impact-of-using-streamCache-true-in-a-route-tp5742736.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen