database/sql: driver unexpectedly closing connections that should be returned to the pool #28495
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go 1.11
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Ubuntu 16.04.5 LTS
GOARCH="amd64"
What did you do?
I have 2 go servers, one of which talks to a SQL Server RDS instance, and another that talks to a managed SQL Server instance in Azure.
I believe there is a slight difference in the way the 2 backends work - RDS has a single port (1433) on which the client authenticates and subsequently establishes the connection. Azure SQL seems to authenticate on port 1433 and then redirect the client to another service that actually handles the connections.
In both cases I've got substantial load running against the servers. At least 500 requests/s, with peaks of about 2k req/s. Each of these requests results in a Select query which returns a single row (that I call
.Scan()
on) with a primary key lookup - so really short lived connections to SQL. The average time per query is 50-80ms on both, with p95 in the 100-150ms rangeI'm using the go database/sql driver with an MS-SQL implementation (Specifically go-mssqldb).
I've set Max Idle connections and Max Open connections to 64. I have NOT set MaxConnLifetime.
The Connection Pool was initialized using:
What did you expect to see?
64 long running Established connections to the database that are occasionally idle but quickly reused.
What did you see instead?
Generally 64 Established connections to the database, with the number often dropping down to somewhere between 50 and 64. This also results in 200-400 connections to the database in the TIME_WAIT state at any given time.
The text was updated successfully, but these errors were encountered: