What does Xianyu rely on to support the trillion-dollar transaction scale? | Cloud Native Talk

Introduction: In order to support the transaction scale of Xianyu trillion, Wang Shubin and the technical team are intensively carrying out the serverless transformation of traditional giant applications.

On June 28, 2014, the year when Ali was about to go public in the United States, in a tea room in Xixi Park, after 28 people worked day and night for three months, an idle trading platform, Xianyu, was launched. In May of this year, the data of Xianyu was announced in Alibaba's annual report: GMV was 200 billion yuan, a year-on-year increase of 100%, and the number of online sellers exceeded 30 million every day. Xianyu has changed from an internal small product started in a pantry to a leading platform in the C2C field.

According to data from iiMedia Research, the scale of the second-hand goods trading market in 2020 will reach more than one trillion yuan. The prosperity of online transactions requires corresponding adjustments and evolution of the technical architecture to support the rapid development of the business. For Ali, Xianyu is more important than revenue, and that is innovation. Innovation is not only reflected in the business model, Xianyu's technical architecture is also exploring the latest direction - developing towards Flutter, cloud native/serverless.

In 2009, Wang Shubin, who graduated from Zhejiang University, joined Alibaba after three years of working at UT Scala. In 2017, Wang Shubin introduced Flutter to Xianyu for the first time. Since 2018, Wang Shubin has led the Xianyu technical team to play a bigger game: deploying Serverless. Disruptive innovation often emerges from marginal places, and upgrading to cloud-native/serverless is a brand-new path for Xianyu, but traversing this path will have huge implications for many companies doing online transactions. Reference meaning.

Today, let's talk about the cloud native story of Xianyu.

01 Why do you want to be Serverless?
Xianyu is a front-end business that relies on Ali's e-commerce system. It has very unique business characteristics and user demands. While relying on the Ali system at the bottom, it is necessary to explore faster and more flexible research and development suitable for Xianyu in the presentation layer and business layer. system.

According to the traditional development method, Xianyu's original IT system will face many pain points, such as:

1. The boundaries between the client interaction layer, the server business glue layer, and the domain layer are not clear, which leads to the need for the participation of students in the entire link for very small business requirements, high collaboration costs, and long development and debugging cycles.

2. There are huge applications on the server side. R&D coupling, release coupling, operation and maintenance coupling are serious, and even system stability is greatly challenged. A single business problem often affects the entire application.

3. The operation and maintenance cost is extremely high. In order to ensure the stability and availability of the business, Alibaba has corresponding specifications and rules for each application online. Even if it is a small internal application, there may only be one or two visits a day, and it needs to comply with the existing specifications when going online, which will inevitably consume some fixed resources. The resources consumed by a single application may be very limited, but the cumulative resources consumed by all applications are also a large number. For giant applications, due to the huge impact, stricter processes and steps are required for release, and a release takes at least 6 hours, resulting in extremely high operation and maintenance costs.

The emergence of serverless, on the one hand, makes cloud-integrated R&D possible, and the coordination cost of many small business needs can be greatly reduced. On the other hand, Serverless enables the giant application of the business glue layer to have a more reasonable split than microservices.

The bottleneck of cost (speed), stability, and quality of traditional giant applications can be visually represented by the following triangle.

The emergence of new technologies such as cloud native/serverless can make application operation and maintenance capabilities sink, and the bottleneck of traditional giant applications' mutual constraints of cost (speed), stability, and quality may be broken. In the process of implementing new technologies, Xianyu first focused on Flutter's hybrid engineering system and high-performance component library. Then focus on serverless to focus on cloud-integrated R&D system and server-side business assembly layer architecture system.

The Xianyu client is based on Flutter for architectural evolution and innovation. After using Flutter to unify both Android and iOS to improve R&D efficiency, it is hoped that Flutter+Serverless will solve a large number of coordination problems between roles. It is these problems that lead to low overall R&D efficiency. , the mobile terminal is getting farther and farther away from the business, and the server side has no time to do the underlying field precipitation. Through the introduction of Serverless, Xianyu will clearly see an improvement in the overall R&D efficiency.

02 Explore and practice
In 2018, the Xianyu technical team began to explore serverless, which is divided into four stages: self-built Dart Server, relying on FaaS platform, cloud integration, and serverless of traditional giant applications.

In May 2018, the Dart Server application framework of cold start within 2s was built with the serverless idea, which is used for the lightweight development of the server-side business glue layer.

From the end of 2018 to the beginning of 2019, Xianyu started to cooperate with the Gaia team to build a Dart runtime based on the Gaia platform, and launched some businesses. Note: Gaia is a FaaS platform for Taobao business based on Alibaba Cloud's package for Taobao business features.

In 2019, based on Gaia's Dart Runtime standardization, Xianyu explored the integration of Flutter+FaaS cloud programming and metadata of domain interfaces, and finally gave birth to the glue layer business framework such as Nexus, which has been implemented in more than 20 businesses of Xianyu.

In 2020, Xianyu began to integrate engineering & tools in the cloud, with the goal of realizing one project and multi-terminal deployment. Now, Wang Shubin is leading the technical team to tackle the traditional giant application governance of the business glue layer, so that traditional applications can be migrated to serverless, "We will hand over a beautiful answer in 3 months at the earliest and 6 months at the latest. "

Specifically, in the past two years, the practical achievements of Xianyu on Serverless are mainly divided into 5 aspects:

1. Cloud programming model integration framework (Nexus API)
The goal of this framework is to unify the programming models of Flutter and FaaS, and to connect UI, interaction, data, and logic. Wang Shubin mentioned that when we first said that we wanted to integrate Flutter + FaaS, our understanding of the word "integration" was relatively vague, but we only knew that students on the side could use Dart to write FaaS functions. , which is actually still in the integration of language. For what FaaS can do, it only stays at the BFF level that has been implemented in the front-end for a long time.

We spent a long time discussing that based on the Dart ecosystem, the front-end FaaS is not efficient in R&D delivery. The main problems in the R&D stage are:

The programming language is not unified: Although the programming language itself is not the biggest obstacle, it does add a lot of barriers to front-end developers, and more importantly, the ecology, environment and system behind the language are a high wall.

The development mode and architecture are separated, and the environment is complex: there is one project on the terminal side, and there is also an independent project on the FaaS side, behind which they have their own set of toolchains for construction, debugging, integration/release; in addition, FaaS also has its own supporting facilities The environment, Runtime, and framework are used as support. Faced with such a complex FaaS R&D environment and dual R&D workflows, developers cannot deliver efficiently.

In the end, we have a clear consensus on integration, which is to achieve the integration of two cores:

language integration
Integration of development mode and architecture
The integration of programming languages ​​can provide developers with a familiar technology stack, and the integration of development models and architectures can help developers solve engineering fragmentation and the complex FaaS local operating environment behind them, bringing about R&D that is basically consistent with the original R&D model. experience.

Through the integration of these two levels, there is no obvious gap between developing Flutter pages and developing FaaS. For example, the Xianyu client Flutter used to be developed with the Redux framework. Under the Nexus API framework, Redux can be seamlessly integrated with FaaS calls.

2. Standardization of CLI development tools

During cloud-integrated development, some details of FaaS development are shielded through the CLI (command line tool), so that the development experience of the client when developing FaaS is standardized, which is in line with the local development habits of client students.

3. Basic service BaaS

Over the past two years, we have gradually simplified basic service capabilities such as object storage, messaging, and search. At the same time, building a metadata center for services at the business domain layer, these simplified basic service capabilities, coupled with the existing business domain layer services, enable client students to quickly assemble services.

4. Cloud engineering integration

After successfully introducing Flutter, Xianyu has formed a cross-end R&D system mainly based on Flutter and supplemented by H5, so that the two ends of the traditional Android and iOS research and development are merged into one end. When the productivity of the terminal is released, we find that the students on the terminal have the opportunity to go down a little bit, so that the server faces the simple data assembly logic, and the students on the terminal complete the closed loop by one person. This model is especially suitable for the needs of some small businesses. Similar attempts have already been made in the industry, such as the popularity of the GraphQL framework and the formation of the front-end BFF layer. But with Serverless, the development of server-side lightweight code can be greatly simplified, so Xianyu chose this opportunity to promote cloud integration.
Cloud integration involves cloud programming frameworks, tool chains, engineering systems, basic services BaaS, and domain service sinking. At the same time, it also involves organizational guarantees for personnel, reshaping of labor division, and safety production training.

5. Serverless transformation of traditional giant applications

Serverless is not a silver bullet, but it matches the characteristics of the business glue layer and is very suitable for solving the splitting of traditional giant applications of the glue layer. This is also the next problem that Xianyu is tackling.

03 Problems and Breakthroughs
The process of Xianyu landing Serverless was not smooth sailing. Wang Shubin mentioned that in the process of serverless cloud integration, some technical difficulties were encountered, such as the heterogeneous language access of Java rich clients, how to unify the open environment, and the client students' unfamiliarity with domain interfaces.

In Xianyu's Java system, there are a large number of Java rich client applications. For the heterogeneous language access of Java rich clients, Xianyu uses the Sidecar mode to build a Java Proxy to solve such problems.

Then, in order to unify the development environment, Xianyu developed its own CLI tool (GCLI). GCLI is a command-line tool based on supporting the FaaS R&D life cycle. It defines the closed loop of Xianyu FaaS development, unifies the FaaS R&D environment, and is a powerful tool to improve the efficiency of FaaS R&D. GCLI disassembles the R&D closed loop into development instructions suitable for serverless R&D habits. In order to allow users to inherit their research and development habits and tools, Xianyu prefers local-based development solutions; uses Docker technology to unify the development environment, and declares the operating environment (software + configuration) that the Dart FaaS technology stack depends on in Docker. With the help of container technology, the software environment of FaaS can be ported to any operating system that supports Linux, thus solving the problem of unified environment; GCLI realizes interoperability between local and function platforms through FaaS Open API, forming a complete closed loop of R&D.

Finally, in response to the problem that client students are not familiar with the domain interface, Xianyu developed a metadata center at the domain layer.

Cloud integration reshapes the traditional cloud and terminal boundaries, reduces collaboration, brings greater flexibility to the division of labor, and significantly improves technical R&D efficiency and R&D quality. The direct benefit of these changes to the business is that the business can iterate faster and adapt to changes in the market and user needs.

Cloud integration is currently used in Xianyu's heavy-interaction scenarios and light-weight business scenarios, and the technical efficiency and quality improvements it brings are easier to present in the form of quantitative data. For example, based on a sample of typical medium and large-scale business requirements, the number of developer days is reduced by 30%, and the bug rate per thousand lines of code is reduced by 20%. If statistics are based on scattered demand, the data improvement will be more obvious. In the past, due to the participation of multiple students, it often took a few weeks to schedule a small demand, but after the integration of the cloud, the flexibility of resources is significantly improved, which greatly improves the speed of demand response.
image.png
"However, there are still some problems that have not been solved," Wang Shubin said. In terms of serverless giant application splitting, Xianyu encountered more serious problems, such as:

Selection of Microservices and Serverless
Code reuse between Functions
Unified upgrade for function dependencies

The solutions for these issues are still being verified by Xianyu, and will be shared with you in detail after the experience is mature. Please continue to pay attention.

04 Learning and thinking
What kind of company, application or scenario should use the serverless architecture pattern? There is currently no specific definition, the key is to think clearly. To think clearly, you need to balance benefits, costs, efficiency and the ability to respond to the market. Among them, cost is a factor that enterprises pay more attention to, including the cost of infrastructure construction, operation and maintenance costs, expansion costs, and security costs.

Netflix is ​​a successful example of landing Serverless. Netflix has always had innovative genes in product design. In addition to continuous A/B testing, many new features are released every week. In order to ensure such high-intensity work results, an API service platform is needed to help client engineers quickly and efficiently deploy changed requirements to the service layer. FaaS achieves this goal by abstracting all platform components related to the service into the business logic itself, while the Serverless model can provide Netflix with a platform where even engineers without server and operational experience can develop highly available services.

Adopting the FaaS model is essentially customization of transaction speed and possibilities. Some applications have FaaS services that behave just fine — as is the case with the Netflix API, which runs relatively uniform microservices that only need to access and alter data from downstream services. However, if the service needs to be customized, for example, various components of the service platform need to be changed, such as RPC, data access, caching, authentication, etc., then the FaaS model may not provide enough flexibility for these services.

The self-built serverless platform has relatively high requirements on enterprise IT personnel, and the construction cost is also high. In addition, implementing Serverless requires a mature ecosystem. In most cases, enterprises that have already migrated to the cloud should give priority to the serverless products of cloud manufacturers, while enterprises that have not migrated to the cloud need to consider whether the ecological situation of the existing system is compatible with the serverless products of cloud manufacturers.

For the selection of serverless products, several aspects should be considered: ecological maturity, supported development languages, functional richness, charging standards, etc. The key is to combine the needs of the enterprise's own business development.

05 About the future
O'Reilly once conducted a survey on the application of serverless, and found that developers in the software industry pay attention to and apply serverless a lot, which is expected, but the financial and banking industries are also paying close attention to serverless. More and more fintech startups are born, they take on the responsibilities of traditional infrastructure and embrace and embrace serverless with a more open mind.

As for the reason for rejecting serverless, 60% of the respondents said that it is a security issue. Because many industries have high security requirements for IT environments, the adoption of any new technology may bring security risks.

In addition, the other concern of developers is that they are bound by manufacturers, which leads to organizations with a certain scale to build their own serverless platforms based on open source solutions, such as Knative. Once an open source solution becomes mainstream, cloud vendors will take the initiative to be compatible with open source standards and increase community investment.

In addition to the impact of serverless on technology and business, it also puts forward new requirements for enterprise organizational structure and technical personnel.

First, Serverless changes the communication structure. According to Conway's Law, the organizational structure needs to adapt to the new communication structure, which is the best match. In the past, Xianyu's students who were responsible for the client side and the server side were separated. Under the background of the new Flutter+Serverless, the organizational structure also needs to be adjusted accordingly. After discussion, Xianyu finally decided to divide it according to the business line, and regroup the client and server students according to the business line.

Second, serverless gives client-side students the opportunity to learn more about the business, which requires client-side students to be more business-aware. Serverless prompts client-side students to expand their technical boundaries and also need to understand certain server-side development concepts.

Finally, Serverless requires the original server-side students to have better data modeling and domain modeling capabilities, which will help the underlying interface reuse better.

From the very beginning, it was not favored by the outside world, and was even ridiculed as "salted fish". Now it has achieved tens of millions of DAUs, revitalizing a trillion-level market, and the emergence of Xianyu, whether it is for the front-end e-commerce ecosystem, or for users in the The form of life on the Internet has had an important impact.

In order to support the transaction scale of Xianyu trillion, Wang Shubin and the technical team are intensively carrying out the serverless transformation of traditional giant applications.

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us