Description
In Cloud SQL for SQL Server, user connections sets a fixed connection limit or lets SQL Server adjust it dynamically. With 0, the maximum is 32,767 and usable capacity depends on instance resources.
Potential impact
Too low a limit can block clients and administrators during peak traffic. Raising it can increase resource use and latency.
Remediation
Compare peak concurrent connections and pool sizes with instance capacity. Choose a limit, schedule the required restart and load-test the result. Monitor rejected connections and resource usage.
Examples
The first excerpt caps connections at 1,000 and omits the required settings.tier. The second uses var.sql_server_tier to supply the machine type and selects dynamic adjustment. Use a supported engine version. The edition and version change shown is independent of this flag.
Before
resource "google_sql_database_instance" "db" {
name = "sqlserver-instance"
database_version = "SQLSERVER_2017_EXPRESS"
region = "us-central1"
settings {
database_flags {
name = "user connections"
value = "1000"
}
}
}
After
resource "google_sql_database_instance" "db" {
name = "sqlserver-instance"
database_version = "SQLSERVER_2019_STANDARD"
region = "us-central1"
settings {
tier = var.sql_server_tier
database_flags {
name = "user connections"
value = "0"
}
}
}