Camel-restlet is giving better performance compared to camel-jetty and camel-servlet - Any specific reasons?

Viewed 1105

I have created a spring-boot application where I used the camel-restlet component to expose my camel routes as rest endpoints.

My camel routes are simple: they accept the request from a northbound rest endpoint, do request processing, call another southbound rest endpoint via camel-netty4-http component, process the response and send it back to northbound.

Now I'm doing performance analysis using JMeter. I observed that with 10 threads, my camel route performance (avg latency 220ms and throughput ~38) is matching with the results that I got from JMeter when I call the same southbound rest endpoint directly via JMeter (avg latency 210ms and throughput ~39) .

But when I increase the number of threads from 10 to 100 or more in Jmeter, the results are strange:

  • when I call southbound rest endpoint directly: Latency 2230 ms & throughput ~20
  • when I call the same southbound rest end point via my camel route, Latency is 230 ms and throughput ~38.

I did the same test by just changing the rest component from camel-restlet to camel-servelet, camel-jetty and the results are matching with the results that I got from JMeter when call southbound rest endpoint directly via JMeter (avg Latency 2230 ms & throughput ~20).

Can anyone help me understand the reasons for getting better performance with camel-restlet component when compared with other camel components (camel-jetty or camel-servlet)?

1 Answers

By default camel-restlet is asynchronous, and is more suitable for your test. You can set the option synchronous=true on your endpoint to be in the same conditions.

<from uri="restlet:/path/?synchronous=true" />

http://camel.apache.org/restlet.html

Or enable async on camel servlet :

<servlet> 
  <servlet-name>CamelServlet</servlet-name> 
  <display-name>Camel Http Transport Servlet</display-name> 
  <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class> 
  <init-param> <param-name>async</param-name> <param-value>true</param-value> </init-param> 
  <load-on-startup>1</load-on-startup> 
  <async-supported>true</async-supported>
</servlet>

You can also try netty4 endpoint, (you already use it as a client) which is fully reactive and can handle large concurrent connections.

<from uri="netty4-http:http://0.0.0.0:{{port}}/path/">

http://camel.apache.org/netty4-http.html

Related