title: Implementing Spring ThreadPoolTaskExecutor and providing the best possible configuration values
body: <p>I have a for loop in which I need to make a REST call. This loop will iterate over 20,000 times as per my requirement. So, I implemented multithreading by Spring framework's ThreadPoolTaskExecutor. The configuration is as below:</p>
  
  <pre><code>&lt;bean id="taskExecutor"
            class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
          &lt;property name="corePoolSize" value="50" /&gt;
          &lt;property name="maxPoolSize" value="100" /&gt;
          &lt;!--&lt;property name="queueCapacity" value="1000" /&gt;--&gt;
  
          &lt;property name="WaitForTasksToCompleteOnShutdown" value="true" /&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>What would be the best values for <code>corePoolSize, maxPoolSize, queueCapacity</code> to get the best performance? I know it would mostly depend on the CPU. But I just want to get some idea so that the performance can be improved. Any other thoughts also welcome.</p>