Question

I have a camel context with few routes, which simplified version looks like:

<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>

During load tests I noticed, that outgoing connections (via http4 component) are somehow limited. Trying to adjust related component options (as seen in example above) seems do not help. I tried following scenario:

Sending 50 parallel requests at the time with jMeter and monitoring incoming established socket connections on the host where camel is running: I see 50 established connections to Camel at any time (so far so good). At the same time I see only 20 established outgoing connections on Camel-host AND incoming connections remote-host side as well.

For me it seems like Camel is limiting amount of outgoing connections? How to solve this? I would like to have all requests passed-through without any throttling. Using Camel 2.10

Était-ce utile?

La solution

You need to configure the http4 endpoint to allow more concurrent connections to the same remote host.

Start with

And then checkout the Apache HTTP Client 4.x documentation / api to know which option to set to increase this.

Or switch to use jetty-http instead so you just use Jetty for both consumer/producer as that works as well, and I don't recall Jetty have such limitation out of the box. See more at: http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top