Quickly Build a Cloud Native E-commerce Platform
This article is based on the content of the SOFAStack Cloud Native Workshop event in KubeCon China 2019. This article will first go into the details of how cloud native emerged as a new and powerful alternative to a traditional centralized architecture, and then we will discuss how Ant Financial switched to cloud native for their architecture solution, Last, we will look at how you can quickly build a cloud native e-commerce platform like the one demoed at the SOFAStack Cloud Native Workshop at KubeCon.
On June 25, 2019, at KubeCon China 2019, Cloud Native Computing Foundation (CNCF), a world-renowned open-source organization, announced that Alibaba’s Ant Financial has now become an official CNCF gold member, being at the second top tier. On hearing the news, representatives from Ant Financial said that they would continue to increase support for open-source projects, including Kubernetes, Service Mesh, Serverless, and secure containers, and would exert their own strength.
At this conference, Ant Financial developers also worked to build a Cloud Native e-commerce platform with hundreds of Cloud Native enthusiasts in just five hours. So you may be wondering how did they do it so quickly anyway?
In this article, we’re going to see just how they managed to build this cloud native e-commerce platform so quickly. At the same time, we will also discuss some highlights of the discussions and topics covered at the workshop.
How Cloud Native Emerged
Over the past decade or so, great changes have taken place in technology. In a quick summary, we at see that at the beginning of the 21st century, most enterprises were still using a centralized architecture. However, already at this stage, enterprises began to do some information construction work, such as cluster deployment (with Tomcat and Weblogic clusters) to ensure higher levels of system availability, and the procurement of commercial software and hardware products, such as those of IOE (which stands for IBM, Oracle, and EMC), to meet the demands of business growth through higher configurations, better performance, among other things.
However, gradually as more companies expanded and scaled outwards, centralized architectures could no longer sufficiently support the complex business systems that developed. At this point in time, many enterprises began to make some system splitting transformations, such as using the service-oriented architecture (SOA). After the system splits, the previously expensive minicomputer was no longer needed to deploy services, and the deployment of virtual machines gradually became more and more mainstream. Similarly, service-oriented databases and storage were no longer required to adopt commercial software and hardware solutions, and enterprises are turning to open source solutions, such as replacing Oracle with MySQL.
System splitting has many advantages, for example, it delivers business cohesion, loose coupling between systems, and convenient and fast iteration. However, the problems that come with it are also pretty obvious. For one, as the number of systems split increases, the interaction between systems becomes more complex and long call links may cause performance problems. Next, systems of distributed data storage and other data consistency also pose many challenges in addition to other problems such as resource allocation and isolation after being servitization. At this time, some virtualization and containerization technologies began to emerge, which were at the time most often OpenStack and Docker. OpenStack helps to solve the construction and management problems of the Infrastructure-as-a-Service (IaaS) layer, while Docker provides best practices for resource isolation. But these do not solve complex O&M problems.
In recent years, some new Cloud Native products and concepts have emerged, such as Kubernetes, Service Mesh, and Serverless, which can solve some practical problems of complex application deployment and O&M.
How Ant Financial Switched to Cloud Native
Alibaba’s Ant Financial began to shift from a centralized architecture to a distributed architecture in 2007. The team at Ant Financial integrated a set of financial-level distributed architecture developed independently during the process of technological evolution over the past decade into the SOFAStack™ (Scalable Open Financial Architecture Stack).
From 2007 to 2012, Ant Financial has completed modular and service-oriented swift of all business systems. The TCC model solved data consistency problems brought about by servitization and data splitting, and the registration center solved the problem of a single point of service.
After the service-oriented transformation, as the service cluster scale increased, system scalability ran into a bottleneck. In addition, to meet financial industry requirements, Ant Financial has put forward higher requirements on system availability and data consistency. Since 2013, Ant Financial has explored a set of unitization ideas. Based on this, capabilities, such as zone active-active redundancy, active geo-redundancy, and auto scheduling, have been launched to ensure that the business continues operation and data is not lost.
After that, with the rise of internet finance in China and the internationalization of Ant Financial, Ant Financial has opened up its own capabilities and technologies to the financial cloud in the form of cloud products, and developers can quickly build a financial-level distributed system based on this. At the same time, some internal practices are also made open-source.
Since 2017, the concept of Cloud Native is developing rapidly. In the face of the opportunities and changes brought by Cloud Native, Ant Financial’s strategy was to actively “embrace” Cloud Native. The ideas and concepts brought by Cloud Native can be used to solve some internal scenarios and problems encountered by Ant Financial.
For example, Service Mesh can solve the problems at the lower level of basic capabilities (such as middleware), while at the same time Serverless can solve the problem of R&D efficiency, and ensure business development focuses on the business. These new technologies and concepts will be explored internally and implemented in production by Ant Financial. Recently, we have shared the practical summary on large-scale implementation for the first time at the [Global Internet Architecture Conference (GIAC))( http://www.conference.cn/gntc/2017/en/), Shenzhen. At the same time, we will also make these Cloud Native practices open-source, and work with the community to promote and build financial-level Native Cloud standards.
SOFAStack Open-source Version
On April 19, 2018, it was officially announced that SOFAStack would be gradually open-source. The strategy is Open Core, that is, the core interfaces and implementations are all open-source, and old compatible code is kept internally. Up to now, in almost one year and two months, more than a dozen projects are already open-source, with a total of more than 25,600 stars, more than 120 contributors, and more than 30 production users. Recently, Ant Financial has also certified two community committers. Ant Financial plans to continue to optimize and expand the open source map.
In the figure below, it can be seen that many technical components related to microservices are open-source under the SOFAStack system, such as SOFABoot and SOFARPC. In addition, we have also been compatible or integrated with other excellent open-source products in the community. Using these components, we can quickly build a financial-level distributed architecture system. Open source code can be found at the GitHub address below this figure. In this Workshop, we will use some open-source technical components.
SOFAStack Cloud Products
Ant Financial also integrated SOFAStack capabilities into cloud products, as shown in the figure below:
The figure above shows the architecture of SOFAStack on the cloud. We can see that SOFAStack provides a complete solution for the external market. What supports the solution is the capabilities, such as distributed middleware and cloud application engine, to be experienced this time. In addition, we also provide the well-developed R&D efficiency platform service and the technical risk prevention and control platform. As for this part, more detailed introduction and experience will be covered in the afternoon.
Building Your Cloud Native E-Commerce Platform
After all this discussion, now it’s time to show you how you can quickly build a cloud native e-commerce platform as demoed during the conference. In this demo, you will learn how to use the open-source version of SOFAStack and various related cloud products to build an online e-commerce platform within five hours or so.
The following is a brief introduction to the content of this Workshop, as shown in the figure below:
In the first half of the tutorial, you will do the following:
- Build a basic e-commerce platform (bookstore), and transform it into a microservice architecture.
- Add the Artificial Intelligence Recommendation capability to the e-commerce platform (bookstore) in real time, based on SOFABoot dynamic module capability.
- Use the Seata distributed transaction framework to solve the problem of distributed transactions after microservices are split, ensuring data consistency between purchase and balance.
Then, in the latter half of the tutorial, you will do this:
- Quickly migrate the bookstore to the cloud through Serverless, use SOFA SAS to publish it to the cloud environment, and automatically scale it up and down based on traffic;
- Use Service Mesh to implement precision grayscale and traffic control capabilities.
Above is shown the system architecture diagram of the online bookstore. At the top is the deployed infrastructure, including the registration center SOFARegistry, the service console SOFADashboard, and the monitoring metric SOFALookout. We have prepared this part in advance.
Under this infrastructure is the content of the service. For convenience, we will not perform separate front-end and back-end deployments. This time, we only need to operate 2 applications: (1) the Web page system and the inventory system on the left to provide inventory operation services and (2) the accounting system on the right to provide balance-related services. When a user’s purchase request comes in, the inventory system needs to call it to the accounting system remotely through RPC.
In addition, the inventory service and the balance service correspond to independent databases respectively, and the Seata distributed transaction framework will be used to solve the problem of data consistency under distributed environment.