Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
驼峰:http组件的传出连接限制_Http_Parallel Processing_Apache Camel_Apache Httpclient 4.x - Fatal编程技术网

驼峰:http组件的传出连接限制

驼峰:http组件的传出连接限制,http,parallel-processing,apache-camel,apache-httpclient-4.x,Http,Parallel Processing,Apache Camel,Apache Httpclient 4.x,我有一个驼峰上下文,其中包含很少的路由,其简化版本如下所示: <camelContext id="myContext"> <threadPoolProfile id="defaultThreadPoolProfile" defaultProfile="true" poolSize="50" maxPoolSize="500" maxQueueSize="5000" rejectedPolicy="CallerRuns" />

我有一个驼峰上下文,其中包含很少的路由,其简化版本如下所示:

<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,您需要配置http4端点,以允许更多并发连接到同一远程主机

然后检查ApacheHTTPClient4.x文档/api,以了解设置哪个选项来增加这一点


或者改为使用jetty http,这样您就可以同时为消费者和生产者使用jetty,因为它也可以工作,我不记得jetty有这种开箱即用的限制。更多信息请访问:

谢谢!不幸的是,我无法很快找到哪个ApacheHTTP客户端4.x设置可以解决这个限制(尽管知道这个问题仍然很有趣),但是使用jetty组件解决了这个问题!