Building a Web-Based Platform with PolarDB: Yuanfudao Case Study

The enormous amount of issue databases, audio and video frequency answer materials, user data and diaries has provided stringent requirements for Yuanfudao’s back end data storage and processing abilities. Owing to the education guidance industry business features, Yuanfudao is also facing huge challenges of business peak values for data bank capacities. This text introduces to everyone how the Alibaba Cloud PolarDB helps Yuanfudao build a web-based platform for “Children Like Teachers”?

Image for post
Image for post

Yuanfudao Business Background

Challenges Faced by Yuanfudao’s Self-Configured Database Scheme

Solutions Based on the PolarDB Database

Image for post
Image for post

Alibaba Cloud PolarDB Minute-level Elastic Database Cluster

Image for post
Image for post

Alibaba Cloud PolarDB hierarchical architecture drawing

As shown above, PolarDB is a hierarchical architecture. The proxy PolarProxy from the top layer provided such functions as the read-write splitting and SQL acceleration, the database engine node PolarDB at the middle layer creates a database cluster of multiple-read single-write, and then the distributed storage PolarStore at the lower layer provides data sharing with multi-node mounting for the top layer. Each of these layers handles its respective duties, and they jointly make up the PolarDB Cloud database cluster.

From the definition of the PolarDB product, what is meant by the number of nodes purchased by users and the specification size (e.g., 4 cores, 16G) is the configuration of the PolarDB in this middle layer and the upper layer PolarProxy can self-adjust based on the configuration of the PolarDB. Users do not need to purchase it and also do not need to be concerned about performance or capacity. The capacity of the lower layer PolarStore is automatically enlarged, and it is only necessary to pay based on the capacity that is actually used.

Regarding scalability in the ordinary sense, there are generally two modes, scale up and scale out, scale up means upgrading the configuration, while scale out means the configuration is unchanged but the nodes are increased. As for the databases, they are all first scale up, for example if 4 cores are insufficient it is upgraded to 8 cores. However, eventually there will be bottlenecks. On the one hand, the performance improvement is nonlinear, and this is related to the design and application access model of the database engine itself (in the multi-threaded design of MySQL, if there is only one session it very hard to embody the advantages of several cores), while on the other hand there is an upper limit to a physical calculation server and a ceiling exists. Therefore, the ultimate means is to scale out and to add more nodes.

Image for post
Image for post

Schematic diagram of the Alibaba Cloud console PolarDB upgrade and downgrade operations

As far as PolarDB is concerned, its elasticity can be summarized as “capable of achieving a maximum of 16 nodes horizontally, and capable of achieving a maximum of 88 cores vertically, and in addition the storage capacity expands dynamically, and there is no need to configure it.” In the background of this kind of powerful elastic ability, how is the lower layer of the PolarDB ultimately realized? Next an introduction from three aspects, horizontal, vertical and storage will be provided.

Vertical expansion (upgraded/downgraded configuration): Thanks to storage and computing separation, the configuration of the PolarDB database nodes can be separately upgraded or downgraded. If the current server resources are insufficient, it is also possible to migrate rapidly to other servers. The entire process only requires 5–10 minutes at present, and there is no need for any data relocation in the middle, but if cross-machine migration is involved, it is possible to eliminate the effects of upgrading on the business applications by PolarProxy in the future. Because at present all of the nodes within the same cluster must be bound and upgraded, PolarDB has adopted the rolling upgrade method, and it has further reduced unavailable time by controlling the pace of upgrading and arranging master and backup switches.

Horizontal expansion (increased/decreased nodes): Since the memory is shared, it is possible to increase the nodes rapidly, and no data COPY of any kind is needed. The entire process only requires 5–10 minutes. If nodes are increased, there is no effect at all on the business applications, but if nodes are decreased, there is an effect only on the connection that falls on the said node execution, and the connection can be re-established. After the nodes are increased, PolarProxy can dynamically detect and automatically include it in the read node of the read-write splitting back end. It is possible to immediately enjoy better performance and throughput for using the cluster access address (the read-write splitting address) to connect to the application programs of the PolarDB.

The storage space that does not need management: You do not need to be concerned about PolarDB’s storage space as payment works on a pay-as-you-go basis, settled automatically for each hour. In the current design, the I/O ability is related to the specification of the database node. The larger the specification is, the higher the IOPS and I/O throughput will be. There are isolation and restrictions for I/O on the node, and it is possible to avoid I/O contention between several database clusters. Essentially, the data is saved in a storage pool composed of a large number of servers. Owing to reliability requirements, 3 copies are replicated for each data block, and these are saved on different servers on different racks. The storage pool can carry out self-management, dynamic expansion and balancing, and it prevents storage fragmentation and data hot spots.

The Benefits Obtained by Yuanfudao from Using PolarDB


Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store