6

I have a site hosted on AWS EC2 (Elastic Beanstalk), with a MySQL database hosted on AWS RDS. Everything works fine on the production server, fast and all.

However when I try to connect remotely from my local machine, it sometimes gets extremely slow (like 4 minutes to load the list of tables), or simply times out.

I added my IP in the security group (which I did correctly, since it sometimes works). When it doesn't work, I at the same time check the prod server and it still looks good.

1
  • Still having the issue in 2023 Mar 22, 2023 at 13:25

1 Answer 1

1

As much I could understand, there is nothing wrong at the ACL or network level, as you are saying that it works sometimes.

What I can see is that you are hitting a limit on the maximum number of processes for Mysql. So, when you connect and issue any command, then if the number of processes allowed to run are saturated, then you have to wait and your request goes into queue. But if you don't get a slot then after that it timeouts.

You can check the same by looking at the graphs which are available with RDS. If the graph is going flat at some value, then my guess is very right.

The total number of connections depends on the instance type you are using. That you can check and set in the DB parameters group option. Search for max_connections.

I am not sure what are the default values for different types of instances, but I am sure this information should be somewhere over the internet.

6
  • Is there a different max_connections for local connections vs external connections? I'm saying this because the web server never has this issue when connecting from the EC2. Only from remote...
    – nute
    Dec 27, 2012 at 7:53
  • Not really, but there is one more parameter, max_user_connection. Though I don't believe that it should affect, but you might take a look at that.
    – Napster_X
    Dec 27, 2012 at 8:09
  • max_connections = {DBInstanceClassMemory/12582880} and max_user_connection is not set. Right this minute I can't access remotely at all while on the site it works fine. Also there is virtually no one on the site - so hard to believe I've reached the max...
    – nute
    Dec 30, 2012 at 14:23
  • Hmm. Not sure then. Can't think of anything as of now. Will surely update if I hit something like this.
    – Napster_X
    Dec 30, 2012 at 17:20
  • @GeekRide Is you find any solution ? Nov 18, 2015 at 10:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .