Ctrip DAL: An Open‑Source Database Access Framework for Scalable Enterprise Development
The article introduces Ctrip DAL, an open‑source Java/C# database access framework that supports sharding across MySQL and SQL Server, provides a code generator and client library, and helps large enterprises manage multi‑team, multi‑database environments while ensuring scalability, consistency, and security.
As enterprises expand, database development evolves from a single team to multiple teams, from a single machine to clusters, from a single database to many, and from a single vendor to multiple products, creating new operational complexities.
This growth brings challenges such as managing database expansion, standardizing access, protecting existing investments, handling increased traffic, and preventing security issues.
To address these challenges and support ten‑fold growth, Ctrip, a leading online travel company, created its own database access framework called Ctrip DAL.
Ctrip DAL supports popular sharding and partitioning operations, works with Java and C#, and is compatible with MySQL and Microsoft SQL Server, enabling rapid, reliable horizontal scaling while safeguarding existing database investments.
The framework consists of a code generator and a client library. The generator produces DAO code through an online wizard, allowing batch generation of standard DAOs or method‑level customizations; the client is added to projects via a standard Maven dependency.
The key distinction of Ctrip DAL is its enterprise‑wide, cross‑departmental management of database resources, allowing centralized control of DAL development teams, clear ownership of databases, and uniform access patterns, which dramatically improves efficiency and code quality.
DAL defines rich extension interfaces covering data source management, database mapping, connection‑string retrieval, and custom access methods, and includes built‑in modules for system status monitoring, logging, and statistics.
Developed by Ctrip's framework team over three years, the framework now supports over 117 independent DAL teams, more than 2,000 applications, and accounts for over 90% of Ctrip's database‑driven applications.
The open‑source release includes the code generator and the Java client; a C# client will be released soon, with comprehensive documentation for installation and immediate use.
By open‑sourcing the framework, Ctrip aims to meet its own needs while serving other enterprises and contributing to the growing open‑source movement in China.
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
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.