CTW Inc. is a Japanese mobile game and internet service provider founded in 2013. It offers services in seven countries and regions, including Europe, the United States, South Korea, Taiwan, and Japan. G123.jp, CTW’s HTML5 gaming platform, offers a wide selection of high-quality games including Vivid Army and Queen’s Blade. Their service has grown rapidly and now has over 50 million users worldwide.
Winning the customer over a second
The G123.jp platform lets a user enjoy their game on a web browser as long as they are connected to the internet, regardless of their gaming environment. As CTW’s service expands globally, their need for database capacity expands, too.
As Zilin Tan, CTW’s Chief Data Architect, explains:
Providing users with a better experience is what CTW has been striving for. The advertising business is a core service in CTW, which helps us control customer acquisition costs and grow gamers rapidly. To achieve accurate user positioning, the data service must reflect the user conversion data to the advertising AI system within one second.
Challenges with Aurora-based solution
CTW originally used Amazon Aurora as their backend database and Amazon Redshift for analytics.
Original architecture at CTW
When the data volume of a single table increased to 100 million rows, maintenance became difficult. The challenges included:
- Amazon Redshift is not good at handling data updates in real time. As data volume increased, the solution couldn’t meet the real-time requirements of advertising.
- Updating and maintaining Aurora is hard. Aurora required more than a month’s advance planning each time for downtime maintenance or upgrading. To guarantee service continuity, the CTW team could only do maintenance in the middle of the night.
- Online Data Definition Language (DDL) operations with Aurora are inefficient. To provide an uninterrupted gaming experience, the CTW team used online DDL changes for database maintenance. However, online DDL with Aurora usually took hours and sometimes failed due to lack of resources.
- Replicating business data takes extra effort. Some Aurora clusters applied Aurora Serverless, the on-demand, autoscaling configuration for Amazon Aurora. However, Aurora Serverless doesn’t support binlog. This makes it impossible to replicate data and causes more maintenance downtime.
Migrating to TiDB
Not only did CTW want to solve these problems, but they also wanted to run their data services and analytics in one database. The cost of migrating data to the new database had to be minimal.
CTW investigated YugaByteDB and TiDB. YugaByteDB only supports PostgreSQL interfaces, so it was not an option. CTW decided to try TiDB because it is:
- MySQL compatible. There is no change on the application side. Migrating data is easy.
- Cloud-native. Kubernetes Operator for TiDB makes it easy to deploy TiDB on the cloud. This is also in line with CTW’s cloud strategy.
- Horizontally scalable, thanks to its compute-storage decoupling architecture.
- Highly available. Data is stored in three replicas across availability zones. There is no risk of a single point of failure.
- A Hybrid Transactional and Analytical Processing (HTAP) database. The combination of row store and column store allows TiDB to process data services and analytics in the same database.
When CTW first deployed TiDB, it worked fine. However, the team soon realized that they didn’t understand TiDB well enough to handle infrastructure issues such as service outages. This led them to TiDB Cloud, the fully-managed TiDB service.
As Bin Hou, Chief Engineer at CTW, says,
Switching to TiDB Cloud from TiDB was seamless. TiDB Cloud was up and running immediately after we connected to the network via Virtual Private Cloud peering. When we encountered failures or performance issues during database migration, PingCAP’s technical service team was able to provide fast and efficient support. Thanks to the direct support from PingCAP, we had more confidence in the migration and were able to quickly resolve some legacy issues.
Triple the throughput on TiDB Cloud
TiDB Cloud supports three data services on the G123.jp platform: user segment, advertising data, and campaign data. To Zilian Tan, the benefits of using TiDB Cloud were clear. “The data services run stably with significant performance improvement. This translates into a great user experience. With better advertising data service brought by TiDB Cloud, we are able to reduce our customer acquisition costs.”
Architecture on TiDB Cloud
Millions of rows of data are replicated to TiDB Cloud every day. The throughput is three times more than that of Aurora, with query and write capabilities both improved. Thanks to the Raft-based data replication, there is no data latency issue with our platform. At the same time, TiDB’s built-in columnar storage, TiFlash, improves analytics performance without changing the application.
CTW tested TiDB Cloud for about a month and finished their migration the following month. TiDB Cloud addresses CTW’s challenges with better advertising data service, reduced customer acquisition costs, and easier maintenance. In the future, CTW expects more data services to run on TiDB Cloud.