title: How to scale Apache Camel route?
body: <p>I have the following routes:</p>
  
  <pre><code>&lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt;
      &lt;threadPoolProfile id="defaultProfile"
          defaultProfile="true" poolSize="100" maxPoolSize="200" /&gt;
  
      &lt;route&gt;
          &lt;from uri="amq:example.MyQueue" /&gt;
          &lt;setHeader headerName="myRoutingSlipHeader"&gt;
              &lt;constant&gt;amq:one#amq:two#amq:three#amq:four&lt;/constant&gt;
          &lt;/setHeader&gt;
          &lt;log message="Makan" /&gt;
          &lt;setExchangePattern pattern="InOut" /&gt;
          &lt;routingSlip uriDelimiter="#"&gt;
              &lt;header&gt;myRoutingSlipHeader&lt;/header&gt;
          &lt;/routingSlip&gt;
          &lt;setExchangePattern pattern="InOnly" /&gt;
          &lt;log message="End: ${body}" /&gt;
      &lt;/route&gt;
  
      &lt;route&gt;
          &lt;from uri="amq:one" /&gt;
          &lt;to uri="bean:helloBean?method=stepOne" /&gt;
      &lt;/route&gt;
  
      &lt;route&gt;
          &lt;from uri="amq:two" /&gt;
          &lt;to uri="bean:helloBean?method=stepTwo" /&gt;
      &lt;/route&gt;
  
      &lt;route&gt;
          &lt;from uri="amq:three" /&gt;
          &lt;to uri="bean:helloBean?method=stepThree" /&gt;
      &lt;/route&gt;
  
      &lt;route&gt;
          &lt;from uri="amq:four" /&gt;
          &lt;to uri="bean:helloBean?method=stepFour" /&gt;
      &lt;/route&gt;
  
      &lt;/camelContext&gt;
  
  &lt;bean id="amq" class="org.apache.activemq.camel.component.ActiveMQComponent"
      p:brokerURL="tcp://localhost:61616" p:transacted="true"
      p:cacheLevelName="CACHE_CONSUMER" p:concurrentConsumers="20"
      p:maxConcurrentConsumers="500" p:idleConsumerLimit="10"
       /&gt;
  </code></pre>
  
  <p>Given that example.MyQueue is preloaded with 1000 messages, and each hello bean's step* methods takes 250ms, when I do camel:run, the performance is still bad. It prints "End: ..." each 1 secs in sequence not parallel. What would be the problem here?</p>
  
  <p>In the following much simple case, I see a strange behavior. When there is no JMS producer putting messages into the queue, the printings happen in sequence. But when there is, the printings happen in parallel. What's the explanation?</p>
  
  <pre><code>&lt;threadPoolProfile id="defaultProfile"
          defaultProfile="true" poolSize="100" maxPoolSize="200" /&gt;
  
  &lt;route&gt;
    &lt;from uri="amq:example.MyQueue" /&gt;
    &lt;delay&gt;
      &lt;constant&gt;1000&lt;/constant&gt;
    &lt;/delay&gt;
    &lt;log message="End: ${body}" /&gt;
  &lt;/route&gt;
  
  &lt;bean id="amq" class="org.apache.activemq.camel.component.ActiveMQComponent"
      p:brokerURL="tcp://localhost:61616" p:transacted="true"
      p:cacheLevelName="CACHE_CONSUMER" p:concurrentConsumers="20"
      p:maxConcurrentConsumers="500" p:idleConsumerLimit="10"
       /&gt;
  </code></pre>