Changjetong’s Serverless exploration and practice path

Introduction to Changjetong

Chanjetong is China's leading financial, taxation and business cloud service provider for small and micro enterprises, founded in 2010. Chanjet ranks first in China's small and micro enterprise cloud finance and taxation market share in 2021, leading the market in terms of product forward-looking and full industry coverage, and ranks at the forefront of the leading quadrant of China's small and micro enterprise cloud finance and taxation vendor matrix. As a cloud service and software provider focusing on small and micro enterprises, Chanjet pioneered the concept of "intelligent company" in the industry in 2017, and further enriched and proposed the "six-step intelligent business paradigm" in 2018, aiming to help small and micro enterprises. Enterprises are clearly and accurately moving toward intelligence. Addressing the financial and management transformation issues of small and micro enterprises, Chanjet helps small and micro enterprises realize online personnel, online business, online customers and online management through technological empowerment, changing the traditional business format and promoting digital and intelligent upgrading and transformation.

Market data comes from the "2022 China Small and Micro Enterprise Cloud Finance and Taxation Industry Research Report" released by iResearch

Under the strategic opportunities of the rapid development of the digital economy, small and micro enterprises are actively pursuing business transformation, and the need to use digital and intelligent means to increase revenue, reduce costs, and improve efficiency will further increase. Chanjetong takes digital finance and taxation and digital intelligence as its core, and extends it with ecological services to provide cloud services for small and micro enterprises. It has launched a series of SaaS products, including Good Accounting (intelligent cloud finance and taxation), Good Business (marketing-based cloud entry) Sales and Inventory), T+Cloud (full-scenario digital intelligence business cloud application), Haoyecai (digital intelligence management platform for innovative enterprises), Yidai Accounting (digital intelligence finance and taxation platform), etc., the cumulative number of registered users of Changjietong Cloud Platform exceeds 800w.

Business and technical background

Changjetong has five core SaaS products, all of which are centered on digital finance and taxation and digital intelligence business, and extended with data services and ecological services to provide cloud services for small and micro enterprises.

  • Good Accounting: An intelligent cloud finance and taxation system that integrates billing, finance and taxation, helping financial personnel manage cash bank, invoices, transactions, tax returns, business analysis, etc. anytime and anywhere through PC, mobile phone, and WeChat.
  • Good business: The marketing-type cloud purchase, sale and inventory system focuses on helping enterprises manage stores and expand customers, achieving intelligent acquisition of customers and business, intelligent decision-making to do business, and intelligent and efficient business management.
  • T+Cloud: Digital intelligent business cloud service helps innovative enterprises quickly obtain a wide range of business resources (customers, goods, funds and professional services) through digital intelligence, and improve the operation and management elements (people/finance/goods/customers/ (digital) to achieve effective refined, digital, and intelligent management.
  • Yi Accounting: A cloud application designed for accounting and accounting companies, an intelligent financial and taxation system that integrates management, accounting, and tax reporting.
  • Haoyecai: A cloud service product for small commerce, industry and trade integration, and retail enterprises. With digital intelligent operation and management as the core, it helps enterprises realize the integration of industry, finance and tax invoices, all-channel and all-scenario mobile management, and realize online and offline data collaboration. , comprehensively enhance the competitiveness of enterprises.

As we all know, SaaS software is basically for To B business. Although it is far inferior to To C business systems in terms of request volume and traffic, the requirements for stability and security are much higher than those for To C business, and because it involves The business field is deeper, the product functions will be extremely complex, and there are close connections between modules, such as multi-tenant management, tenant data isolation, network isolation, system scalability (aPaaS capability), BI (data display analysis) These are all problems that Changjietong needs to solve.

Therefore, these five core systems are basically born and raised on the cloud. In the 13 years of Changjietong’s development, the IT technical architecture has also been continuously improved and optimized, with the purpose of better solving the above-mentioned problems. Those difficult questions.

  • Deployment architecture evolution route:
    • Main deployment architecture: Traditional ECS deployment architecture -> K8s deployment architecture
    • Exploratory deployment architecture: Serverless deployment architecture
  • Technical architecture evolution route: Java single service -> HSF-based distributed architecture -> Java SpringCloud-based microservice architecture -> Serverless function architecture

From the perspective of the evolution of the deployment architecture, Changjietong has long seen the value that K8s can bring to the product and production research teams. With the decisive decision of the CTO, it invested heavily in containerization transformation and transformed the previous ECS deployment architecture. Deploy the architecture for K8s and choose Alibaba Cloud ACK. So far, there are more than a dozen ACK clusters stably supporting Chanjet's core business.

The evolution of technical architecture is actually complementary to the evolution of deployment architecture. Java monolithic services and HSF exist in the ECS deployment architecture. During the containerization transformation stage, services were also transformed into microservices and message middlemen were also introduced. Software (RocketMQ, RabbitMQ) to assist the transformation of microservices.

Driven by the general environment, cost reduction and efficiency improvement have basically become the core KPI of every enterprise, and Chanjetong is no exception. However, Chanjetong seems to be more prepared for danger in times of peace, because as early as 2020, due to the issue of improving efficiency , began to investigate Serverless technology, which is also the earliest foreshadowing of Chanjet's current deployment architecture and technical architecture in its continuous evolution to Serverless.

Why Choose Serverless

The concept of Serverless technology appeared in 2012 and emerged in 2014 (AWS Lambda). Domestic cloud vendors began to launch related products in 2017. After years of development, Serverless technology has gradually become more popular in terms of implementation scenarios, product experience, stability, etc. At maturity. Serverless is actually a combination of Server + less. It does not mean that there is no server, but it helps users shield the underlying tedious server maintenance, allowing enterprises to focus more on business. The industry generally believes that Serverless = FaaS (Function as a Service) + BaaS (Backend as a Service), supporting automatic elastic scaling and pay-as-you-go. In fact, when Serverless technology first emerged, it specifically referred to FaaS, which is the product form of function computing. After so many years of evolution, it has expanded to the Serverless technology concept and Serverless application architecture. Cloud vendors have also launched many related products and services around Serverless. , covering computing, storage, database and big data, etc., helping enterprise users build serverless applications.

 

Serverless technology concept refers to Zero Server Ops + No Compute Cost When Idle. The core idea is to allow enterprises to focus on business and reduce Ops. Therefore, according to the concept of Serverless, operation and maintenance work will be greatly simplified, and R&D personnel can control the use of resources to a certain extent, thereby improving business iteration efficiency. Therefore, this concept is very consistent with the development ideas of Changjietong’s R&D and operation and maintenance teams.

Serverless technology research

Changjietong is an enterprise that actively embraces the cloud and is curious about all new technical fields. Ms. Zheng Yun, the chief architect of Chanjetong, has organized many core R&D and operation students to have an in-depth understanding of the serverless technology field with us, starting from the underlying architecture. After a comprehensive analysis of implementation, applicable business scenarios, and transformation costs for existing businesses, we finally decided to use Function Compute FC as a pilot to start the journey of exploring Serverless.

Function computing business scenario

 

For SaaS systems, the most suitable scenarios for function computing should be HTTP, Web application scenarios, big data ETL scenarios and periodic task scenarios. Projects launched after Chanjet basically fall into these three types of scenarios.

How to transform from non-Serverless architecture to non-Serverless architecture

After selecting the scenario, you need to solve the problem of how to transform. The transformation here has a dimensional concept:

  • Transformation of existing non-Serverless architecture businesses to Serverless architecture: it will involve large cost transformation issues
  • New businesses directly adopt Serverless architecture: just follow the best practice paradigm of Serverless architecture

Both parts of Chanjet are involved. Based on the concept of function computing, we have also summarized the best practices for transformation, including the selection of programming languages, selection of operating environments, DevOps transformation process, code transformation process, etc., together with Chanjet Verify them one by one.

 

Serverless practice touchstone - SQL script execution tasks

Changjetong's serverless practice is a gradual and iterative route. After technical research, the first pilot project is the SQL script execution task in operation and maintenance, because the SaaS system for To B customers needs to be released for stability reasons. The rhythm is generally not particularly frequent, but the workload of each release is very large, especially when releasing a large version. One of the most important tasks is to run SQL scripts in batches or update metadata. Or update the table structure. It is mainly piloted in the T+Cloud system. This pilot project is relatively simple to transform and the risks are relatively controllable. It is a small test for customers.

Pain points of the original method

Running SQL script tasks in batches requires computing resources, but the usage rate of these computing resources is extremely low, so it is impossible to reserve computing resources for a long time. However, if they are allocated from the resources that support the business, it may have an impact on the business. . In addition, the amount of calculation required for each batch run is not small, so each time the operation and maintenance personnel have to manually add or subtract servers, which is time-consuming and labor-intensive. Sometimes resources cannot be prepared in time, which affects the release progress, and sometimes forgets Freeing up resources will incur additional costs. Therefore, the core pain point is to improve efficiency and improve operation and maintenance happiness .

Serverless architecture

 

Based on the characteristics of Serverless on-demand and pay-as-you-go billing, the task of executing SQL scripts is placed in function calculation, so that when the SQL script needs to be executed during release, function calculation can be requested through the operation and maintenance management platform on demand. By automatically pulling up the required computing resources to process the SQL script, and automatically releasing it after the script is executed, it is equivalent to having an on-demand resource pool for customers to use. After being transformed into a Serverless architecture, it mainly brings the following advantages:

  • It completely solves the problem of obtaining computing resources on demand, and operation and maintenance personnel no longer need to spend extra time thinking about preparing resources.
  • Thanks to the elastic speed and concurrent expansion capabilities of function computing, under the Serverless architecture, the ability to execute SQL scripts in parallel is greatly improved while ensuring the order between SQL scripts, effectively shortening the release duration.
  • Function Compute asynchronous requests have a post-processing mechanism, that is, when the function is executed successfully or fails, the target service can be set to do post-processing in time. In this scenario, SQL script tasks that fail to execute can be effectively automated, such as sending messages after the execution fails. , or try again after execution fails, or pull up another function to do compensation logic, etc. Greatly improves the stability of batch execution of SQL scripts.

Serverless practice is in full bloom

In the pilot project of SQL script execution tasks, the serverless architecture has truly brought value to customers, so Chanjet is gradually looking for other scenarios suitable for function computing.

Operation and maintenance toolset

When practicing serverless architecture, most customers have an inertial thinking, which is to first find edge non-core business pilots. After achieving the expected results, start from the operation and maintenance side, and Changjetong is no exception. Therefore, the second project that started to implement the Serverless architecture is actually an extension of the SQL script task, which is to replace all appropriate scenarios in the entire operation and maintenance management platform with function computing. Because the operation and maintenance management platform has a relatively low-frequency demand for resources compared to the business system, some of the tasks may be executed several times a day, or even several times a month, so in essence, various operation and maintenance task scripts are placed in Run in Function Compute. In addition to enjoying the benefits of on-demand access to function computing resources, large concurrent execution, and post-processing fault-tolerance mechanisms, function computing has an inherent advantage in quickly repairing script exceptions.

  • Function Compute provides WebIDE. If you need to quickly fix script exceptions, you can quickly open the console, modify the script in WebIDE, and deploy and publish it with one click. Very effective in emergency scenarios.
  • Function Compute provides the ability to grayscale versions, so in scenarios where problems need to be quickly repaired, a new version can be quickly created, and then the version can be quickly switched in the running state, and the historical version can be retained for subsequent analysis.
 

open platform

When we usually judge the capabilities of a SaaS product, the depth of understanding of the business domain is important, but there is also another very important criterion that is whether it has aPaaS scalability or an API open platform, because it is related to the future of this SaaS product. How far can it go, such as the proportion of subscription payment and customized delivery revenue, the construction of upstream and downstream ecology, etc. Chanjetong's SaaS products have strong expansion capabilities and API open platforms.

One of the most widely used scenarios for Chanjet's API open platform is for their users to connect to third-party systems or other SaaS systems, such as receiving messages from Meituan, receiving messages from Ele.me, etc. In this scenario, There are obvious To C characteristics, that is, the message volume fluctuates greatly. The message TPS during peak periods can reach 10,000 levels, but the message TPS during low peak periods may only be in the dozens. So in this scenario, there are several pain points:

  • The docking systems cannot be standardized and need to support multiple protocols. For example, most third-party SaaS systems are connected to the HTTP protocol. Some users' self-developed systems may want to use the MQ protocol or the Kafka protocol. In order to adapt to multiple receiving protocols, the backend needs to implement multiple sets of codes. Maintenance costs are high.
  • The message flow fluctuates greatly, with peaks and troughs varying by tens of thousands of TPS. As a result, resources can only be reserved according to the peak value, resulting in extremely low resource utilization and serious waste of costs.

These pain points perfectly hit the core characteristics of function computing, combined with the good performance of function computing in the first two scenarios, so Chanjet’s third pilot project is the API open platform, which will replace the architecture of accepting three-party messages and processing messages with functions. Computing architecture.

 

As can be seen from the architecture diagram, the function logic for processing messages or requests is the same, but the receiving protocols are different. Therefore, using function computing can easily maintain three functions with the same logic, but each has different triggers, so only maintenance is required. One set of code can implement multiple receiving protocol scenarios.

Speaking of function computing triggers, we have to say that another advantage of the Serverless architecture is ecological integration:

 

Function Compute is connected to nearly a hundred types of triggers upstream, so if the Function Compute architecture is adopted, it is equivalent to having the ability to integrate and be integrated with nearly a hundred Alibaba Cloud products, greatly improving efficiency and reducing integration costs. .

Therefore, Chanjet has gained a lot from transforming its API open platform into a serverless architecture:

  • Function calculation triggers solve the problem of maintaining multiple sets of codes under multiple receiving protocols.
  • It greatly improves resource utilization and effectively optimizes resource costs. In this scenario, the function that processes messages uses the Go language, uses function instances with 0.1c and 0.05c specifications, and uses single instance multiple concurrency. In the peak situation of tens of thousands of messages, only a dozen function instances are needed to provide stable support. Compared with the original K8s architecture, the cost is saved from several thousand yuan per month to several hundred yuan per month.

Intelligent replenishment business

As more and more projects are piloting serverless architecture, and huge benefits have been achieved, Chanjet has gradually begun to focus on the practice of serverless architecture towards its core business. Perhaps this is fate. It happened that Changjietong started planning and designing a new business, and function computing was taken into consideration. This is the intelligent replenishment business. This business is an intelligent assistant that helps buyers create replenishment models based on the company's business data and according to the inventory, procurement, sales or material consumption patterns of goods, thereby quickly helping buyers calculate and generate replenishment reference results.

Due to the large amount of business data, this business adopts offline + real-time data synchronization calculation. The files and business data that need to participate in the replenishment calculation are synchronized to the data warehouse, and the data is preprocessed according to the definition of business requirements. The overall characteristics are as follows: :

  • It has burst traffic characteristics. Since the amount of calculated data is relatively large, users can select business data in the past six months or even one year for calculation and analysis. It is an intensive calculation, so the requirements for computing resources are relatively high. If the traditional deployment architecture cannot support the business If there is a peak traffic reserve, there will inevitably be a waste of costs.
  • The intelligent replenishment business is not a new product, but a new business module in an existing product. Limited by the granularity of microservice splitting, this part of the logic will be highly coupled with the existing business logic, so If a large amount of resources are consumed when computing the replenishment algorithm logic, there may be a resource preemption problem, affecting the stability of existing business.
  • Intelligent replenishment, in addition to focusing on intelligence, also supports user-defined replenishment rules. Therefore, to a certain extent, each user's replenishment rules are like business processes. The entire system needs to be capable of scheduling and orchestrating such business processes. ability.

So to sum up, the smart replenishment business has three characteristics:

  • There are traffic tidal characteristics, and it is hoped that the computing resources will have strong expansion capabilities.
  • It is hoped that computing resources will be independent and resources that support existing services will not be occupied.
  • It is hoped that there will be a set of architecture to support the flexible scheduling and orchestration of rules.

Here comes another core feature of Function Computing, which is the ability to orchestrate Serverless workflows. Let’s look at the architecture diagram first:

 

It can be seen that the logic layer of the replenishment algorithm is entirely placed in Function Compute and communicates with the upstream and downstream services deployed in ACK. The fast elasticity of Function Compute solves resource utilization and cost issues under traffic tides, and at the same time, this part consumes resources. The logic is stripped out and the problem of resource preemption is solved.

For the flexible formulation of replenishment rules, it is combined with Serverless workflow. Each rule is a process, and each function in the process is an operator in the rule. Serverless workflow not only supports the orchestration of function calculations, but also supports Other mathematical logic operations and other Alibaba Cloud core products, such as ECS, SAE, ACK, OSS, etc., are also relatively mature in version management and release management. Therefore, this set of architecture enhances the scalability of business functions.

Although this business is not sensitive to latency, we have also tried our best to optimize the cold start problem of Java functions, such as using mirror acceleration capabilities, JDK using Alibaba Cloud's optimized Dragonwell, enabling reserved instances + idle billing, etc. , thereby meeting the latency requirements of the service. In addition, we have also started research and scheduling for deeper technical optimizations such as Snapshot, and will do our best to completely solve the cold start problem of Java functions.

More business scenarios

So far, in addition to the four scenarios mentioned above, Chanjet has also implemented other scenarios using Serverless architecture, all of which have achieved expected benefits, such as RPA business, full-tenant offline download of retail data, offline data processing, etc. . Covering the fields of operation and maintenance, core business fields, and big data fields, I believe that more scenarios will transform into serverless architecture in the future.

Advice for fellow travelers

Serverless fundamentally lowers the threshold and cost of using the cloud. The development history of Serverless in the industry has exceeded 8 years. Judging from the implementation effect, Alibaba Cloud Function Computing is more suitable for SaaS system enterprises. At the same time, Function Compute is currently working on AIGC scenarios and is committed to helping users access large model services with a lower threshold. Since last year, Alibaba Cloud has been vigorously promoting Serverless products and services, upgrading them to a strategic position, including proposing All in Serverless. Currently, the Cloud Message Queue MQ plans to launch a Serverless version after the Yunqi Conference. The database RDS has already launched a Serverless version. The big data team has also launched a Serverless version. In promoting serverless, from a user perspective, I think this is very beneficial. Through comprehensive Serverless products and services, end-to-end Serverless architecture or applications can be built, and the changes this brings are disruptive. Rather than wait and see, it is better to embrace it in advance and hope that Chanjet’s practical experience in serverless can bring some inspiration to more enterprises.

Author|Jiyuan Alibaba Cloud Cloud Native Architect

Original link

This article is original content from Alibaba Cloud and may not be reproduced without permission.

IntelliJ IDEA 2023.3 & JetBrains Family Bucket annual major version update new concept "defensive programming": make yourself a stable job GitHub.com runs more than 1,200 MySQL hosts, how to seamlessly upgrade to 8.0? Stephen Chow's Web3 team will launch an independent App next month. Will Firefox be eliminated? Visual Studio Code 1.85 released, floating window Yu Chengdong: Huawei will launch disruptive products next year and rewrite the history of the industry. The US CISA recommends abandoning C/C++ to eliminate memory security vulnerabilities. TIOBE December: C# is expected to become the programming language of the year. A paper written by Lei Jun 30 years ago : "Principle and Design of Computer Virus Determination Expert System"
{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/yunqi/blog/10320861