title: Apache Camel: who takes care of sending out HTTP messages?
body: <p>Currently, I am using Camel as an orchestration engine (a HTTP request comes in and my Camel application will send out certain HTTP messages and make decisions based on the replies). The Camel application is running on top of Apache's TomCat. </p>
  
  <p>As part of my tests, I am starting to send more and more simultaneous requests to my Camel application. Stripped down cenario is as follows:</p>
  
  <pre><code> HTTP POST --&gt; Camel --&gt; HTTP GET to server Z
                       &lt;-- 200 ok (this could take up to 5 sec)
             &lt;-- 200 ok
  </code></pre>
  
  <p>Problem: when sending 20 simultaneous requests, everything goes fine (all requests are handled fine by the Camel application). </p>
  
  <p>However, when sending 21 requests, I see the following behaviour: the first 20 requests are being handled and only when the 1st request has received a final reply (= 200 ok), the 21st HTTP GET request is sent to server Z ??</p>
  
  <p>This means that for 20 requests, all are handled within more or less 5 seconds. But when sending 21 requests, it takes like 10 seconds (the last request can only be handled by server Z after 5 sec) !!</p>
  
  <p>Now, I have added some logging to the Camel code (timestamp before and after sending the HTTP GET message to server Z) and this made it quite confusing for me: according to the log info, Camel does send the 21st request immediately out ! (it does not wait on the 200 ok final reply of the 1st message ?!)</p>
  
  <p>So, I am wondering ... where does this 21st request (HTTP GET to server Z) get stuck for 5 sec?? And why ?? This is really breaking my brain ...</p>
  
  <p>So, to summarize for the 21st request:</p>
  
  <p>in Camel log: </p>
  
  <pre><code>  time x           = POST comes in
    time x+some msec = Camel sends HTTP GET to server Z
    time x+10        = Camel receives 200 ok on HTTP GET
  </code></pre>
  
  <p>in wireshark:</p>
  
  <pre><code>  time x           = POST comes in
    time x+5         = Camel sends HTTP GET to server Z
    time x+10        = Camel receives 200 ok on HTTP GET  
  </code></pre>
  
  <p>Note: I am printing the timestamp as follows in my Camel code:</p>
  
  <pre><code>    .log("${date:now:yyyyMMdd-HH-mm-ss-SSS} **** Sending HTTP GET message... ****")
      .to("{{serverZ.endpoint}}")
  </code></pre>