title: Heroku: Really slow connect times to RDS
body: <p>We're stumped by this, been trying to solve it for a month. It looks like every once in a while (maybe one in 100 requests) our connection time to RDS or RabbitMQ takes &gt; 0.5 seconds.</p>
  <p>We're using Heroku with Django, amazon RDS and S3 (we do tons of image uploads).</p>
  <p>Here's a sample slow connection (fast connections are really fast, like &lt; 20 ms):</p>
  <p><a href="https://i.stack.imgur.com/0pcJB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0pcJB.png" alt="" /></a></p>
  
  <p>It's worth mentioning both Heroku and RDS are in the us-east region. Also when we use Redis Cloud (Heroku add-on) we see slow connection speeds to that too.</p>
  <p><strong>UPDATE:</strong></p>
  <p>I've also found that these same delays exist for Memcached. In fact, on average Memcached takes roughly the same amount as a request to the database. I'm just using Memcached for storing API keys and there's plenty of memory left.</p>
  <p><a href="https://i.stack.imgur.com/4urPu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4urPu.png" alt="" /></a></p>