You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by ladoe00 <la...@yahoo.com> on 2013/04/22 19:11:20 UTC

Little ProducerCache performance improvement when dealing with long URIs

Hi,

  While working on a new Camel component
(https://issues.apache.org/jira/browse/CAMEL-5828) and doing a speed
comparison between SEDA and DISRUPTOR endpoints, we ran into a test that
would take a lot more time then expected.  This test was about using a SEDA
endpoint with a lot of parameters defined.  In this test, we are sending a
lot of exchanges (1,000,000) using a ProducerTemplate and according to
JProfiler, 97% of the time is spent resolving a SLF4J debug call arguments:

// now lets dispatch
LOG.debug(">>>> {} {}", endpoint, exchange);

DefaultEndpoint.toString() turns out to be expensive to evaluate in those
conditions and this could be avoided if a simple guard would be added:

// now lets dispatch
if(LOG.isDebugEnabled())
{
    LOG.debug(">>>> {} {}", endpoint, exchange);
}

Again, typical usage of an endpoint won't have a lot of parameters set by
the user, but it can happen nonetheless.  It is fair to assume that logging
shouldn't have any performance impact unless it is turned on.  Is it
possible to add this guard for the next release?

Thank you!



--
View this message in context: http://camel.465427.n5.nabble.com/Little-ProducerCache-performance-improvement-when-dealing-with-long-URIs-tp5731282.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Little ProducerCache performance improvement when dealing with long URIs

Posted by ladoe00 <la...@yahoo.com>.
Seems like I was too quick to pull the trigger on that one.  I wasn't
defining any log4j configuration in my test case and this cause the debug to
be turned on, but not outputted.  The SLF4J debug method takes an Object and
not a String for its argument, so toString() will not be called when
evaluating the argument list.  Supplying a log4j.properties fixed this
performance issue.  So no modification required in the Camel code base.

My apologies for this.
Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Little-ProducerCache-performance-improvement-when-dealing-with-long-URIs-tp5731282p5731288.html
Sent from the Camel Development mailing list archive at Nabble.com.