title: nginx php-fpm configuration hitting children limit
body: <p>I'm having this problem with nginx + php7.0-fpm. </p>
  
  <p>Testing is done on a pure php server with no other services installed.</p>
  
  <p>I'm getting the following warning.</p>
  
  <pre><code>WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 35 total children
  </code></pre>
  
  <p>And it slows the server down greatly.</p>
  
  <p>I'm using <code>AWS t2.medium instance</code> - 2vCPU and 4GB RAM.</p>
  
  <p>My <code>php7.0-fpm/www.conf</code> set up looks like</p>
  
  <pre><code>pm = dynamic
  pm.max_children = 50
  pm.start_servers = 20
  pm.min_spare_servers = 10
  pm.max_spare_servers = 20
  pm.max_requests = 500
  </code></pre>
  
  <p>I have a laravel application that I'm using to test which simply replies <code>{"m":"OK"}</code> to requests.</p>
  
  <p>I tested that using <code>apache2-utils</code> </p>
  
  <pre><code>ab -n 1000 -c 50 https://mytestserver.com/
  </code></pre>
  
  <p>Response from <code>ab</code> test -> <a href="https://ghostbin.com/paste/528tw" rel="nofollow noreferrer">https://ghostbin.com/paste/528tw</a></p>
  
  <p>And I watch the CPU usage using <code>htop</code>.</p>
  
  <p>The two CPU usages hit 100% quickly during <code>ab</code> test. However, Memory usage is only <code>400MB</code>.</p>
  
  <p>Why is it using CPU too much? What do I do to make getting WARNING from php-fpm?</p>
  
  <p>What am I doing wrong? Please guide me through.</p>
  
  <p>Thanks.</p>