Author: 0xfade, Head of Infra and Blockchain Development

TiDB has been a game-changer for our platform. We’ve cut operational costs by 40% while scaling seamlessly to handle growing Web3 data. Its real-time processing and simplified infrastructure have helped us innovate faster and deliver a better user experience.” — 0xfade

Executive Summary

This case study explores how a leading decentralized finance (DeFi) analytics platform, leveraged TiDB to overcome scalability challenges and improve operational efficiency. By integrating TiDB, they achieved a 40% reduction in operation costs and query times while enhancing business agility. 

The transition to TiDB allowed seamless scaling to handle the growing Web3 data and provided real-time data processing for OLTP and OLAP queries. This shift simplified the platform’s technical architecture, enabling the company to enhance user experience and accelerate product innovation in the dynamic DeFi space.


Company Overview

The platform is a leading decentralized finance (DeFi) analytics provider that offers users comprehensive tools to manage, track, and optimize their DeFi investments. Launched in 2018, the platform aims to simplify the complexities of the DeFi ecosystem by providing a user-friendly interface and powerful features for tracking assets, yields, and protocols.

The platform offers several key features to its users, including:

  • Portfolio Tracking
  • DeFi Protocol Aggregation
  • Yield Analysis
  • Loan and Debt Tracking
  • Cross-Chain Compatibility
  • Security and Privacy
  • Comprehensive Analytics

These features allow users to manage and monitor all their DeFi investments from a single platform, saving time and reducing the complexity of managing assets across multiple services.

As a vital tool for DeFi enthusiasts and investors, the platform contributes significantly to the growing adoption of decentralized finance by making it more accessible and manageable. Its focus on user experience and in-depth data analysis helps bridge the gap between complex DeFi protocols and everyday users.

Overall, the platform plays a crucial role in the DeFi ecosystem by offering valuable tools and insights that empower users to navigate the rapidly evolving world of decentralized finance effectively.

Challenge: Scaling and Performance Optimization in a Growing Web3 Platform

The platform’s primary challenge is developing a high-performance DeFi API and on-chain DeFi dataset SQL API that can handle real-time OLTP (Online Transaction Processing) and OLAP (Online Analytical Processing) queries to meet diverse needs. Their pivotal features—the DeFi API and the on-chain DeFi dataset SQL API—utilize different data stacks, including RDS for MySQL sharding and AnalyticalDB. The challenges they are facing include:

  • Lack of Scalability: With the surge in Web3 data volume and rapid user growth, the business plans to continually expand its operations to achieve a greater competitive edge. This will result in the ongoing growth of its data—from a few terabytes to tens or even hundreds of terabytes and possibly reaching petabytes in the future. They aim to avoid making significant changes to the database infrastructure over the next five years. The platform faced challenges in scaling effectively, particularly during peak traffic periods.
  • Low Query Performance: Handling complex join queries with RDS for MySQL sharding proved inadequate for large Web3 data volumes. A system capable of executing extensive data queries with both speed and precision was crucial.
  • Complex operation: Managing multiple RDS for MySQL sharding clusters for the DeFi API and maintaining separate data copies in MySQL and AnalyticalDB for the DeFi dataset SQL API led to significant operational and development overhead. Balancing costs while maintaining high service levels became a critical challenge.
  • Low data flow efficiency:Originally, data analysis relied on AnalyticalDB, which brought more data processing time costs, and this is user-friendly to businesses.
  • Lack of Agility: As their business grew rapidly, the need to continuously upgrade their product to meet evolving demands became pressing. The current tech stack was insufficient to keep up with the fast-paced growth.

The Solution: Embracing TiDB, a Distributed MySQL-Compatible HTAP Database

To overcome the problem they were facing, the platform turned to TiDB for a long-term, all-in-one database solution that would provide a better user experience and accelerate their product upgrade.

To meet business compliance requirements, migrating to AWS Cloud presented multiple challenges for the team. First, the existing tech stack lacked a fully compatible database solution after the migration. The team also sought this opportunity to upgrade and improve their tech architecture while aiming to reuse as much of the existing code as possible.

In this situation, TiDB became the optimal choice. Its compatibility with the MySQL ecosystem made code modifications straightforward, allowing the original application framework and ORM to require minimal adjustments. The system could run smoothly on the new database with just a few tweaks.

At the same time, the team was able to migrate the existing data using TiDB’s official DM tool. This tool supports merging sharded tables into a single table, making the migration process easy and efficient.

The cloud migration and database architecture upgrade were completed within two months. Ultimately, TiDB not only met the current business’s performance requirements but also supported the organization’s future growth needs through its scalability.

Benefits of migrating to TiDB

The platform’s adoption of TiDB has improved its data management, particularly enhancing its Defi data API and SQL API services.

Key benefits include:

  • Enhanced Scalability: TiDB’s distributed architecture allows the platform to seamlessly scale its database to handle the growing volume of Web3 data and increase user traffic, ensuring consistent performance even during peak periods.
  • Improved Data Querying: TiDB’s support for OLTP and OLAP queries enables efficient processing of complex and large-scale data queries. This ensures that the platform can deliver real-time insights and precise data analytics, which are crucial for effective DeFi operations.
  • Cost Efficiency: By consolidating their data infrastructure into a single, unified system, the platform has reduced the need for multiple RDS for MySQL sharding clusters and duplicated data storage. This streamlining reduces operational costs and minimizes development overhead.
  • Real-Time Data Insights: Depending on TiDB’s HTAP ability, the platform doesn’t need to process the data flow. This shortened their data analysis cycle and ensured the timeliness of data analysis.
  • Greater Agility: TiDB’s flexibility and ease of use facilitate rapid updates and product enhancements, allowing the platform to quickly adapt to evolving market demands and continue innovating in the fast-paced DeFi space.

Conclusion

By integrating TiDB, the platform successfully overcame its scalability and performance challenges, reducing operational costs by 40% and significantly improving business agility. 

TiDB’s distributed architecture allowed the platform to handle the growing volume of Web3 data and user traffic seamlessly while improving query performance for both OLTP and OLAP workloads. The transition streamlined the platform’s infrastructure, eliminating the need for multiple data stacks and reducing the complexity of managing large-scale DeFi data. 

With real-time data insights, enhanced scalability, and reduced operational overhead, the platform is now better positioned to innovate quickly and meet evolving market demands in the fast-paced DeFi industry.

Elevate modern apps with TiDB.

Book a Demo