This article helps to understand working of max_connections Parameter for Amazon Aurora PostgreSQL Serverless
Aurora Serverless v2 Connection Management
- The value of the max_connections parameter for Aurora Serverless v2DB instances is based on the memory size derived from the maximum ACUs
- However, when you specify a minimum capacity of 0 or 0.5 ACUs on PostgreSQL-compatible DB instances, the maximum value of max_connections is capped at 2,000
Connection Limit is based upon the Configuration as detailed below:
If Minimum ACU (MIN ACU) is set 0 or 0.5:
• And Maximum ACU is 16 or higher :- max_connections are capped at 2,000
• And when Maximum ACU of 8 or lower: Connection limits follow the Documentation table [+] https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.setting-capacity.html#aurora-serverless-v2.max-connectionsdocumentation
If you intend to use the Aurora PostgreSQL cluster for a high-connection workload, consider using a minimum ACU setting of 1 or higher. After you modify the ACU Reboot is required as max_connections static parameter.
If Minimum ACU( MAX ACU ) is set to 1 or higher:
• And Maximum ACU is 16: max_connections are capped at 3,360
• And when Maximum ACU is 32 or higher: max_connections is capped at 5,000
**Example Configurations **
# Example 1:
When configuration is set to MIN ACU 0.5, MAX ACU 16
postgres=> show max_connections;
max_connections
-----------------
2000
(1 row)
# Example 2: MIN ACU 1, MAX ACU 16
postgres=> show max_connections;
max_connections
-----------------
3360
(1 row)
# Example 3: Initial range of 0.5-1 ACU
postgres=> show max_connections;
max_connections
-----------------
189
(1 row)
Important Notes
- For high-connection workloads, consider using a Minimum ACU setting of 1 or higher
- The value of the max_connections parameter for Aurora Serverless v2 DB instances is based on the memory size derived from the Maximum ACUs.
- Changing the capacity range causes changes to the default values of some configuration parameters. Aurora can apply some of those new defaults immediately. However, some of the parameter changes take effect only after a reboot. The max_connections parameter is static parameter .
- If you set the max_connections parameter directly in a custom DB parameter group, no reboot is required.
- Aurora Serverless v2 maintains a constant max_connections parameter even during scaling operations. This ensures connections aren't dropped when the DB instance scales down.
- The default value for max_connections is derived from a formula based on the memory size of the DB instance
- When Aurora Serverless v2 evaluates the formula, it uses the memory size based on the maximum Aurora capacity units (ACUs) for the DB instance, not the current ACU value
- Each ACU is a combination of approximately 2 gibibytes (GiB) of memory, corresponding CPU, and networking
- Changing the ACU maximum is dynamic and immediately takes effect. However, certain database parameters are derived based on the maximum ACU and are static; they only take effect after the reboot. max_connections is also a static parameter and needs a **reboot **for its new value to take effect when the ACU Maximum is changed.
- Changing max_connections to a nondefault value isn’t a best practice and might cause out-of-memory issues.