title: "Heavy" simultaneous users Nginx - Laravel - Google compute engine
body: <p>I'm running a server in nginx with Laravel (medium static web) and I'm doing for example <a href="https://loader.io" rel="noreferrer">500 constant load</a> simultaneous users during 1 minute (not distributed users during that minute).</p>
  
  <p>And getting this error: </p>
  
  <blockquote>
    <p>unix:/var/run/php/php7.1-fpm.sock failed - Resource temporarily
    unavailable</p>
  </blockquote>
  
  <p>cginx.conf</p>
  
  <pre><code>worker_processes auto;
  
  events {
      use epoll;
      worker_connections 1524; #in my case it should be 1024, but well..
      multi_accept on;
  }
  http {
      #with this I reduce disk usage a lot
      client_body_buffer_size 10K;
      client_header_buffer_size 1k;
      large_client_header_buffers 2 1k;
      reset_timedout_connection on;
  
      sendfile on;
      tcp_nopush on;
      tcp_nodelay on;
  </code></pre>
  
  <p>www.conf</p>
  
  <pre><code>pm.max_children = 500
  pm.start_servers = 20
  pm.min_spare_servers = 20
  pm.max_spare_servers = 64
  </code></pre>
  
  <p>Results with Google compute engine:</p>
  
  <pre><code>f1-micro (1 vCPU, 0,6 GB) - Is supporting 40 - 60 requests per second
  g1-small (1 vCPU, 1,7 GB) - Is maintaining 80 request per second
  n1-standard (1vCPU, 3,75 GB) - - Is maintaining 130 request per second
  n1-standard-2 (2vCPU, 7,5 GB) - Is maintaining 250 request per second
  .
  .
  n1-standard-16 (16 vCPU, 60 GB) - Is maintaining 840 request per second
  </code></pre>
  
  <p>The last one is the first passing the test, the rest are dropping Bad Gateways errors from 200 users to 400</p>
  
  <p>If I test for example not 2.000 users distributed in 30 secs with the micro instance then is fine, but not simultaneous sending requests.</p>
  
  <p>Starting with 2 cores, CPUs level show perfectly fine, same as disk operations etc..</p>
  
  <p>So after a loooot of tests I have some questions:</p>
  
  <p>1) Is this normal? Not for me, is not normal to need 16 cores to run a simple web.. or the stress test is too heavy and it's normal?</p>
  
  <p>2) Then, am I missing something? Is Google limiting request per second somehow? </p>
  
  <p>3) What would be normal parameters for the given config files?</p>
  
  <p>Any other help is more than welcome</p>