AWS CloudAWS RDSDatabase

RDS Max-DB Connection Limits as per DB Instance Type

In this article, we discuss RDS Max-DB Connection Limits as per DB Instance Type.
Most of the time we get the error while taking access to DB.       

” ERROR 1040 (08004): Too many connections “

Let’s understand what is Max-DB Connection: 

Determines the maximum number of concurrent connections to the database server.
This chart shows the max_connections limit, set by AWS, at various MySQL RDS instance sizes.
Class Type
Max_Connection
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
R3.2xlarge
5080    
R3.4xlarge
10160
AWS sets the MySQL max_connections system variable according to the size of the RDS instance. max_connections is the maximum permitted number of simultaneous or concurrent client connections.  A “Too many connections” error message may be displayed if this is reached.
If an application implements long-running queries or creates several concurrent connections from the web or app side, the number of connections is just as important as vCPU cores, memory level or storage IO.
When running a standby server, you must set this parameter to the same or higher value than on the master server. Otherwise, queries will not be allowed on the standby server.
Do you know that, by default, each instance comes with a different number of max_connections? 

Command to check max_db_connection

# mysql>show max_connections;

The numbers in the max_connections column look slightly awkward because they are actually calculated from a formula DBInstanceClassMemory/magic_number where magic_number differs according to the class of your instance.
To know exactly what’s the magic_number for an instance, head over to “Parameter Groups” in your Amazon console:
RDS Max-DB Connection Limits as per DB Instance Type
Click on the default Parameter Group and search for max_connections and you’ll see the formula.
In my case, it’s {DBInstanceClassMemory/31457280}.
­­­­­­
RDS Max-DB Connection Limits as per DB Instance Type
And update the max_connections to 100 and save the changes, no need to reboot. Reboot required when you have created new parameter group and assign to RDS.
RDS Max-DB Connection Limits as per DB Instance Type
Note: No downtime required for this activity.

Now you have learned RDS Max-DB Connection Limits as per DB Instance Type.

Show More

Related Articles

One Comment

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close