Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Drain MySQL connection in VTGate upon termination of VTGate #15971

Open
frouioui opened this issue May 17, 2024 · 0 comments
Open

RFC: Drain MySQL connection in VTGate upon termination of VTGate #15971

frouioui opened this issue May 17, 2024 · 0 comments

Comments

@frouioui
Copy link
Member

frouioui commented May 17, 2024

Description

We would like to add a new feature to allow for all the MySQL protocol connections to be drained when terminating VTGate. The drain would wait until all the idle connections have disconnected (or the timeout expires, whichever happens first). When the server goes into OnTerm state, new connections will stop being accepted. A load balancer used in front of vtgate should now connect new application sessions to other vtgates. Once all the idle connections have drained, the vtgate will exit.

Note that for this scheme to be practical, the application client to vtgate should refresh it's MySQL connections periodically; a period of something like 45-60 minutes is usually a good value, while not short enough to cause a lot of re-connection churn. If the vtgate drain timeout is set to an hour along with this, the "drain cycle" when shutting down a vtgate would then be something less than an hour, and not actually need to force-close any application MySQL connections, thus avoiding errors served to MySQL protocol clients. The "refresh" setting is often a feature of the MySQL client connector in use, e.g. in HikariCP the setting is called maxLifetime, and is set by default (to 30 minutes).

We would introduce a new flag for this feature to work and it is possibly a breaking change hence the RFC.

Proposed changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant