RDS server come up with 40 connection max, as in the following documentation
I am using Magento 1.9, and at some points, i reach the max number then website is out of service.
Do you have any recommended way to solve this issue?

From my understanding, if i have 2 web servers connection to an RDS server.. then I should have 2 RDS connections, not more.

Best Answer

Aws rds max_connections limit variable is based on instance type, so you can upgrade your rds or make more replica.

The rds types with max_connections limit.

  • t2.micro 66
  • t2.small 150
  • m3.medium 296
  • t2.medium 312
  • m3.large 609
  • t2.large 648
  • m4.large 648
  • m3.xlarge 1237
  • r3.large 1258
  • m4.xlarge 1320
  • m2.xlarge 1412
  • m3.2xlarge 2492
  • r3.xlarge 2540

Referring by max_connections at AWS RDS MySQL Instance Sizes in 2015

Update 2017-07

The current RDS MySQL max_connections setting is default by {DBInstanceClassMemory/12582880} , if you use t2.micro with 512MB RAM, the max_connections could be (512*1024*1024)/12582880 ~= 40, and so on.

Each web server could have several connections to rds which depend on your sql requests from the web server