Implement keep alive requests for the DB Connection
Description
In my company we have the database on a seperate server and a firewall between the gitlab server and the DB server.
Our firewall cut's the connection after a certain time of inactivity (1 hour by default).
This leads to sidekiq suddenly being unable to query the database, which in turn freezes all sidekiq jobs.
Proposal
To counter this, I propose to implement an optional keep alive query that's being executed every x minutes. I propose to add 2 new config options. (I know, I know dreaded words)
- keep_alive_query (I usually use
Select 1, maybe we can also simply hardcode that.) - keep_alive_frequency (set it in minutes)
At least the keep_alive_frequency would have to be configurable, because the timeout probably isn't the same for all customers.
Links / references
related to ##23755 (closed)
Zendesk Ticket: https://gitlab.zendesk.com/agent/tickets/45666