What is the reason for the delay of the first consultation with Amazon RDS?

Asked

Viewed 109 times

1

Always after a brief period without queries, when making a request to Amazon RDS (Mysql), it takes almost 20 seconds, while the following requests usually happen, as you can see in the image, highlighted in the green rectangle! I need to fix this.

1 answer

2

A possible cause for this is you have an expired connection pool (timeout) after the long period.

Then, when a request arrives, your application, framework or server takes 20 seconds to detect the problem and reconnect to the database.

Possible solutions:

  1. Configure your connection manager to "ping" the database and prevent connections from "dying". This idea has been extracted of this article.
  2. Increase the timeout defined in the variable wait_timeout.
  3. If your application is Java you can use the parameter autoReconnect, as mentioned in driver documentation.

The first option seems to be the most recommended.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.