Apache Camel 路由性能

标签 apache http apache-camel infinispan

我正在使用 Camel ReSTLet 进行一般路由,响应时间为 300 毫秒,是否可以进行任何设置以减少响应时间。

我的路由配置

 <route id="retriveEntry">
                <from uri="restlet:/user/{cachename}/{userId}?restletMethod=GET"/>
                <setHeader headerName="Content-Type">
                  <constant>application/xml</constant>
                </setHeader>
                <!-- <process ref="requestTimeProc"/> -->
                <to uri="restlet:http://hostname:8180/rest/{cachename}/{userId}?restletMethod=GET"/>
                <!-- <process ref="responseTimeProc"/> -->
            </route>

Response time By hitting the backend URL directly is :40 ms http://hostname:8180/rest/{cachename}/{userId}

我也不知道为什么在我的 Camel 日志中看到这些警告:

WARNING: Addition of the standard header "Content-Length" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:38 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "Date" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "Host" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "Connection" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders
WARNING: Addition of the standard header "User-Agent" is not allowed. Please use the equivalent property in the Restlet API.
Nov 13, 2013 5:07:39 PM org.restlet.engine.http.header.HeaderUtils addExtensionHeaders

最佳答案

因为您只是将请求路由到后端服务,所以您不需要使用 camel-rest 来完成此类工作。你可以使用 camel-jetty 和 camel-http 来定义这样的路由

<route>
    <from uri="jetty:xxx"/>
    <to uri="http://xxx"/>
</route>

对于WARNING信息,应该在CAMEL-6590中解决

关于Apache Camel 路由性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19971546/

相关文章:

java - Camel : filterFile DSL example

PHP mysqli() 不工作

php - Apache-上传文件会卡住我的网站

PHP:如何使用 cURL 转发 $_FILES

http - 如何在 Angular 2 中获取自定义响应 header ?

java - Apache Camel : Send Text Message with Twilio

java - ApacheConnectorProvider : Jersey Client 2. 5.1

ruby-on-rails - 什么是本地主机 :8000 as used in Codecademy (for AngularJS and Ruby on Rails tutorials)?

perl - Regexp::Common::URI::http - 它能找到带有破折号的 URL,例如我的网站.domain.com

java - 在 Apache Camel 中使用另一个 header 值