Case Study: Scaling Ticketing and Flight Booking Systems with TiDB at Tongcheng Network
This article details how Tongcheng Network migrated massive ticketing and flight‑booking workloads to TiDB, combining sharding and a distributed SQL database to handle terabytes of data, real‑time monitoring, and high QPS traffic while simplifying operations and reducing costs.
Project Background – The team first learned about TiDB from the chief architect of Tongcheng Network and faced challenges with large‑scale data queries and real‑time aggregation that MySQL could not satisfy, prompting the development of a custom DBrouter and the search for a better solution.
Rapid Business Growth – In late 2016 the ticketing platform (train, flight, etc.) experienced a traffic surge, pushing the order database size to several terabytes and increasing the need for sharding to relieve pressure before the National Day peak.
Introducing TiDB – After evaluating internal sharding, the team found that complex queries caused full‑table scans that consumed over 80% of I/O. They adopted TiDB for complex queries while keeping the sharding cluster for simple ones. Using PingCAP’s Syncer (customized for database and table naming) they set up real‑time MySQL‑to‑TiDB replication with monitoring of TPS and latency, and integrated alerting via WeChat.
Stress Testing and Deployment – Joint stress tests showed that the combined sharding + TiDB architecture met functional and performance requirements. Thousands of MySQL shards were consolidated into a single TiDB cluster, successfully handling double the normal traffic during the 2016 National Day peak without incidents.
Monitoring Architecture – Grafana dashboards were built for TiDB and TiKV metrics, and TiDB alerts were fed into the company’s monitoring and self‑healing systems, enabling automatic detection and remediation of anomalies.
Scaling Up – Following the ticketing success, the flight‑booking sync was also migrated to TiDB. By the time of writing, Tongcheng operates multiple TiDB clusters across nearly a hundred servers, storing tens of terabytes (the largest cluster holds over ten terabytes and more than 10 billion rows), serving over a hundred million daily accesses with average QPS around 5,000 and peaks exceeding 10,000.
Benefits – TiDB’s MySQL‑compatible protocol and standard SQL make it easy for developers to adopt with minimal learning curve, while DBAs appreciate its built‑in high availability and dynamic scaling, reducing operational overhead.
Future Outlook – Anticipating continued growth, the team plans to adopt TiDB DBaaS based on Kubernetes (TiDB‑Operator) to automate deployment, scaling, and failover, and to explore TiSpark for real‑time analytics and data warehousing, aiming to start a pilot in 2018.
Tongcheng Travel Technology Center
Pursue excellence, start again with Tongcheng! More technical insights to help you along your journey and make development enjoyable.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.