Author: Jun Yu (solution architect at PingCAP)
Transcreator: Ran Huang; Editor: Tom Dewan
The financial industry, especially banks, needs a robust system to support their complicated transactions. With the development of technology, the core banking system has evolved—from a traditional centralized system to a distributed, service-oriented architecture (SOA).
As an open-source, distributed SQL database, TiDB is widely adopted by banks, securities, insurance, online payments, and FinTech companies, and it supports our users in over twenty mission critical business scenarios.
In this article, I will introduce these critical business scenarios of the financial industry and the pain points they have using their current technology. After that, I'll also show you three TiDB solutions that tackle these problems.
Banks have complicated businesses, from the core banking business (accounting and settlements), to peripheral business (deposits, loans, and currency exchanges), to Internet-oriented financial business.
To facilitate their future growth, many banks have started to introduce distributed technology into their transactional or real-time analytical applications and the data processing layers. They also try to adopt cloud computing, microservices, and serverless technology in their core banking systems.
In the distributed architecture, the database plays an important role and thus must meet stringent requirements:
Currently, most banks use a traditional centralized database and MySQL-based sharding solutions as the database solution for the core banking system. However, a centralized database has the following disadvantages:
MySQL-based distributed databases, or say MySQL sharding solutions, also have limitations:
TiDB is an open-source NewSQL database that supports Hybrid Transactional and Analytical Processing (HTAP) workloads. It is MySQL compatible and features horizontal scalability, strong consistency, and high availability. TiDB is now widely used by the financial industry in North America, China, Japan, and Southeast Asia, as well as by nonfinancial companies across the globe.
Currently, TiDB provides three solutions for the core banking system. You can:
The following table compares the traditional centralized solution, the MySQL-based solution, and the TiDB-based solutions. The best performance in each category is shown in bold:
Solutions | Traditional centralized solution | MySQL-based distributed solution | TiDB as the core database | MySQL as the primary + TiDB core backend database |
---|---|---|---|---|
Online transaction throughput | Restricted by hardware resources | High, scalable | High, scalable | High, scalable |
Online transaction latency | Low | Low | Middle or low (depends on the load) | Low |
Batch processing | Restricted by hardware resources | Low | High | High |
Aggregation query | High (centralized architecture) | Low | High (real-time query) | High (real-time query) |
Application changes required | Minimal changes | Significant changes; the database is intrusive to application logic logic | Minimal changes; the database is transparent to applications | Minimal changes; the primary database is split into units; the backend database is transparent to applications |
Scalability | Low | Statically scale | Dynamically scale | Dynamically scale |
Elastic scalability | Low | Low | High, online scale | High, online scale |
High availability | High | Middle (primary-secondary replication) | High (strong consistency based on Raft) | Primary database (primary-secondary architecture), backend database (strong consistency based on Raft) |
Disaster recovery | Disaster backup in both the same city and another city | Middle (primary-secondary replication) | High (strong consistency based on Raft and scheduling) | High (strong consistency based on Raft); TiDB as the backup plan |
Build and maintenance costs | High | Low build cost, high maintenance cost | Low | Low |
This solution uses TiDB as the primary database of the core banking system. TiDB is transparent to applications, so applications and developers use TiDB in the same way they use the traditional standalone databases. The details are transparent to the applications. The architecture of this solution is shown below.
As the core transaction application grows, the transaction may take place not only in the account dimension but also in the customers dimension. Therefore, simply sharding the database by accounts will sacrifice business flexibility. With TiDB, you do not need to manually shard the application model, data model, or transaction model.
Moreover, TiDB's built-in multi-active disaster recovery mechanism simplifies its deployment, management, and cost. Its distributed transaction model doesn't need extra application logic, which gives users the same experience as a standalone database. TiDB has a dynamic scheduling mechanism that can scale out nodes with no impact on the online services.
To sum up, using TiDB as the primary database of the core transaction system brings the following merits:
We've made TiDB easy to integrate with the core transaction systems of many city commercial banks. We have fully adapted TiDB to the Sunline core banking system's essential modules: accounts, debts, loans, credit card issuing, cash management, and asset balance. TiDB has been optimized for functionality, correctness, and performance and passed over 2,000 functionality tests, including nearly 200 batch processing tests.
In the next stage, we will partner with Sunline to test TiDB on its new core banking system and the ARM-based platform.
The second solution is using a MySQL cluster for Online Transactional Processing (OLTP) and TiDB for Online Analytical Processing (OLAP), as shown below:
The core transaction applications are split according to their application logic. The data processing takes three steps:
Like the previous solution, this one uses MySQL for core transactions and TiDB for the backend. The difference here is that the applications are split into different microservices or units.
In this architecture, multiple databases correspond to the core database. As the backend database for the core banking system, TiDB can use CDC to ingest all the data from the global databases (the customer center, product center, and accounting center).
For sharded databases that are split vertically at the application layer, data can be aggregated through CDC into a global database in TiDB. In this global database, we can perform batch processing operations across different service units, including complex queries and reporting. Meanwhile, the databases that share services still exist in the TiDB cluster as separate logical databases and provide services for the applications.
WeBank, a Chinese neobank unicorn, uses this solution for their mission critical system. (To learn more, see their case study).
WeBank has made innovations in the unitization of core banking systems. In the past four years, WeBank has adopted the data center node (DCN) distributed extensible framework for core transaction processing. The application layer is easy to extend, and the database layer is kept simple.
A DCN refers to a fully-functional logical “bank”. Many DCNs work together to support the real bank's business. An independent organization, such as a bank branch, can accommodate its business growth by horizontally scaling DCNs. WeBank also uses an online transaction database based on MySQL sharding and separates transactions from accounting. By applying distributed database technology, WeBank transfers the batch processing and accounting operations to the backend database—the distributed cluster.
By using TiDB as the backend database, you can enjoy the following benefits:
TiDB is also ready for the core banking system and other mission critical systems in the future. It is cloud-native and can run in Kubernetes, which lays the foundation for running in public or private clouds. It has recently been adapted to some cloud infrastructure platforms, including OpenShift and Rancher. With TiDB's cloud resource scheduling capabilities, it will provide multi-tenancy support in the cloud.
TiDB also combines row store and column store in one architecture, which will smooth the way for future applications. TiDB is also working with Apache Flink to develop stream processing solutions that empower real-time data processing.
Finally, TiDB can schedule data across data centers. In a multi-center architecture, TiDB can dynamically associate data with data centers and establish the association between data tables according to locations. This reduces cross-site requests and lowers latency. What's more, TiDB can separate hot data from cold data and schedule them flexibly.
For more information on TiDB's practices in the financial industry, join our Slack channel or stay tuned for our coming blog posts!