title: Rails app running too slow with nginx passenger on ec2 instance
body: <p>I am running rails app using nginx and passenger on ec2-instance t2.small with 2GB RAM and 1 CPU Core. </p>
  
  <p>App contains spree and related gems in development mode. Spree backend used to work fine but since last 3 days, it's taking too much time to respond and start up time is too high if remain idle for some time. I tried various combination of passenger methods in nginx but not helped so I omitted those and below is nginx file in current scenario</p>
  
  <pre><code>worker_processes  1;
  events {
      worker_connections  1024;
  }
  
  http {
      passenger_root /usr/local/rvm/gems/ruby-2.2.1/gems/passenger-5.0.20;
      passenger_ruby /usr/local/rvm/gems/ruby-2.2.1/wrappers/ruby;
      passenger_app_env development;
  
      #added two lines for setting user group
      passenger_default_user root;
      passenger_default_group root;
  
      include       mime.types;
      default_type  application/octet-stream;
  
      sendfile        on;
      keepalive_timeout  65;
  
      passenger_spawn_method smart;
      passenger_pool_idle_time 1000; 
  
      server {
          listen       80;
          server_name  localhost;
          root /var/www/html/apps/localfiles/public;
          passenger_enabled on;
  
  
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   html;
          }
      }
  
      server {
          listen       80;
          server_name  abcd.com www.abcd.com;
      root /var/www/html/apps/abcd/ComingSoon;
      passenger_enabled on;
      }
  
      server {
          listen       80;
          server_name  xyz.com www.xyz.com;
          root /var/www/html/apps/xyz/ComingSoon;
          passenger_enabled on;
      }
  }
  </code></pre>
  
  <p>Any light on what should be the right combination for nginx / passenger configuration would be highly appreciated.</p>
  
  <p>Update: When I use Spree APIs, I need to hit an API 3-4 times to get proper response, it's throwing me this <code>Web application could not be started</code> very often in between API calls. please help with this</p>