Databases 17 min read

MySQL Dockerization Practice and Private Cloud Platform at Tongcheng Travel

This article details Tongcheng Travel's extensive experience of running over a thousand MySQL instances in Docker, describing the motivations, architecture, resource scheduling, backup, monitoring, high‑availability, migration, and operational benefits of their private cloud database platform.

Tongcheng Travel Technology Center
Tongcheng Travel Technology Center
Tongcheng Travel Technology Center
MySQL Dockerization Practice and Private Cloud Platform at Tongcheng Travel

Talk is cheap, show me the demo. Tongcheng Travel has successfully run more than a thousand MySQL instances on a Docker platform, demonstrating that MySQL can be safely and stably containerized.

Initially, the company used MSSQL with a strong UI but poor automation, later migrating to MySQL which required heavy manual DBA work. Horizontal sharding increased instance count dramatically, prompting the need for multi‑instance isolation solutions such as KVM, cgroups, and ultimately Docker, which offered lightweight isolation and API‑driven automation.

The platform was built on open‑source components: Percona tools for backup and slow‑log analysis, Prometheus for monitoring, Consul for service discovery, Python scripts for container agents, and Docker for resource isolation. Custom scripts written by DBAs handle cluster creation, high‑availability management, and integration with middleware.

Resource scheduling follows strict rules: CPU can be oversold up to three times, memory is not oversold, primary‑replica pairs never share a host, and shards are spread across multiple physical machines. The system automatically selects idle machines within the same data center and respects VIP requirements.

Backup uses Percona XtraBackup with streaming to multiple remote backup servers, controlling parallelism to avoid I/O saturation. Monitoring switched from Zabbix to Prometheus with Grafana dashboards, pulling metrics via Consul‑registered agents. Alertmanager alerts are routed through a custom API to provide multi‑dimensional context.

Slow‑log analysis is performed hourly with pt‑query‑digest, storing results in a dedicated database and offering UI features such as EXPLAIN and table status inspection.

Cluster management is the core of the platform, offering unified operations per cluster, integration with middleware, dashboards, and diagnostic tools. High‑availability relies on MHA with custom extensions for MariaDB GTID support and dynamic parameter tuning during failover.

Data migration leverages mydumper/myloader for full loads and a custom parallel replication tool for incremental sync, complemented by a fast data‑validation utility.

The platform abstracts physical resources from users, providing on‑demand database services while maximizing CPU utilization through overselling and controlling memory per instance, thereby preventing OOM situations.

Operational efficiency improved dramatically: a sharded cluster that previously required six hours to deploy can now be provisioned in five minutes, with automated middleware configuration and high‑availability setup.

Fine‑grained management ensures one‑database‑one‑instance isolation, improving resource utilization and enabling per‑database performance monitoring.

In conclusion, the private cloud database platform marks the transition from costly, manual DBA operations to a low‑cost, high‑efficiency, highly reliable era for Tongcheng Travel.

migrationmonitoringDockerHigh AvailabilitymysqlBackupdatabase platform
Tongcheng Travel Technology Center
Written by

Tongcheng Travel Technology Center

Pursue excellence, start again with Tongcheng! More technical insights to help you along your journey and make development enjoyable.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.