Serverless v1.0 was made open source for frontend and Node.js development. For more information, please visit this website and give us a star on GitHub!
Alibaba proposed the serverless architecture last year and used its next-generation R&D architecture to relieve a large number of R&D personnel from the burden of infrastructure and O&M work. Frontend developers need to write several functions to implement backend business logic, which promotes quick business release and improves the frontend R&D efficiency by 50%.
Over the past six months, Midway FaaS has attracted attention from a lot of developers, and some large enterprises have made direct use of Midway FaaS. Midway FaaS is evolving to Midway serverless to become a core scenario in the Midway system. As part of this process, Midway serverless v1.0 has been officially released.
v1.0 is an official version; you can use it with peace of mind. The new Midway Serverless system exposes Alibaba serverless capabilities and helps the frontend enter a new era. Open source is just a start. In the future, the Midway Serverless system will continue to evolve.
Currently, cloud vendors are attempting to use serverless to develop their businesses, and Node.js is their preferred choice. The Midway system will also lead the way.
Midway Serverless is a serverless solution that includes a framework, runtime environment, toolchain, and configuration specifications. These parts can be combined to provide special capabilities oriented toward serverless systems.
All of the preceding capabilities have been made open source in the Midway Serverless repository. Click here to go to the GitHub project, and don't forget to give us a star!
FaaS is one serverless architecture format, and the scenario Midway wants to address this time. Before Serverless v1.0, we invested a lot in FaaS. However, serverless architecture is huge, and FaaS is only a small part of it. Based on event-driven models, FaaS has evolved from microservices that focus on single responsibilities and features. The software architecture paradigm of "fragmented code" provides unparalleled flexibility in business code when compared to microservices.
According to Forbes statistics, typical servers in commercial and enterprise data centers only provide maximum processing capability 5% to 15% of the time on average, which is undoubtedly a huge waste of resources. The emerging serverless architecture allows service providers to provide computing capabilities to meet real-time requirements. This allows us to use computing resources efficiently.
Elastic containers can meet all requirements for resource utilization, which is one of the goals of cloud platforms. Developers need code they can run to meet business requirements for elastic containers and functions. Therefore, the goals of Midway Serverless have expanded from the FaaS scenario to other fields. We want to meet the needs of functions and new architectures, implement business scenarios, and share our innovations with the community.
Cloud platform users are worried they will have to stick with the same vendor forever after choosing a cloud vendor. Midway Serverless was designed to enable code to run on different platforms and runtime environments. However, we do not recommend customizing runtime environments without understanding the whole picture. It is dangerous. The official runtime environments have the highest stability and best performance. All benchmark running scores are based on official runtime environments.
When considering serverless, most enterprises worry that their cloud will be specific to Alibaba Cloud, Tencent Cloud, AWS, or another cloud.
Midway Serverless provides a set of hidden entries and common definitions to solve this problem.
Midway Serverless provides different runtime initiators for different platforms to mask their differences. Midway Serverless uses these initiators to regularize the input and output parameters, event structures, and gateway return formats of different platforms, so users will not perceive the differences between underlying containers or protocols.
Midway Serverless also provides a set of Spec definitions to mask the differences between multiple platforms. This allows you to conveniently reuse the same toolchain and function logic on different platforms.
Both API gateways and common HTTP triggers can provide APIs in a unified programming plane, making it easier to write code.
The syntax of functions is flexible. However, this flexibility yields convenience but high maintenance costs. Therefore, we introduce TS in functions to ensure both standardization and extension capabilities.
The following code seems to be standard Koa syntax, but it is an API for HTTP triggers in functions. Some changes have been made to maintain consistency with the web stack syntax and support parameter acquisition and calls seamlessly. This reduces the learning curve and allows for easy migration of the original code.
Methods decorated with decorators become function entries, giving the function structure greater flexibility. Real entries are hidden through building. This ensures cross-platform function calls and adaptation to different routers. As shown in the preceding example, a file has multiple entries that can share the same code. However, functions are independently called, which facilitates the management and subsequent maintenance.
Different cloud platforms have different structures. If you need to use the traditional event or context structure, we provide different definitions for different platform triggers to facilitate code writing, as shown in the following figure:
As mentioned previously, the Midway Serverless system was designed to reuse the existing Koa ecosystem and regularize the underlying events of different platforms to unified Koa-like APIs. Unified Koa-like APIs are used to reuse the whole Koa web ecosystem. We also want to reuse the entire Koa middleware ecosystem. As shown in the following figure, we introduced @koa/cors.
Midway provides an upper-layer egg component based on its excellent IoC component capabilities and can reuse existing egg plugins to continue to use traditional enterprise-level capabilities. The following figure shows an example of using the egg-mysql plugin:
Cloud + terminal development is one of the goals of Midway Serverless. In traditional application development, frontend-backend separation, multi-repository development, and isolated deployment, developers are aware of divisions even with the Node.js bindings. In a serverless system, this is not a problem.
The simplified backend and BaaS capabilities of cloud services make data convergence and page rendering easier and facilitate the frontend team's work and frontend development.
Integration has gradually become a requirement of the frontend team. Integration means traditional repository convergence, the evolution of the whole development model from an engineering system, plus code to reshape the entire CI/CD system.
Midway Serverless provides development solutions integrated with the frontend, covers existing ecosystems (such as React and Vue in the community), provides custom solutions for the whole toolchain (such as webpack, ice scrips, and umi), and provides out-of-the-box solutions for different scenarios (such as blogs.)
We will describe unified frontend and backend capabilities in a subsequent article.
Serverless is the direction of software development and lays the foundation for frontend development.
We have been thinking about the relationship between the final state of function-based development and applications.
In the current phase, the answer is integration. Functions are the smallest units in current businesses. To be specific, they are code for running applications in containers of the minimum specifications.
Going forward, we will focus on integrating more platforms and traditional application migration solutions to enable users to enjoy the elasticity of serverless, reduce enterprise costs, and make business launches easier.
Previously, in the context of the growth of large mid-end and small frontend business architectures, Node.js saw its future in end-to-end business delivery scenarios based on Alibaba Cloud-native serverless development.
The next-generation cloud + terminal frontend business delivery model is gradually becoming a reality, which helps technical teams train personnel with whole business delivery capabilities and help their businesses win market share. However, there is still a long way to go. We need to focus on two core issues, costs of large-scale deployment and the delivery speed, to achieve this goal as soon as possible.
We hope the Node.js and the serverless system will make progress on all fronts in the future through continuous investment.
Let's go Midway Serverless!
OpenYurt v0.3.0 Released: Improve Application Deployment Efficiency in Edge Scenarios
Alibaba Released Sentinel Go 0.4.0 with Hot Parameter Throttling
495 posts | 48 followers
FollowAlibaba Clouder - December 11, 2020
Alibaba Cloud Native Community - September 19, 2023
Alibaba Cloud New Products - December 4, 2020
Alibaba Cloud Serverless - September 29, 2022
Alibaba Cloud Native Community - December 6, 2022
Alibaba Cloud Native Community - November 22, 2022
495 posts | 48 followers
FollowMSE provides a fully managed registration and configuration center, and gateway and microservices governance capabilities.
Learn MoreVisualization, O&M-free orchestration, and Coordination of Stateful Application Scenarios
Learn MoreServerless Application Engine (SAE) is the world's first application-oriented serverless PaaS, providing a cost-effective and highly efficient one-stop application hosting solution.
Learn MoreMulti-source metrics are aggregated to monitor the status of your business and services in real time.
Learn MoreMore Posts by Alibaba Cloud Native Community