title: Guidance needed - how to track nginx-docker-rails performance issue
body: <p>My Rails application is deployed on Amazon elastic beanstalk using Docker. Web requests flow into an nginx web server that forwards them to the thin rails server residing in docker. Somewhere along the way there's a bottleneck. Once every 50 requests (or so) I see nginx reports serving time which is x40 higher than the time the rails thin server reports.</p>
  
  <p>here's an example:</p>
  
  <p>NGINX (7490ms):</p>
  
  <blockquote>
    <p>146.185.56.206 - silo [18/Mar/2015:13:35:55 +0000] "GET /needs/117.json?iPhone HTTP/1.1" 200 2114 "-" "Mozilla/5.0 (Macintosh;
    Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko)
    Chrome/40.0.2214.115 Safari/537.36" <strong>7.490</strong> 7.490 .</p>
  </blockquote>
  
  <p>THIN (rails server): 171ms</p>
  
  <blockquote>
    <p>2015-03-18 13:35:48.349 [INFO] method=GET path=/needs/117.json
    format=json controller=needs action=show status=200
    duration=<strong>171.96</strong> view=109.73 db=29.20 time=2015-03-18 13:35:47</p>
  </blockquote>
  
  <p>Can anyone supply some guidance how to troubleshoot such a situation? How do I find the source of the response time difference? I guess it could be either nginx or docker or thin or linux.</p>