【问题标题】:Camel: outgoing connections limit for http componentCamel:http组件的传出连接限制
【发布时间】:2014-03-27 14:50:23
【问题描述】:

我有一个骆驼上下文,路线很少,简化版本如下:

<camelContext id="myContext">

    <threadPoolProfile id="defaultThreadPoolProfile" defaultProfile="true"
            poolSize="50" maxPoolSize="500" maxQueueSize="5000" rejectedPolicy="CallerRuns" />  

    <route id="rest">
        <from uri="jetty:http://0.0.0.0:8080/service?httpClient.idleTimeout=30000&amp;httpClient.soTimeout=30000&amp;httpClient.defaultMaxConnectionsPerHost=150&amp;httpClient.maxTotalConnections=1000" />
        <to uri="direct:service" />
    </route>

    <route id="service">
        <from uri="direct:service" />
        <to uri="direct:external" />
        <to uri="direct:response" />
    </route>


    <route id="external">
        <from uri="direct:external" />
        <to uri="http4://remote-host/?bridgeEndpoint=true&amp;httpClient.soTimeout=15000&amp;connectionsPerRoute=100&amp;maxTotalConnections=1000" />
        <convertBodyTo type="java.lang.String" />
    </route>

    <route id="response">
        <from uri="direct:response" />
        <to uri="xslt:response.xsl" />
    </route>

</camelContext>

在负载测试期间,我注意到,传出连接(通过 http4 组件)在某种程度上受到限制。尝试调整相关的组件选项(如上例所示)似乎没有帮助。我尝试了以下场景:

同时使用 jMeter 发送 50 个并行请求,并在运行 camel 的主机上监控传入的已建立套接字连接:我随时看到 50 个与 Camel 建立的连接(到目前为止一切都很好)。同时,我在 Camel 主机和传入连接远程主机端只看到 20 个已建立的传出连接。

对我来说,Camel 似乎限制了传出连接的数量?如何解决这个问题?我希望所有请求都通过而没有任何限制。使用骆驼 2.10

【问题讨论】:

    标签: http parallel-processing apache-camel apache-httpclient-4.x


    【解决方案1】:

    您需要配置 http4 端点以允许更多并发连接到同一远程主机。

    开始

    然后查看 Apache HTTP Client 4.x 文档/api 以了解设置哪个选项来增加它。

    或者改用 jetty-http,这样您只需将 Jetty 用于消费者/生产者,因为这也可以,而且我不记得 Jetty 有这种开箱即用的限制。查看更多信息:http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html

    【讨论】:

    • 谢谢!不幸的是,我无法快速找到哪个 Apache HTTP Client 4.x 设置有限制(尽管知道它仍然很有趣),但使用 jetty 组件可以解决问题!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-12
    相关资源
    最近更新 更多