Background

Kwai is one of the top short video and live streaming apps player, aiming to capture content from all facets of everyday life. With the power of technology, Kwai hopes to enhance the unique sense of happiness for everyone. Users can record moments in their lives by taking photos and creating short videos. Additionally, they can interact with their followers in real-time through live streaming. Founded in 2011, Kwai has been listed since 2021 and has attracted hundreds of millions of daily active users. This, on one hand, drives the rapid growth of the company's e-commerce businesses, and on the other hand, places an unprecedented load on the underlying system.

Challenges

1. Storage bottleneck

When Kwai's order management business total data volume of orders hit 150 TB, the storage bottleneck and performance issues of its standalone centralized MySQL database worsened and impact customer experence. 

2. Increasing number of MySQL database shards

To mitigate the business impact, Kwai attempted database and table sharding to deal with storage and performance issues. However, the number of database shards increased along with business growth. Before migrating to OceanBase Database, Kwai had created more than 300 MySQL database shards, increasing database management complexities. 

3. Exhausting application adaptation

The increasing number of database shards not only made O&M more costly and complex but also led to endless application adaptations. Kwai realized that its workarounds only alleviated the business issues and would never provide a permanent solution. What it needed was a solution that could reduce the O&M complexity and meet performance requirements. 

Solution

1. High compatibility with MySQL

The O&M team can use OceanBase Database in the same way as they use a MySQL database. Furthermore, OceanBase Database is compatible with MySQL protocols and syntax, allowing legacy data to be smoothly migrated and significantly reducing the costs of business migration and transformation.

2. Three IDCs within the same city

OceanBase Database can be deployed across three IDCs within the same city. This deployment mode reduces the recovery point objective (RPO) to zero and the recovery time objective (RTO) to less than 30 seconds in  case of disasters. A read-only zone can be added in another city to provide local read services to improve query efficiency. Features such as zone-disaster recovery and local read further enhance the business stability and performance.

3. Flexible resource scaling

The capacity of OceanBase Database can be linearly scaled in response to the actual business development to support the storage and computing of massive amounts of data. This allows Kwai to get ready for future business growth.

​4. Ultra-high data compression ratio

Compared with a conventional centralized MySQL database, OceanBase Database compresses data in the storage at an ultra-high data compression ratio, which significantly reduces the hardware costs of enterprises.

Solution

Scenarios

Kwai has deployed eight OceanBase clusters to support its short video platform, managing over 800 TB of data across more than 200 servers. The data volume of the largest cluster is over 400 TB and growing. Kwai upgraded all clusters from OceanBase Database V3.1 to V4.2 to provide online services, including clusters that host the core transaction verification system and payment system, as well as clusters that handle high-concurrency data writes in place of the previous master MySQL database. After the upgrade to OceanBase Database V4.1, the clusters demonstrated significant improvement in business benefits and stability.

Transaction verification

As a short video platform, Kwai provides e-commerce services to meet the needs of prospective shoppers when they swipe through videos. Typically, e-commerce services attract stable traffic, generating 80,000 to 90,000 queries per second (QPS) daily. However, during a live streaming event with a massive audience, the traffic increases dramatically, and the QPS value often soars by 10 or even 100 times, reaching over a million. The compressed data volume can exceed 100 TB.

The distributed architecture of OceanBase Database is horizontally scalable. Faced with an increasing amount of data, Kwai has the option to scale out the storage and computing resources of the clusters to deal with large table queries and storage issues. OceanBase Database also provides native distributed capabilities and demostrated better performance in processing distributed transactions. After OceanBase Database is put into operation, each data record written to shards of the MySQL cluster from upstream business modules is synchronized to OceanBase Database in real time by using binlogs. A data query in the upstream MySQL cluster also triggers the same query in OceanBase Database. The query results are compared to ensure the consistency of the order status in the entire accounting system.

Payment business

Payment data must be processed in real time in e-commerce business. On one hand, merchants and customer service staff check the sales in a live streaming event based on the payment data. On the other hand, the payment gateway uses the payment data for aggregate queries. With the online scalability of OceanBase Database, the storage of large amounts of data is no longer a problem. Additionally, the hybrid transaction/analytical processing (HTAP) capability of OceanBase Database allows the system to handle real-time query and analysis while ensuring data writes. In this business scenario, OceanBase Database has demonstrated performance equivalent to analyzing complex SQL statements as Elasticsearch. Furthermore, OceanBase Database supports online indexing. This feature allows Kwai to perform DDL operations at any time. By replacing the previous MySQL + Elasticsearch solution with OceanBase Database, Kwai not only saves the cost of Elasticsearch services and hardware but also significantly reduces the costs of MySQL hardware. Compared with the previous solution, OceanBase Database meets query requirements with 50% fewer server resources.

Benefits

1. More efficient and convenient O&M

More than 300 MySQL database shards/instances are aggregated into one OceanBase cluster, making management easier with greatly reduced O&M costs. 

2. Significant storage cost reduction

OceanBase Database stores hundreds of terabytes of data with guaranteed performance and stability with Paxos replication protocol. Compared with the previous solution, the storage cost of the OceanBase solution is slashed by 75%. 

3. Improved data synchronization performance

The latency from data writing in the upstream business modules to the response of the downstream OceanBase cluster is reduced, making data synchronization faster. The synchronization latency time is reduced by 75%.

Explore more success stories

View all stories
Haidilao

Founded in 1994, Haidilao International Holding Ltd. (Haidilao) has been listed on the Main Board of the Hong Kong Stock Exchange since 2018. As one of the Fortune 500 companies in China, Haidilao is the most valuable catering chain in China, boasting an annual income of more than CNY 10 billion. Haidilao also ranked 60th in the Brand Z™ Top 100 Most Valuable Chinese Brands 2022 list, making it the only catering brand to achieve this ranking.

Read more
POP MART

Founded in 2010, POP MART is a leading pop culture and entertainment company. Over the past decade, POP MART has expanded its business globally, focusing on artist mining, product incubation and operation, consumer outreach, cultural promotion, business model innovation, and investment. The company has successfully built an all-round operational platform that integrates the entire supply chain of the trendy toy industry. As of December 31, 2021, POP MART has 295 brick-and-mortar chain stores and 1,611 roboshops in 103 cities across the Chinese Mainland

Read more
Ctrip

Founded in 1999, Trip.com Group is an online ticketing service company headquartered in Shanghai, China. As a leading platform for hotel booking in China, Trip.com has partnered with more than 600,000 hotels all over the world, and went public on Nasdaq in December 2003. On October 29, 2019, the company officially rebranded as Trip.com Group. On April 19, 2021, Trip.com was listed on the Hong Kong Stock Exchange.

Read more
Lichu Business Service

Founded in 2011, Wuhan Lichu Business Service is one of leading companies of aggregate payment technologies in China. In 2016, the company released Saobei, the fourth-party payment middle platform, to provide an overall payment solution. As a digital business service provider for merchants, Lichu works with merchants to promote their digital operation through a combination of payment and value-added services.

Read more

Transform your data infra with OceanBase