title: AWS ELB - ECS - RDS stack latency
body: <p>This is a bit of share and compare kind of question.</p>
  <p>I have the following stack deployed on AWS:
  ELB &gt; ECS Fargate &gt; node/express &gt; RDS</p>
  <p>I'm (negatively) surprised by some of the latencies observed for some simple requests that involve or not DB queries:</p>
  <ul>
  <li>simple requests to <code>/healthcheck</code> would average at 150/200ms</li>
  <li>simple SELECT queries done directly to my RDS instance thru pgadmin would average at 400ms (I only have a few entries on the requested table).</li>
  </ul>
  <p>I tried to search for benchmark results but couldn't find anything useful. So I'd be grateful for anyone sharing his experience for a similar stack.</p>
  <p>Thanks a lot!</p>
  <hr />
  <p>Additional info on the deployment:</p>
  <ul>
  <li>both ECS and RDS deployed within the same region (eu-west-1)</li>
  <li>requests made from Spain (could that be it?)</li>
  <li>ECS sits on 256 cpu units and 512 reserved memory</li>
  <li>I'm the only one making requests on a dev environment (is there any &quot;cold start&quot; on ELB?)</li>
  <li>RDS sits on an <code>db.t2.micro</code> instance and a postgresql v12.4 engine</li>
  <li>Thanks @Maurice, I've added the info in the ticket but here a summary:</li>
  <li>no utilization issue: single digit CPU utilization and memory at c. 25%; CPU never goes up 10% with several requests and memory always stable.</li>
  <li>I instantiate the DB connection via Sequelize when creating the app and reuse it for each request. DB pooling used via Sequelize with 4 max connections</li>
  </ul>
  <p>A typical cURL latency analysis on the ELB dns:</p>
  <pre><code>❯ curl -kso /dev/null http://be-api-main-elb-uat.wantedtv.com -w &quot;==============\n\n
  | dnslookup: %{time_namelookup}\n
  | connect: %{time_connect}\n
  | appconnect: %{time_appconnect}\n
  | pretransfer: %{time_pretransfer}\n
  | starttransfer: %{time_starttransfer}\n
  | total: %{time_total}\n
  | size: %{size_download}\n
  | HTTPCode=%{http_code}\n\n&quot;
  ==============
  
  | dnslookup: 0,003741
  | connect: 0,065718
  | appconnect: 0,000000
  | pretransfer: 0,065813
  | starttransfer: 0,155532
  | total: 0,155639
  | size: 92
  | HTTPCode=200
  </code></pre>