2

The following formula is used in my RDS parameter group for the max_connections property: {DBInstanceClassMemory/12582880}

I have a relative understanding of the DBInstanceClassMemory per their documentation: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithParamGroups.html.

DBInstanceClassMemory

Returns the number of bytes of memory allocated to the DB instance class associated with the current DB instance, less the memory used by the Amazon RDS processes that manage the instance.

But I have no idea how they came up with the magical number: 12582880

They have mentioned the formula in their best practices: https://aws.amazon.com/blogs/database/best-practices-for-configuring-parameters-for-amazon-rds-for-mysql-part-3-parameters-related-to-security-operational-manageability-and-connectivity-timeout/

By default, this parameter is based on a formula that is calculated from the DBInstanceClassMemory value. This parameter is tuned automatically based on the total available memory of the RDS instances. The formula is as follows:

max_connections = DBInstanceClassMemory/12582880

Can anyone shed some light on how the AWS team came up with 12582880?

Gabriel Gates
  • 121
  • 1
  • 4
  • (I don't have a straight answer.) That number probably produces a "reasonable" value for `max_connections` for the various server sizes. You can change the value, but be aware that going too much bigger could risk running out of RAM, which would be bad. – Rick James Nov 07 '19 at 05:29
  • 3
    The number is slightly under 12MB. Perhaps they decided it would be safe to allow that much RAM per connection. (In reality, there is no perfect formula.) – Rick James Nov 07 '19 at 06:02
  • 1
    Yeah, that number must produce a safe number of max_connections. I'm using a t2 and a t3 instance and they both use the same formula. I have no intention of updating it. I've read other posts where it was suggested to add all of the thread buffers. But like you said there is no perfect formula as every situation is different, but this formula was deemed safe by the AWS team, I just thought it would be interesting to know some of the logic of how they came up with that magical number. – Gabriel Gates Nov 07 '19 at 13:55
  • Well, I am curious, too. – Rick James Nov 07 '19 at 22:44

0 Answers0