Validate behaviour during a database connection pool saturation scenario
Problem
During a database connection pool saturation scenario, the application might be unable to retrieve any more connections from the pool or having to wait for too long (timeout).
Expected Behaviour
The registry should handle requests during a connection pool saturation gracefully. This is handled transparently by Go's database/sql
, which should queue requests for connections if the pool is saturated.
New connections should be attempted for each subsequent request. Once the saturation disappears, the registry should establish new connections and resume normal operation without human intervention.
Solution
Create integration tests to assert the expected behavior. It should be possible to test this by manipulating the pool size internally (DB.SetMaxOpenConns
) and spawning a variable number of goroutines (exceeding the pool size at some point) making requests to the API.