Industry: Banking
Authors:
Transcreator: Caitin Chen; Editor: Tom Dewan
WeBank is China's first privately-owned internet bank. It is backed by reputable companies such as Tencent. It offers convenient and high-quality financial services to underbanked individuals as well as small- and medium-sized enterprises. So far, we've served 250 million+ individual customers, 20 million+ individual business customers, and 1.5 million+ corporate customers.
As our businesses grew, our data size soared, and we encountered database performance and capacity bottlenecks. After we compared multiple solutions, we chose TiDB, an open-source, MySQL-compatible, NewSQL database. Thanks to its horizontal scalability, in a financing system, our batch processing time has been reduced by about 58%. In our evidence data storage system, we fixed the capacity bottleneck and improved the throughput.
In this post, I'll share with you why we chose TiDB over other solutions and how we use TiDB as an alternative to our MySQL database in typical financial scenarios.
To make our applications horizontally scalable, we designed a distributed, scalable core architecture based on a Data Center Node (DCN). A DCN includes an application layer, an access layer, and a database. Each DCN carries a specified number of users. You can treat a DCN as an online virtual branch of WeBank. This virtual branch serves only a subset of WeBank's customers.
This architecture has these advantages:
But we encountered a problem. Internally, DCNs use a single-instance deployment mode. In some application scenarios, we couldn't split a DCN to scale out the database. And in some scenarios, we needed to aggregate data. In these cases, a single instance's performance and capacity quickly caused a bottleneck.
To solve the problems above, we did a thorough investigation and evaluation. In 2018, we compared multiple NewSQL databases and finally adopted TiDB.
TiDB is an open-source, distributed, Hybrid Transactional/Analytical Processing (HTAP) database developed by PingCAP and its open-source community.
TiDB attracted us, because it had these advantages:
So far, we've deployed TiDB in dozens of application systems in the production environment. These systems’ data volumes range from hundreds of gigabytes to dozens of terabytes. Currently, multiple important systems are under proof of concept (POC) or are ready for the production environment.
Today, I'll introduce how we're using TiDB in two important scenarios:
Every day, one of our financing systems replicates tens of millions of basic data from the upstream system, and, in the future, it's expected to access more product data. Before we adopted TiDB, we faced data currency pressure, and our database capacity was expected to become our bottleneck. In addition, because our system relied on the upstream system's table schema, it often followed the upstream system to make data definition language (DDL) changes, while the pt-online-schema-change (pt-osc) solution has many limitations.
We had these problems:
Thanks to TiDB's horizontal scalability, our batch processing time has been reduced by about 58%. In the future, we'll use TiFlash, TiDB's analytical engine, in the production environment for offline report statistical logic to reduce processing time.
The evidence data storage system is a very important WeBank system.
Before we used TiDB, we encountered system capacity and throughput bottlenecks. As we connected more application systems to this system, data quickly grew. We couldn't find a MySQL-compatible database that could keep up. In addition, the application data was global data that couldn't be split based on DCN, so it couldn't horizontally scale.
To solve these issues, we decided to migrate from MySQL to TiDB with TiDB Data Migration, an integrated data migration tool. During migration, we hoped:
The migrating process was a little long, but it was smooth and secure. After we performed a series of migration operations and observations, all our performance metrics were stable. Therefore, we decided to disconnect reverse replication to MySQL. This means that our evidence data storage system is completely running on TiDB. Due to TiDB's horizontal scalability, we've fixed the capacity bottleneck and improved the throughput.
Because of TiDB's horizontal scalability and MySQL compatibility, we can use it as an alternative to the MySQL database to resolve our database capacity and performance bottlenecks.
Since WeBank was established, technology has always been the core engine driving our business development. Now, our core system can support 100 million+ users and highly concurrent transactions. We've achieved an average of 300 million+ daily transactions and a peak of 600 million+ single-day transactions. Our operation and maintenance cost per account is less than one-tenth of the industry average.
In the future, based on our application requirements and TiDB's new features, we'll explore more application scenarios at WeBank.
If you'd like to learn more about our experience with TiDB, you can join the TiDB community on Slack.