2

I'm very new to AWS. I've created a new RDS instance t2.small by following the previous one. I've selected all options as similar with the previous one. But the new instance is performing very slow, about 5 times slower than the previous one.

What I've found that, it's taking too much time to establish MySQL connection from the EC2. Sometimes it's more than 10s, and that time it shows connection timeout.

How can I reduce this time to establish mysql connection? I've got few answers about cache query, it didn't solve my problem.

Instance monitoring screenshot

  • That load seems very low. Have you checked that the RDS instance is running in the same region and AZ as the EC2 instance? The latency could maybe explain it, but the AZs are generally sub ms away. Can you ping it - not sure you can in AWS. You can also stop and start it (not restart - stop and start) as this moves it to different hardware which may be less busy. Also check CloudWatch monitoring for the instance. – Tim Dec 13 '16 at 5:23
  • Thank you. It's on same region. Latency is high. And will try the suggested ways. – biplob Dec 13 '16 at 5:27
  • @Tim I've kept a simple php script on my ec2 to check mysql connection establish time. Most of the time it's more than 10s. Also tried by creating a new instance. But no luck. – biplob Dec 15 '16 at 2:16
  • Does a traceroute tell you anything interesting? Edit your post to show it - obfuscate if necessary but probably not since it's in a VPC. – Tim Dec 15 '16 at 4:17
  • @Tim , thank you so much. Finally, I could figure it out. It's because of security group. We had only mysql connection for db connection sg, we've added tcp and all traffic as well. Now, it's connecting less than 1s. – biplob Dec 15 '16 at 10:47
0

We could solve the issue as following

  • Set all ports & traffics open from the security group before restart.
  • Restart the RDS instance
  • Remove again unnecessary security group items after restart.

Before restart

After restart

| improve this answer | |
  • 2
    Based on what I know about AWS, which is a fair bit and includes three AWS certifications, the only part of your procedure that makes any difference is the restart part. Changing security groups, retstarting, then changing them again shouldn't make any difference. If it does you've found a bug. – Tim Dec 19 '16 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.