Blog

Transparent Proxy Maintenance for MySQL, MariaDB & Percona Server

Overview

The Skinny

When it comes to zero downtime, proxies are the first line components of a cluster.

In order to achieve High Availability (HA) for MySQL, MariaDB and Percona Server, a commonly deployed setup consists of configuring load balancers (hardware or software) on top of those proxies.

A Strong Architecture

How is Maintenance Made Possible?

With this proxy + load balancer architecture, server maintenance is made possible on any of the proxy hosts, as follows:

  • the proxy is stopped
  • the load balancer detects the dead proxy and removes it from the pool
  • new connection requests go to live proxies

The Problem

What Happens to Existing Sessions?

But wait... even though new connections are re-routed correctly, what happens to ongoing connections when the proxy is stopped?

Ongoing connections are killed!

In order to avoid this interruption of service, you would want a way to wait for ongoing connections to finish. At the same time, you need to refuse new connection requests.

The Hard Way

How To Drain Connections the Old Way

Some load balancers (HAProxy is a perfect example) will allow connection draining. The system administrator needs to:

  • connect to one load balancer instance
  • reconfigure it
  • mark the backend for maintenance
  • monitor the proxy
  • wait for all connections to finish...
  • go to the next load balancer and restart the same procedure

And finally do the proxy maintenance.

The Easy Way

How To Drain Connections the Simple Way

Tungsten Connector offers an easy, one-liner command to achieve this!

On the proxy host to be maintained, run:

connector graceful-stop {timeout}

The command will:

  • reject new connection requests, which will signal the load balancers to stop using this backend (by refusing new connection request)
  • wait up to {timeout} seconds for ongoing connections to finish
  • return

Summary

The Wrap-Up

In this blog post we discussed transparent proxy maintenance and how using the Tungsten Connector can make proxy maintenance transparent.

Less overhead for maintenance, more time for real work!

To learn about Continuent solutions in general, check out https://www.continuent.com/solutions

The Library

Please read the docs!

For more information about monitoring Tungsten clusters, please visit https://docs.continuent.com.

Tungsten Clustering is the most flexible, performant global database layer available today - use it underlying your SaaS offering as a strong base upon which to grow your worldwide business!

For more information, please visit https://www.continuent.com/solutions

Want to learn more or run a POC? Contact us.

About the Author

Gilles Rayrat
VP of Engineering

Gilles has over 20 years experience in software engineering. Previously holding positions at Orange and Xerox, he joined the Continuent adventure in 2005. As the connectivity expert at Continuent, he has worn many hats including software development, QA, support, project and operations management. Gilles has held most of the engineering positions that he now manages, giving him both deep and wide experience.

Add new comment