You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by WPk <wa...@gmail.com> on 2013/05/24 19:30:38 UTC

Camel Jetty - Performance Issue

Hello,

I have exposed a service using the camel Jetty component. Internally, this
Jetty component talks to three other camel http routes in a sequential
manner. The final response of the Jetty component is build from the
responses of the three http components. Apparently, at very high loads,
resulted from the Load Test, the Camel Jetty Component is hung and remains
unresponsive. Can anyone think of any way to improve the performance of
Camel Jetty and Camel Http components. Appreciate your speedy answers.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty - Performance Issue

Posted by Raul Kripalani <ra...@evosent.com>.
Hi,

Can you reproduce the problem at your end, generate a thread dump and
upload it here?

It will likely contain valuable information to understand what you've
bumped into.

Regards,
Raúl.
On 31 May 2013 02:06, "WPk" <wa...@gmail.com> wrote:

> Hey,
>
> I am adding the contents of the camel-contexts.xml, assuming that can be of
> some help.
> ******************************************************************
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:camel="http://camel.apache.org/schema/spring"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>         <camelContext xmlns="http://camel.apache.org/schema/spring">
>
>                 <propertyPlaceholder id="properties"
>                         location="file:${config.url.loc}" />
>
>                 <route id="Trans_Scanning_Route">
>                         <from
> uri="jetty:http://0.0.0.0:50480/us/scanningSvcs/v1?disableStreamCache=true
> "
> />
>                         <log logName="HTTP LOG" loggingLevel="INFO"
>                                 message="HTTP REQUEST:${in.header.loadId}"
> />
>                         <process ref="scanningServicesProcessor" />
>                 </route>
>
>                 <route id="Load_FreightMgmt_Route">
>                         <from uri="vm:load" />
>                         <to
> uri="properties:{{FREIGHT_LOAD_SVCS_URL}}?throwExceptionOnFailure=false"/>
>                         <convertBodyTo type="java.lang.String" />
>                 </route>
>
>                 <route id="EDI_CommunSvcs_Route">
>                         <from uri="vm:edi" />
>                         <to
>
> uri="properties:{{COMMUN_SVCS_URL}}?throwExceptionOnFailure=false" />
>                         <convertBodyTo type="java.lang.String" />
>                 </route>
>
>                 <route id="Location_Svcs_Route">
>                         <from uri="vm:loc" />
>                         <to
>
> uri="properties:{{LOCATION_SVCS_URL}}?throwExceptionOnFailure=false" />
>                         <convertBodyTo type="java.lang.String" />
>                 </route>
>
>         </camelContext>
>
>         <bean
> class="com.walmart.trans.scanning.processor.ScanningServicesProcessor"
>                 id="scanningServicesProcessor" >
>             <constructor-arg index="0" ref="loadServicesHandler"/>
>         </bean>
>
>         <bean
> class="com.walmart.trans.scanning.handler.LoadServicesHandler"
>                 id="loadServicesHandler" >
>                 <constructor-arg index="0" ref="edi204PartnersHandler"/>
>                 <constructor-arg index="1" ref="locationServicesHandler"/>
>         </bean>
>
>         <bean
> class="com.walmart.trans.scanning.handler.EDI204PartnersHandler"
>                 id="edi204PartnersHandler" >
>         </bean>
>
>         <bean
> class="com.walmart.trans.scanning.handler.LocationServicesHandler"
>                 id="locationServicesHandler" >
>         </bean>
>
> </beans>
> **************************************************************
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733518.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel Jetty - Performance Issue

Posted by Christian Müller <ch...@gmail.com>.
Yeah, I thought the same...

Best,
Christian

Sent from a mobile device
Am 03.06.2013 19:56 schrieb "boday" <be...@initekconsulting.com>:

> on a side note, you should reuse the ProducerTemplate in your processors
> across subsequent requests...
>
> minimize calls to "context.createProducerTemplate()" by using a
> static/class
> level variable to hold this reference, should help performance...
>
>
>
> WPk wrote
> > public class ScanningServicesProcessor implements Processor {
> >
> >         private static GlobalLogger log =
> > GlobalLogger.getLogger(ScanningServicesProcessor.class.getName());
> >     private LoadServicesHandler loadServicesHandler ;
> >
> >     @Autowired
> >         public ScanningServicesProcessor (LoadServicesHandler
> loadHandler)
> > {
> >                 this.loadServicesHandler = loadHandler;
> >         }
> >         /**
> >         *
> >         * This method overrides the org.apache.camel.Processor.process
> > method.
> >         * Consumes the HTTP based requests coming from the Captiva
> Service
> > and
> >         * start processing in the method.
> >         *
> >         * @param loadExchange
> >         *            - The Exchange object. Returns 200 - OK - When the
> > processing
> >         *            is completed with no errors. Returns 444 - No
> Content
> > - When
> >         *            the Freight Management - Load Details returns 404.
> > Returns 500
> >         *            - Internal Server Error - When any internal
> exception
> > is
> >         *            encountered. Returns 400 - Bad Request if the input
> > loadId is
> >         *            bad (Null, Empty or non-integer value).
> >         */
> >         @Override
> >         public void process(Exchange loadExchange) {
> >
> >                 final CamelContext context = loadExchange.getContext();
> >                 final ProducerTemplate template =
> > context.createProducerTemplate();
> >                 int freightResponseCode = 0;
> >                 Message loadMsgOut = null;
> >                 final String loadId = (String)
> > loadExchange.getIn().getHeader("loadId");
> >                 Map&lt;String, Object&gt; headersMap = new
> > HashMap&lt;String, Object&gt;();
> >
> >                 /** Start processing for a valid loadId **/
> >                 if (null != loadId && !"".equals(loadId) &&
> > loadId.matches("[0-9]+")) {
> >                         FetchLoadStopResponse fetchLoadStopResponse =
> > null;
> >
> >                         log.debug("Started invoking the Load Details
> > Service in the Freight Management Module for the Load Id: "
> >                                         + loadId);
> >                         Map&lt;String, Object&gt; loadHeader = new
> > HashMap&lt;String, Object&gt;();
> >                         loadHeader.put(Exchange.HTTP_PATH, loadId);
> >                         Exchange exchange = ScanningServicesUtils
> >                                         .invokeCamelHTTPService(
> >                                                         template,
> >
> > ScanningServicesCommonConstants.FREIGHT_LOAD_SVCS_URL_PROPERTY,
> >                                                         loadHeader,
> null);
> >                         loadMsgOut = (null != exchange) ?
> > exchange.getOut() : null;
> >                         InputSource loadMsgSource = null != loadMsgOut ?
> > loadMsgOut
> >                                         .getBody(InputSource.class) :
> > null;
> >                         freightResponseCode = (null != loadMsgOut && null
> > != loadMsgSource) ? (loadMsgOut
> >
> > .getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class)) : 0;
> >                         log.debug("Load Details Service in the Freight
> > Management Module for the Load Id: "
> >                                         + loadId
> >                                         + " returned a response code "
> >                                         + freightResponseCode);
> >
> >                         /** Process the Load Details if the response code
> > is 200 **/
> >                         try {
> >                                 if (freightResponseCode ==
> > ScanningServicesCommonConstants.HTTP_STATUS_SUCCESS) {
> >                                         log.debug("Load Details Service
> in
> > the Freight Management Module for the Load Id: "
> >                                                         + loadId + "
> > returned" + loadMsgSource.toString());
> >                                         fetchLoadStopResponse =
> > loadServicesHandler
> >
> > .processPickUpStops(context, loadMsgSource);
> >
> >                                 }
> >                                 /**
> >                                 * Set the Message Out Body from the
> > Scanning Services Web
> >                                 * Service
> >                                 **/
> >                                 if (null != fetchLoadStopResponse
> >                                                 &&
> > fetchLoadStopResponse.getLoadStops().size() > 0) {
> >                                         headersMap
> >
> > .put(Exchange.HTTP_RESPONSE_CODE,
> >
> > ScanningServicesCommonConstants.HTTP_STATUS_SUCCESS);
> >
> > ScanningServicesUtils.setExchangeBodyAndHeaders(
> >                                                         loadExchange,
> > ScanningServicesUtils.marshal(
> >
> > fetchLoadStopResponse,
> >
> > FetchLoadStopResponse.class), headersMap);
> >
> >                                 } else if (null == fetchLoadStopResponse
> >                                                 && (freightResponseCode
> ==
> > ScanningServicesCommonConstants.HTTP_STATUS_PAGE_NOT_FOUND
> >                                                                 ||
> > freightResponseCode == 0 || freightResponseCode ==
> > ScanningServicesCommonConstants.HTTP_STATUS_INTERNAL_SERVER_ERROR)) {
> >                                         String error = (null != exchange
> > && null != exchange
> >                                                         .getException())
> ?
> > exchange.getException()
> >                                                         .getMessage() :
> > "";
> >                                         log.error("Invoke of the service
> > returned a response code."
> >                                                         +
> > freightResponseCode);
> >                                         log.error("Invoke of the service
> > failed." + error);
> >                                         headersMap
> >
> > .put(Exchange.HTTP_RESPONSE_CODE,
> >
> > ScanningServicesCommonConstants.HTTP_STATUS_PAGE_NOT_FOUND);
> >                                         ScanningServicesUtils
> >
> > .setExchangeBodyAndHeaders(
> >
> > loadExchange,
> >
> > ScanningServicesCommonConstants.HTTP_RESPONSE_PAGE_NOT_FOUND,
> >
> > headersMap);
> >                                 } else {
> >                                         String error = (null != exchange
> > && null != exchange
> >                                                         .getException())
> ?
> > exchange.getException()
> >                                                         .getMessage() :
> > "";
> >                                         log.debug("Invoke of the service
> > returned a response code."
> >                                                         +
> > freightResponseCode);
> >                                         if("" != error) {
> >                                            log.error("Invoke of the
> > service returned" + error);
> >                                         }
> >                                         headersMap
> >
> > .put(Exchange.HTTP_RESPONSE_CODE,
> >
> > ScanningServicesCommonConstants.HTTP_STATUS_NO_RESPONSE);
> >                                         ScanningServicesUtils
> >
> > .setExchangeBodyAndHeaders(
> >
> > loadExchange,
> >
> > ScanningServicesCommonConstants.HTTP_RESPONSE_NO_RESPONSE,
> >
> > headersMap);
> >
> >                                 }
> >
> >                         }  catch (Exception e) {
> >                                 headersMap
> >
> > .put(Exchange.HTTP_RESPONSE_CODE,
> >
> > ScanningServicesCommonConstants.HTTP_STATUS_INTERNAL_SERVER_ERROR);
> >                                 ScanningServicesUtils
> >
> > .setExchangeBodyAndHeaders(
> >
> > loadExchange,
> >
> > ScanningServicesCommonConstants.HTTP_RESPONSE_INTERNAL_SERVER_ERROR,
> >
> > headersMap);
> >                                 log.error("Exception occured while
> > fetching the details for the load"
> >                                                 + e.getMessage());
> >                         }
> >
> >                 } else {
> >                         log.error("The request to Scanning Services could
> > not be fulfilled due to bad"
> >                                         + " request.");
> >                         headersMap.put(Exchange.HTTP_RESPONSE_CODE,
> >
> > ScanningServicesCommonConstants.HTTP_STATUS_BAD_REQUEST);
> >
> > ScanningServicesUtils.setExchangeBodyAndHeaders(loadExchange,
> >
> > ScanningServicesCommonConstants.HTTP_RESPONSE_BAD_REQUEST,
> >                                         headersMap);
> >
> >                 }
> >
> >                 log.debug("Exit the ScanningServicesProcessor");
> >         }
> > }
>
>
>
>
>
> -----
> Ben O'Day
> IT Consultant -http://consulting-notes.com
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733737.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel Jetty - Performance Issue

Posted by Christian Müller <ch...@gmail.com>.
And here is the link to our FAQ where we already answered this question:

[1]
http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html

Best,

Christian Müller
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Tue, Jun 4, 2013 at 4:56 PM, WPk <wa...@gmail.com> wrote:

> Hi, I would look out in my code for any new instance of the
> producerTemplate
> being created and inject as mentioned in your post. I would run the Load
> Test again and keep you posted.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733810.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel Jetty - Performance Issue

Posted by WPk <wa...@gmail.com>.
Hi, I would look out in my code for any new instance of the producerTemplate
being created and inject as mentioned in your post. I would run the Load
Test again and keep you posted.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733810.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty - Performance Issue

Posted by WPk <wa...@gmail.com>.
Thank you, let me make this change and run the Load Test again..



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733809.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty - Performance Issue

Posted by boday <be...@initekconsulting.com>.
on a side note, you should reuse the ProducerTemplate in your processors
across subsequent requests...

minimize calls to "context.createProducerTemplate()" by using a static/class
level variable to hold this reference, should help performance...



WPk wrote
> public class ScanningServicesProcessor implements Processor {
>  
>         private static GlobalLogger log =
> GlobalLogger.getLogger(ScanningServicesProcessor.class.getName());
>     private LoadServicesHandler loadServicesHandler ;
>           
>     @Autowired
>         public ScanningServicesProcessor (LoadServicesHandler loadHandler)
> {
>                 this.loadServicesHandler = loadHandler;
>         }
>         /**
>         * 
>         * This method overrides the org.apache.camel.Processor.process
> method.
>         * Consumes the HTTP based requests coming from the Captiva Service
> and
>         * start processing in the method.
>         * 
>         * @param loadExchange
>         *            - The Exchange object. Returns 200 - OK - When the
> processing
>         *            is completed with no errors. Returns 444 - No Content
> - When
>         *            the Freight Management - Load Details returns 404.
> Returns 500
>         *            - Internal Server Error - When any internal exception
> is
>         *            encountered. Returns 400 - Bad Request if the input
> loadId is
>         *            bad (Null, Empty or non-integer value).
>         */
>         @Override
>         public void process(Exchange loadExchange) {
>  
>                 final CamelContext context = loadExchange.getContext();
>                 final ProducerTemplate template =
> context.createProducerTemplate();
>                 int freightResponseCode = 0;
>                 Message loadMsgOut = null;
>                 final String loadId = (String)
> loadExchange.getIn().getHeader("loadId");
>                 Map&lt;String, Object&gt; headersMap = new
> HashMap&lt;String, Object&gt;();
>  
>                 /** Start processing for a valid loadId **/
>                 if (null != loadId && !"".equals(loadId) &&
> loadId.matches("[0-9]+")) {
>                         FetchLoadStopResponse fetchLoadStopResponse =
> null;
>  
>                         log.debug("Started invoking the Load Details
> Service in the Freight Management Module for the Load Id: "
>                                         + loadId);
>                         Map&lt;String, Object&gt; loadHeader = new
> HashMap&lt;String, Object&gt;();
>                         loadHeader.put(Exchange.HTTP_PATH, loadId);
>                         Exchange exchange = ScanningServicesUtils
>                                         .invokeCamelHTTPService(
>                                                         template,
>                                                        
> ScanningServicesCommonConstants.FREIGHT_LOAD_SVCS_URL_PROPERTY,
>                                                         loadHeader, null);
>                         loadMsgOut = (null != exchange) ?
> exchange.getOut() : null;
>                         InputSource loadMsgSource = null != loadMsgOut ?
> loadMsgOut
>                                         .getBody(InputSource.class) :
> null;
>                         freightResponseCode = (null != loadMsgOut && null
> != loadMsgSource) ? (loadMsgOut
>                                        
> .getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class)) : 0;
>                         log.debug("Load Details Service in the Freight
> Management Module for the Load Id: "
>                                         + loadId
>                                         + " returned a response code "
>                                         + freightResponseCode);
>  
>                         /** Process the Load Details if the response code
> is 200 **/
>                         try {
>                                 if (freightResponseCode ==
> ScanningServicesCommonConstants.HTTP_STATUS_SUCCESS) {
>                                         log.debug("Load Details Service in
> the Freight Management Module for the Load Id: "
>                                                         + loadId + "
> returned" + loadMsgSource.toString());
>                                         fetchLoadStopResponse =
> loadServicesHandler
>                                                        
> .processPickUpStops(context, loadMsgSource);
>  
>                                 }
>                                 /**
>                                 * Set the Message Out Body from the
> Scanning Services Web
>                                 * Service
>                                 **/
>                                 if (null != fetchLoadStopResponse
>                                                 &&
> fetchLoadStopResponse.getLoadStops().size() > 0) {
>                                         headersMap
>                                                        
> .put(Exchange.HTTP_RESPONSE_CODE,
>                                                                        
> ScanningServicesCommonConstants.HTTP_STATUS_SUCCESS);
>                                        
> ScanningServicesUtils.setExchangeBodyAndHeaders(
>                                                         loadExchange,
> ScanningServicesUtils.marshal(
>                                                                        
> fetchLoadStopResponse,
>                                                                        
> FetchLoadStopResponse.class), headersMap);
>  
>                                 } else if (null == fetchLoadStopResponse
>                                                 && (freightResponseCode ==
> ScanningServicesCommonConstants.HTTP_STATUS_PAGE_NOT_FOUND
>                                                                 ||
> freightResponseCode == 0 || freightResponseCode ==
> ScanningServicesCommonConstants.HTTP_STATUS_INTERNAL_SERVER_ERROR)) {
>                                         String error = (null != exchange
> && null != exchange
>                                                         .getException()) ?
> exchange.getException()
>                                                         .getMessage() :
> "";
>                                         log.error("Invoke of the service
> returned a response code."
>                                                         +
> freightResponseCode);
>                                         log.error("Invoke of the service
> failed." + error);
>                                         headersMap
>                                                        
> .put(Exchange.HTTP_RESPONSE_CODE,
>                                                                        
> ScanningServicesCommonConstants.HTTP_STATUS_PAGE_NOT_FOUND);
>                                         ScanningServicesUtils
>                                                        
> .setExchangeBodyAndHeaders(
>                                                                        
> loadExchange,
>                                                                        
> ScanningServicesCommonConstants.HTTP_RESPONSE_PAGE_NOT_FOUND,
>                                                                        
> headersMap);
>                                 } else {
>                                         String error = (null != exchange
> && null != exchange
>                                                         .getException()) ?
> exchange.getException()
>                                                         .getMessage() :
> "";
>                                         log.debug("Invoke of the service
> returned a response code."
>                                                         +
> freightResponseCode);
>                                         if("" != error) {
>                                            log.error("Invoke of the
> service returned" + error);
>                                         }
>                                         headersMap
>                                                        
> .put(Exchange.HTTP_RESPONSE_CODE,
>                                                                        
> ScanningServicesCommonConstants.HTTP_STATUS_NO_RESPONSE);
>                                         ScanningServicesUtils
>                                                        
> .setExchangeBodyAndHeaders(
>                                                                        
> loadExchange,
>                                                                        
> ScanningServicesCommonConstants.HTTP_RESPONSE_NO_RESPONSE,
>                                                                        
> headersMap);
>                                         
>                                 }
>  
>                         }  catch (Exception e) {
>                                 headersMap
>                                                
> .put(Exchange.HTTP_RESPONSE_CODE,
>                                                                
> ScanningServicesCommonConstants.HTTP_STATUS_INTERNAL_SERVER_ERROR);
>                                 ScanningServicesUtils
>                                                
> .setExchangeBodyAndHeaders(
>                                                                
> loadExchange,
>                                                                
> ScanningServicesCommonConstants.HTTP_RESPONSE_INTERNAL_SERVER_ERROR,
>                                                                
> headersMap);
>                                 log.error("Exception occured while
> fetching the details for the load"
>                                                 + e.getMessage());
>                         }
>  
>                 } else {
>                         log.error("The request to Scanning Services could
> not be fulfilled due to bad"
>                                         + " request.");
>                         headersMap.put(Exchange.HTTP_RESPONSE_CODE,
>                                        
> ScanningServicesCommonConstants.HTTP_STATUS_BAD_REQUEST);
>                        
> ScanningServicesUtils.setExchangeBodyAndHeaders(loadExchange,
>                                        
> ScanningServicesCommonConstants.HTTP_RESPONSE_BAD_REQUEST,
>                                         headersMap);
>  
>                 }
>  
>                 log.debug("Exit the ScanningServicesProcessor");
>         }
> }





-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733737.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty - Performance Issue

Posted by WPk <wa...@gmail.com>.
public class ScanningServicesProcessor implements Processor {
 
        private static GlobalLogger log =
GlobalLogger.getLogger(ScanningServicesProcessor.class.getName());
    private LoadServicesHandler loadServicesHandler ;
          
    @Autowired
        public ScanningServicesProcessor (LoadServicesHandler loadHandler) {
                this.loadServicesHandler = loadHandler;
        }
        /**
        * 
        * This method overrides the org.apache.camel.Processor.process
method.
        * Consumes the HTTP based requests coming from the Captiva Service
and
        * start processing in the method.
        * 
        * @param loadExchange
        *            - The Exchange object. Returns 200 - OK - When the
processing
        *            is completed with no errors. Returns 444 - No Content -
When
        *            the Freight Management - Load Details returns 404.
Returns 500
        *            - Internal Server Error - When any internal exception
is
        *            encountered. Returns 400 - Bad Request if the input
loadId is
        *            bad (Null, Empty or non-integer value).
        */
        @Override
        public void process(Exchange loadExchange) {
 
                final CamelContext context = loadExchange.getContext();
                final ProducerTemplate template =
context.createProducerTemplate();
                int freightResponseCode = 0;
                Message loadMsgOut = null;
                final String loadId = (String)
loadExchange.getIn().getHeader("loadId");
                Map<String, Object> headersMap = new HashMap<String,
Object>();
 
                /** Start processing for a valid loadId **/
                if (null != loadId && !"".equals(loadId) &&
loadId.matches("[0-9]+")) {
                        FetchLoadStopResponse fetchLoadStopResponse = null;
 
                        log.debug("Started invoking the Load Details Service
in the Freight Management Module for the Load Id: "
                                        + loadId);
                        Map<String, Object> loadHeader = new HashMap<String,
Object>();
                        loadHeader.put(Exchange.HTTP_PATH, loadId);
                        Exchange exchange = ScanningServicesUtils
                                        .invokeCamelHTTPService(
                                                        template,
                                                       
ScanningServicesCommonConstants.FREIGHT_LOAD_SVCS_URL_PROPERTY,
                                                        loadHeader, null);
                        loadMsgOut = (null != exchange) ? exchange.getOut()
: null;
                        InputSource loadMsgSource = null != loadMsgOut ?
loadMsgOut
                                        .getBody(InputSource.class) : null;
                        freightResponseCode = (null != loadMsgOut && null !=
loadMsgSource) ? (loadMsgOut
                                       
.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class)) : 0;
                        log.debug("Load Details Service in the Freight
Management Module for the Load Id: "
                                        + loadId
                                        + " returned a response code "
                                        + freightResponseCode);
 
                        /** Process the Load Details if the response code is
200 **/
                        try {
                                if (freightResponseCode ==
ScanningServicesCommonConstants.HTTP_STATUS_SUCCESS) {
                                        log.debug("Load Details Service in
the Freight Management Module for the Load Id: "
                                                        + loadId + "
returned" + loadMsgSource.toString());
                                        fetchLoadStopResponse =
loadServicesHandler
                                                       
.processPickUpStops(context, loadMsgSource);
 
                                }
                                /**
                                * Set the Message Out Body from the Scanning
Services Web
                                * Service
                                **/
                                if (null != fetchLoadStopResponse
                                                &&
fetchLoadStopResponse.getLoadStops().size() > 0) {
                                        headersMap
                                                       
.put(Exchange.HTTP_RESPONSE_CODE,
                                                                       
ScanningServicesCommonConstants.HTTP_STATUS_SUCCESS);
                                       
ScanningServicesUtils.setExchangeBodyAndHeaders(
                                                        loadExchange,
ScanningServicesUtils.marshal(
                                                                       
fetchLoadStopResponse,
                                                                       
FetchLoadStopResponse.class), headersMap);
 
                                } else if (null == fetchLoadStopResponse
                                                && (freightResponseCode ==
ScanningServicesCommonConstants.HTTP_STATUS_PAGE_NOT_FOUND
                                                                ||
freightResponseCode == 0 || freightResponseCode ==
ScanningServicesCommonConstants.HTTP_STATUS_INTERNAL_SERVER_ERROR)) {
                                        String error = (null != exchange &&
null != exchange
                                                        .getException()) ?
exchange.getException()
                                                        .getMessage() : "";
                                        log.error("Invoke of the service
returned a response code."
                                                        +
freightResponseCode);
                                        log.error("Invoke of the service
failed." + error);
                                        headersMap
                                                       
.put(Exchange.HTTP_RESPONSE_CODE,
                                                                       
ScanningServicesCommonConstants.HTTP_STATUS_PAGE_NOT_FOUND);
                                        ScanningServicesUtils
                                                       
.setExchangeBodyAndHeaders(
                                                                       
loadExchange,
                                                                       
ScanningServicesCommonConstants.HTTP_RESPONSE_PAGE_NOT_FOUND,
                                                                       
headersMap);
                                } else {
                                        String error = (null != exchange &&
null != exchange
                                                        .getException()) ?
exchange.getException()
                                                        .getMessage() : "";
                                        log.debug("Invoke of the service
returned a response code."
                                                        +
freightResponseCode);
                                        if("" != error) {
                                           log.error("Invoke of the service
returned" + error);
                                        }
                                        headersMap
                                                       
.put(Exchange.HTTP_RESPONSE_CODE,
                                                                       
ScanningServicesCommonConstants.HTTP_STATUS_NO_RESPONSE);
                                        ScanningServicesUtils
                                                       
.setExchangeBodyAndHeaders(
                                                                       
loadExchange,
                                                                       
ScanningServicesCommonConstants.HTTP_RESPONSE_NO_RESPONSE,
                                                                       
headersMap);
                                        
                                }
 
                        }  catch (Exception e) {
                                headersMap
                                               
.put(Exchange.HTTP_RESPONSE_CODE,
                                                               
ScanningServicesCommonConstants.HTTP_STATUS_INTERNAL_SERVER_ERROR);
                                ScanningServicesUtils
                                                .setExchangeBodyAndHeaders(
                                                               
loadExchange,
                                                               
ScanningServicesCommonConstants.HTTP_RESPONSE_INTERNAL_SERVER_ERROR,
                                                                headersMap);
                                log.error("Exception occured while fetching
the details for the load"
                                                + e.getMessage());
                        }
 
                } else {
                        log.error("The request to Scanning Services could
not be fulfilled due to bad"
                                        + " request.");
                        headersMap.put(Exchange.HTTP_RESPONSE_CODE,
                                       
ScanningServicesCommonConstants.HTTP_STATUS_BAD_REQUEST);
                       
ScanningServicesUtils.setExchangeBodyAndHeaders(loadExchange,
                                       
ScanningServicesCommonConstants.HTTP_RESPONSE_BAD_REQUEST,
                                        headersMap);
 
                }
 
                log.debug("Exit the ScanningServicesProcessor");
        }
}




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733711.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty - Performance Issue

Posted by Christian Müller <ch...@gmail.com>.
How does you "scanningServicesProcessor" looks like?

Best,
Christian

Christian Müller
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Thu, May 30, 2013 at 6:13 PM, WPk <wa...@gmail.com> wrote:

> Hey,
>
> I am adding the contents of the camel-contexts.xml, assuming that can be of
> some help.
> ******************************************************************
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:camel="http://camel.apache.org/schema/spring"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>         <camelContext xmlns="http://camel.apache.org/schema/spring">
>
>                 <propertyPlaceholder id="properties"
>                         location="file:${config.url.loc}" />
>
>                 <route id="Trans_Scanning_Route">
>                         <from
> uri="jetty:http://0.0.0.0:50480/us/scanningSvcs/v1?disableStreamCache=true
> "
> />
>                         <log logName="HTTP LOG" loggingLevel="INFO"
>                                 message="HTTP REQUEST:${in.header.loadId}"
> />
>                         <process ref="scanningServicesProcessor" />
>                 </route>
>
>                 <route id="Load_FreightMgmt_Route">
>                         <from uri="vm:load" />
>                         <to
> uri="properties:{{FREIGHT_LOAD_SVCS_URL}}?throwExceptionOnFailure=false"/>
>                         <convertBodyTo type="java.lang.String" />
>                 </route>
>
>                 <route id="EDI_CommunSvcs_Route">
>                         <from uri="vm:edi" />
>                         <to
>
> uri="properties:{{COMMUN_SVCS_URL}}?throwExceptionOnFailure=false" />
>                         <convertBodyTo type="java.lang.String" />
>                 </route>
>
>                 <route id="Location_Svcs_Route">
>                         <from uri="vm:loc" />
>                         <to
>
> uri="properties:{{LOCATION_SVCS_URL}}?throwExceptionOnFailure=false" />
>                         <convertBodyTo type="java.lang.String" />
>                 </route>
>
>         </camelContext>
>
>         <bean
> class="com.walmart.trans.scanning.processor.ScanningServicesProcessor"
>                 id="scanningServicesProcessor" >
>             <constructor-arg index="0" ref="loadServicesHandler"/>
>         </bean>
>
>         <bean
> class="com.walmart.trans.scanning.handler.LoadServicesHandler"
>                 id="loadServicesHandler" >
>                 <constructor-arg index="0" ref="edi204PartnersHandler"/>
>                 <constructor-arg index="1" ref="locationServicesHandler"/>
>         </bean>
>
>         <bean
> class="com.walmart.trans.scanning.handler.EDI204PartnersHandler"
>                 id="edi204PartnersHandler" >
>         </bean>
>
>         <bean
> class="com.walmart.trans.scanning.handler.LocationServicesHandler"
>                 id="locationServicesHandler" >
>         </bean>
>
> </beans>
> **************************************************************
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733518.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel Jetty - Performance Issue

Posted by WPk <wa...@gmail.com>.
Hey, 

I am adding the contents of the camel-contexts.xml, assuming that can be of
some help.
******************************************************************
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="       
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd       
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
 
        <camelContext xmlns="http://camel.apache.org/schema/spring">
 
                <propertyPlaceholder id="properties"
                        location="file:${config.url.loc}" />
 
                <route id="Trans_Scanning_Route">
                        <from
uri="jetty:http://0.0.0.0:50480/us/scanningSvcs/v1?disableStreamCache=true"
/>
                        <log logName="HTTP LOG" loggingLevel="INFO"
                                message="HTTP REQUEST:${in.header.loadId}"
/>
                        <process ref="scanningServicesProcessor" />
                </route>
 
                <route id="Load_FreightMgmt_Route">
                        <from uri="vm:load" />
                        <to
uri="properties:{{FREIGHT_LOAD_SVCS_URL}}?throwExceptionOnFailure=false"/>
                        <convertBodyTo type="java.lang.String" />
                </route>
 
                <route id="EDI_CommunSvcs_Route">
                        <from uri="vm:edi" />
                        <to
                               
uri="properties:{{COMMUN_SVCS_URL}}?throwExceptionOnFailure=false" />
                        <convertBodyTo type="java.lang.String" />
                </route>
 
                <route id="Location_Svcs_Route">
                        <from uri="vm:loc" />
                        <to
                               
uri="properties:{{LOCATION_SVCS_URL}}?throwExceptionOnFailure=false" />
                        <convertBodyTo type="java.lang.String" />
                </route>
 
        </camelContext>
 
        <bean
class="com.walmart.trans.scanning.processor.ScanningServicesProcessor"
                id="scanningServicesProcessor" >
            <constructor-arg index="0" ref="loadServicesHandler"/>
        </bean>
                
        <bean class="com.walmart.trans.scanning.handler.LoadServicesHandler"
                id="loadServicesHandler" >
                <constructor-arg index="0" ref="edi204PartnersHandler"/>
                <constructor-arg index="1" ref="locationServicesHandler"/>
        </bean>
                
        <bean
class="com.walmart.trans.scanning.handler.EDI204PartnersHandler"
                id="edi204PartnersHandler" >
        </bean>
                
        <bean
class="com.walmart.trans.scanning.handler.LocationServicesHandler"
                id="locationServicesHandler" >
        </bean>
                
</beans>
**************************************************************





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133p5733518.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Jetty - Performance Issue

Posted by Christian Müller <ch...@gmail.com>.
You really should provide more information. An unit test would be perfect.

Best,
Christian

Sent from a mobile device
Am 25.05.2013 07:08 schrieb "WPk" <wa...@gmail.com>:

> Hello,
>
> I have exposed a service using the camel Jetty component. Internally, this
> Jetty component talks to three other camel http routes in a sequential
> manner. The final response of the Jetty component is build from the
> responses of the three http components. Apparently, at very high loads,
> resulted from the Load Test, the Camel Jetty Component is hung and remains
> unresponsive. Can anyone think of any way to improve the performance of
> Camel Jetty and Camel Http components. Appreciate your speedy answers.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Jetty-Performance-Issue-tp5733133.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>