You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by salemi <sa...@avaya.com> on 2013/08/06 07:28:49 UTC

Camel Performance

Hi,

I was wondering how can improve the performance of  the route below!
		<route id="operationalRoute" autoStartup="false">
	        <from uri="jms:topic:opertopic"/>
	        <transacted/>
	        <unmarshal ref="ccisJSON"/>      
	    	<choice>
	    		<when>
	    			<simple>${body.messagetype} contains 'OPER'</simple>
	                <to uri="direct:gigaspacesInterface"/>
	            </when>
	            <when>
                    <simple>${body.messagetype} contains 'CONTROL'</simple>
                    <to uri="direct:sourceStatusRoute"/>
                </when>
	        	<when>
	        	    <simple>${body.messagetype} contains 'ADMIN'</simple>
	    			<to uri="direct:adminRoute"/>
	    		 </when>
	    		 <otherwise>
	    		 	 <log loggingLevel="INFO" message=" ${body}"/>
	    		  </otherwise>
	    	</choice>
		</route>

I see the following times consumed using dynaTrace.
1. If I marked a route transacted I have lost of the performance of about
10ms per message!
2. The unmarshal tag takes about 2.5ms. If you have the Objectmapper already
created the unmarshalling supposed to be in micro-second.
3. Creating Expression  (choice) and evaluating of it takes in average 11ms.

Any suggestion how to improve the performance of the 3 items mentioned
above?



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

Re: Camel Performance

Posted by Claus Ibsen <cl...@gmail.com>.
The simple/bean language has been performance improved from Camel 2.11
onwards, so try upgrading and give that a test.

On Sun, Aug 11, 2013 at 5:30 AM, salemi <sa...@avaya.com> wrote:
> <camel.version>2.10.4</camel.version>
>
>
>
> -----
> Alireza Salemi
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Performance-tp5736810p5737083.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: Camel Performance

Posted by salemi <sa...@avaya.com>.
<camel.version>2.10.4</camel.version>



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

Re: Camel Performance

Posted by Claus Ibsen <cl...@gmail.com>.
Whatelet version of Camel do you use


lørdag den 10. august 2013 skrev salemi :

> Claus,
>
> Coming back to simple language performance.  If I take out the choice the
> performance is excellent 1 sec for 124 msgs but with choice the performance
> is 5 second per 124 msgs.
>
>           <unmarshal ref="myMessage" />
>           <choice>
>                 <when>
>                     <simple>${body.messagetype} == 'OPER'</simple>
>                     <to uri="direct:write"/>
>                 </when>
>          </choice>
>
> Is there any other language that I can use instead of simple to make it
> faster? I am looking at the MyMessage.getMessageType() only and I don't
> want
> everything to be converted to string.
>
> The body contains MyMessage class.
> public class MyMessage{
>         private String version;
>         private String event;
>         private HashMap<String,Param> parameters = new
> HashMap<String,Param>();
>         private String entity;
>         private String messagetype;
>         private String eventTimestamp;
>         private String sequenceNumber;
>         private String nativeSourceName;
>         private String nativeSourceType;
>
>
>         @JsonProperty("Version")
>         public String getVersion() {
>                 return version;
>         }
>          public void setVersion(String version) {
>                  this.version = version;
>          }
>
>         @JsonProperty("Event")
>         public String getEvent() {
>                 return event;
>         }
>         public void setEvent(String event) {
>                 this.event = event;
>         }
>           @JsonProperty("Entity")
>         public String getEntity() {
>
>                  return xyz;
>         }
>         public void setEntity(String entity) {
>             //todo
>         }
>
>         @JsonProperty("Parameters")
>         public HashMap<String, Param> getParameters() {
>                 return parameters;
>         }
>         public void setParameters(HashMap<String, Param> params) {
>                 if (params != null)
>                 {
>                         this.parameters = params;
>                         }
>                 }
>         }
>         @JsonProperty("MessageType")
>         public String getMessagetype() {
>                 return messagetype;
>         }
>         public void setMessagetype(String messagetype) {
>                 this.messagetype = messagetype;
>         }
>         @JsonProperty("TimeStamp")
>         public String getEventTimestamp() {
>                 return eventTimestamp;
>         }
>         public void setEventTimestamp(String eventTimestamp) {
>                 this.eventTimestamp = eventTimestamp;
>         }
>         @JsonProperty("SequenceNumber")
>         public String getSequenceNumber() {
>                 return sequenceNumber;
>         }
>         public void setSequenceNumber(String sequenceNumber) {
>                 this.sequenceNumber = sequenceNumber;
>         }
>         @JsonProperty("NativeSourceName")
>         public String getNativeSourceName() {
>                 return nativeSourceName;
>         }
>         public void setNativeSourceName(String nativeSourceName) {
>                 this.nativeSourceName = nativeSourceName;
>
>         }
>         @JsonProperty("NativeSourceType")
>         public String getNativeSourceType() {
>                 return nativeSourceType;
>         }
>         public void setNativeSourceType(String nativeSourceType) {
>                 this.nativeSourceType = nativeSourceType;
>         }
> }
>
>
>
> -----
> Alireza Salemi
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Performance-tp5736810p5737053.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: Camel Performance

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

You can use any of the languages at
http://camel.apache.org/languages

For example mvel or ognl should be faster in 2.10.x for this use-case.

On Sat, Aug 10, 2013 at 6:01 AM, salemi <sa...@avaya.com> wrote:
> Claus,
>
> Coming back to simple language performance.  If I take out the choice the
> performance is excellent 1 sec for 124 msgs but with choice the performance
> is 5 second per 124 msgs.
>
>           <unmarshal ref="myMessage" />
>           <choice>
>                 <when>
>                     <simple>${body.messagetype} == 'OPER'</simple>
>                     <to uri="direct:write"/>
>                 </when>
>          </choice>
>
> Is there any other language that I can use instead of simple to make it
> faster? I am looking at the MyMessage.getMessageType() only and I don't want
> everything to be converted to string.
>
> The body contains MyMessage class.
> public class MyMessage{
>         private String version;
>         private String event;
>         private HashMap<String,Param> parameters = new HashMap<String,Param>();
>         private String entity;
>         private String messagetype;
>         private String eventTimestamp;
>         private String sequenceNumber;
>         private String nativeSourceName;
>         private String nativeSourceType;
>
>
>         @JsonProperty("Version")
>         public String getVersion() {
>                 return version;
>         }
>          public void setVersion(String version) {
>                  this.version = version;
>          }
>
>         @JsonProperty("Event")
>         public String getEvent() {
>                 return event;
>         }
>         public void setEvent(String event) {
>                 this.event = event;
>         }
>           @JsonProperty("Entity")
>         public String getEntity() {
>
>                  return xyz;
>         }
>         public void setEntity(String entity) {
>             //todo
>         }
>
>         @JsonProperty("Parameters")
>         public HashMap<String, Param> getParameters() {
>                 return parameters;
>         }
>         public void setParameters(HashMap<String, Param> params) {
>                 if (params != null)
>                 {
>                         this.parameters = params;
>                         }
>                 }
>         }
>         @JsonProperty("MessageType")
>         public String getMessagetype() {
>                 return messagetype;
>         }
>         public void setMessagetype(String messagetype) {
>                 this.messagetype = messagetype;
>         }
>         @JsonProperty("TimeStamp")
>         public String getEventTimestamp() {
>                 return eventTimestamp;
>         }
>         public void setEventTimestamp(String eventTimestamp) {
>                 this.eventTimestamp = eventTimestamp;
>         }
>         @JsonProperty("SequenceNumber")
>         public String getSequenceNumber() {
>                 return sequenceNumber;
>         }
>         public void setSequenceNumber(String sequenceNumber) {
>                 this.sequenceNumber = sequenceNumber;
>         }
>         @JsonProperty("NativeSourceName")
>         public String getNativeSourceName() {
>                 return nativeSourceName;
>         }
>         public void setNativeSourceName(String nativeSourceName) {
>                 this.nativeSourceName = nativeSourceName;
>
>         }
>         @JsonProperty("NativeSourceType")
>         public String getNativeSourceType() {
>                 return nativeSourceType;
>         }
>         public void setNativeSourceType(String nativeSourceType) {
>                 this.nativeSourceType = nativeSourceType;
>         }
> }
>
>
>
> -----
> Alireza Salemi
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Performance-tp5736810p5737053.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: Camel Performance

Posted by Christian Müller <ch...@gmail.com>.
Can provide a predicate (using Java) [1] or any of the other supported
languages listed in [2].

[1] http://camel.apache.org/predicate.html
[2] http://camel.apache.org/scripting-languages.html

Best,
Christian
-----------------

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 Sat, Aug 10, 2013 at 6:01 AM, salemi <sa...@avaya.com> wrote:

> Claus,
>
> Coming back to simple language performance.  If I take out the choice the
> performance is excellent 1 sec for 124 msgs but with choice the performance
> is 5 second per 124 msgs.
>
>           <unmarshal ref="myMessage" />
>           <choice>
>                 <when>
>                     <simple>${body.messagetype} == 'OPER'</simple>
>                     <to uri="direct:write"/>
>                 </when>
>          </choice>
>
> Is there any other language that I can use instead of simple to make it
> faster? I am looking at the MyMessage.getMessageType() only and I don't
> want
> everything to be converted to string.
>
> The body contains MyMessage class.
> public class MyMessage{
>         private String version;
>         private String event;
>         private HashMap<String,Param> parameters = new
> HashMap<String,Param>();
>         private String entity;
>         private String messagetype;
>         private String eventTimestamp;
>         private String sequenceNumber;
>         private String nativeSourceName;
>         private String nativeSourceType;
>
>
>         @JsonProperty("Version")
>         public String getVersion() {
>                 return version;
>         }
>          public void setVersion(String version) {
>                  this.version = version;
>          }
>
>         @JsonProperty("Event")
>         public String getEvent() {
>                 return event;
>         }
>         public void setEvent(String event) {
>                 this.event = event;
>         }
>           @JsonProperty("Entity")
>         public String getEntity() {
>
>                  return xyz;
>         }
>         public void setEntity(String entity) {
>             //todo
>         }
>
>         @JsonProperty("Parameters")
>         public HashMap<String, Param> getParameters() {
>                 return parameters;
>         }
>         public void setParameters(HashMap<String, Param> params) {
>                 if (params != null)
>                 {
>                         this.parameters = params;
>                         }
>                 }
>         }
>         @JsonProperty("MessageType")
>         public String getMessagetype() {
>                 return messagetype;
>         }
>         public void setMessagetype(String messagetype) {
>                 this.messagetype = messagetype;
>         }
>         @JsonProperty("TimeStamp")
>         public String getEventTimestamp() {
>                 return eventTimestamp;
>         }
>         public void setEventTimestamp(String eventTimestamp) {
>                 this.eventTimestamp = eventTimestamp;
>         }
>         @JsonProperty("SequenceNumber")
>         public String getSequenceNumber() {
>                 return sequenceNumber;
>         }
>         public void setSequenceNumber(String sequenceNumber) {
>                 this.sequenceNumber = sequenceNumber;
>         }
>         @JsonProperty("NativeSourceName")
>         public String getNativeSourceName() {
>                 return nativeSourceName;
>         }
>         public void setNativeSourceName(String nativeSourceName) {
>                 this.nativeSourceName = nativeSourceName;
>
>         }
>         @JsonProperty("NativeSourceType")
>         public String getNativeSourceType() {
>                 return nativeSourceType;
>         }
>         public void setNativeSourceType(String nativeSourceType) {
>                 this.nativeSourceType = nativeSourceType;
>         }
> }
>
>
>
> -----
> Alireza Salemi
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Performance-tp5736810p5737053.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel Performance

Posted by salemi <sa...@avaya.com>.
Claus,

Coming back to simple language performance.  If I take out the choice the
performance is excellent 1 sec for 124 msgs but with choice the performance
is 5 second per 124 msgs.

          <unmarshal ref="myMessage" />
          <choice>
                <when>
                    <simple>${body.messagetype} == 'OPER'</simple>
                    <to uri="direct:write"/>
                </when>
         </choice>

Is there any other language that I can use instead of simple to make it
faster? I am looking at the MyMessage.getMessageType() only and I don't want
everything to be converted to string.

The body contains MyMessage class.
public class MyMessage{
	private String version;
	private String event;
	private HashMap<String,Param> parameters = new HashMap<String,Param>();
	private String entity;
	private String messagetype;
 	private String eventTimestamp;
 	private String sequenceNumber;
	private String nativeSourceName;
	private String nativeSourceType;


 	@JsonProperty("Version")
 	public String getVersion() {
 		return version;
	}
	 public void setVersion(String version) {
		 this.version = version;
	 }
	
	@JsonProperty("Event")
	public String getEvent() {
		return event;
	}
	public void setEvent(String event) {
		this.event = event;
   	}
	  @JsonProperty("Entity")
 	public String getEntity() {

		 return xyz;
 	}
 	public void setEntity(String entity) {
            //todo
	}
	
	@JsonProperty("Parameters")
	public HashMap<String, Param> getParameters() {
		return parameters;
	}
	public void setParameters(HashMap<String, Param> params) {
		if (params != null)
		{	
			this.parameters = params;
			}
		}
	}
	@JsonProperty("MessageType")
	public String getMessagetype() {
		return messagetype;
	}
	public void setMessagetype(String messagetype) {
		this.messagetype = messagetype;
	}
	@JsonProperty("TimeStamp")
	public String getEventTimestamp() {
		return eventTimestamp;
	}
	public void setEventTimestamp(String eventTimestamp) {
		this.eventTimestamp = eventTimestamp;
	}
	@JsonProperty("SequenceNumber")
	public String getSequenceNumber() {
		return sequenceNumber;
	}
	public void setSequenceNumber(String sequenceNumber) {
		this.sequenceNumber = sequenceNumber;
	}
	@JsonProperty("NativeSourceName")
	public String getNativeSourceName() {
		return nativeSourceName;
	}
	public void setNativeSourceName(String nativeSourceName) {
		this.nativeSourceName = nativeSourceName;

	}
	@JsonProperty("NativeSourceType")
	public String getNativeSourceType() {
		return nativeSourceType;
	}
	public void setNativeSourceType(String nativeSourceType) {
		this.nativeSourceType = nativeSourceType;
	}
}



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

RE: Camel Performance

Posted by Zhemzhitsky Sergey <Se...@sberbank-cib.ru>.
>> As for the JSON I have defined it in the data formats as followed

Remove it from dataformats and define the following bean

<bean id="ccisJSON" class=" org.apache.camel.component.jackson.JaksonDataFormat">
    <constructor-arg type="com.fasterxml.jackson.databind.ObjectMapper" ref="..." />
    <constructor-arg type="java.lang.Class" value="Message" />
</bean>

Then refer it as usual.

Best Regards,
Sergey 


-----Original Message-----
From: salemi [mailto:salemi@avaya.com] 
Sent: Tuesday, August 06, 2013 1:21 PM
To: users@camel.apache.org
Subject: RE: Camel Performance

As for the JSON I have defined it in the data formats as followed. How can configure it to use always the same objectmapper. I am not sure how the JaksonDataFormat plays into this.
<dataformats>
<json unmarshalTypeName="Message" library="Jackson" prettyPrint="true"
id="ccisJSON"/>
</dataformats>

I will try the client_acknwoledge and post the results.

I will take look at the individual routes and Clause has a point here. The body is a Message Class with an attribute messagetype which is string. Maybe that part is slow. I will into that as well.



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

_______________________________________________________
CONFIDENTIALITY NOTICE: This email and any files attached to it may be confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email. 


RE: Camel Performance

Posted by salemi <sa...@avaya.com>.
As for the JSON I have defined it in the data formats as followed. How can
configure it to use always the same objectmapper. I am not sure how the
JaksonDataFormat plays into this.
<dataformats>
<json unmarshalTypeName="Message" library="Jackson" prettyPrint="true"
id="ccisJSON"/>
</dataformats>

I will try the client_acknwoledge and post the results.

I will take look at the individual routes and Clause has a point here. The
body is a Message Class with an attribute messagetype which is string. Maybe
that part is slow. I will into that as well.



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

RE: Camel Performance

Posted by Zhemzhitsky Sergey <Se...@sberbank-cib.ru>.
Take a look into the jmx stats. It provides performance statistics on the per-processor level.
Identify what processor consumes more time.

1. Is the jms endpoint transacted? Marking the route as transacted does not make the endpoint transacted. If you'd like to consume messages in transactions try to switch the endpoint to client_acknowledge.
2. You have already answered it. Preconfigure the objectmapper. You could refer any DataFormat in the  <unmarshal .../> tag, so just preconfigure JacksonDataFormat (http://camel.apache.org/maven/current/camel-jackson/apidocs/org/apache/camel/component/jackson/JacksonDataFormat.html) with an objectmapper you need.
3. Are you sure that the choice is slow? You have three direct (sync) endpoints direct:gigaspacesInterface, direct:sourceStatusRoute, direct:adminRoute within the choice. Each of them may be slow.

Best Regards,
Sergey

-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: Tuesday, August 06, 2013 11:53 AM
To: users@camel.apache.org
Subject: Re: Camel Performance

The predicates in your choice is using contains function which operates on String types. So if the toString operation of the message body is expensive, then optimize that.

On Tue, Aug 6, 2013 at 7:28 AM, salemi <sa...@avaya.com> wrote:
> Hi,
>
> I was wondering how can improve the performance of  the route below!
>                 <route id="operationalRoute" autoStartup="false">
>                 <from uri="jms:topic:opertopic"/>
>                 <transacted/>
>                 <unmarshal ref="ccisJSON"/>
>                 <choice>
>                         <when>
>                                 <simple>${body.messagetype} contains 'OPER'</simple>
>                         <to uri="direct:gigaspacesInterface"/>
>                     </when>
>                     <when>
>                     <simple>${body.messagetype} contains 'CONTROL'</simple>
>                     <to uri="direct:sourceStatusRoute"/>
>                 </when>
>                         <when>
>                             <simple>${body.messagetype} contains 'ADMIN'</simple>
>                                 <to uri="direct:adminRoute"/>
>                          </when>
>                          <otherwise>
>                                  <log loggingLevel="INFO" message=" ${body}"/>
>                           </otherwise>
>                 </choice>
>                 </route>
>
> I see the following times consumed using dynaTrace.
> 1. If I marked a route transacted I have lost of the performance of 
> about 10ms per message!
> 2. The unmarshal tag takes about 2.5ms. If you have the Objectmapper 
> already created the unmarshalling supposed to be in micro-second.
> 3. Creating Expression  (choice) and evaluating of it takes in average 11ms.
>
> Any suggestion how to improve the performance of the 3 items mentioned 
> above?
>
>
>
> -----
> Alireza Salemi
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Performance-tp5736810.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

_______________________________________________________
CONFIDENTIALITY NOTICE: This email and any files attached to it may be confidential. If you are not the intended recipient you are notified that using, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error please notify the sender and delete this email. 


Re: Camel Performance

Posted by Claus Ibsen <cl...@gmail.com>.
The predicates in your choice is using contains function which
operates on String types. So if the toString operation of the message
body is expensive, then optimize that.

On Tue, Aug 6, 2013 at 7:28 AM, salemi <sa...@avaya.com> wrote:
> Hi,
>
> I was wondering how can improve the performance of  the route below!
>                 <route id="operationalRoute" autoStartup="false">
>                 <from uri="jms:topic:opertopic"/>
>                 <transacted/>
>                 <unmarshal ref="ccisJSON"/>
>                 <choice>
>                         <when>
>                                 <simple>${body.messagetype} contains 'OPER'</simple>
>                         <to uri="direct:gigaspacesInterface"/>
>                     </when>
>                     <when>
>                     <simple>${body.messagetype} contains 'CONTROL'</simple>
>                     <to uri="direct:sourceStatusRoute"/>
>                 </when>
>                         <when>
>                             <simple>${body.messagetype} contains 'ADMIN'</simple>
>                                 <to uri="direct:adminRoute"/>
>                          </when>
>                          <otherwise>
>                                  <log loggingLevel="INFO" message=" ${body}"/>
>                           </otherwise>
>                 </choice>
>                 </route>
>
> I see the following times consumed using dynaTrace.
> 1. If I marked a route transacted I have lost of the performance of about
> 10ms per message!
> 2. The unmarshal tag takes about 2.5ms. If you have the Objectmapper already
> created the unmarshalling supposed to be in micro-second.
> 3. Creating Expression  (choice) and evaluating of it takes in average 11ms.
>
> Any suggestion how to improve the performance of the 3 items mentioned
> above?
>
>
>
> -----
> Alireza Salemi
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Performance-tp5736810.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: Camel Performance

Posted by salemi <sa...@avaya.com>.
Hi Guys,

I did some more testing. It seems like the root cause for the slowing down
is direct route for some reason. 
<to uri="direct:differentroute"/>
I am testing with 124 messages and if put the direct call in there then
everything slows down. The performance goes from under 1 second to 5 second.

Any idea why?

Thanks,
Ali



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