×
Community Blog Alibaba Midway Releases Serverless v1.0, Improving R&D Efficiency by 50%

Alibaba Midway Releases Serverless v1.0, Improving R&D Efficiency by 50%

This article introduces Midway, a Node.js framework for building serverless services, and discusses its various benefits.

1

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.

What Is Midway Serverless?

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.

1. Easy Inter-Platform Migration

  • Midway Serverless provides unified configuration specifications and entry mechanisms to ensure the code on all platforms is the same.
  • Midway Serverless extends runtime APIs for different cloud platforms. It can load common inter-platform add-ons and supports enterprises' private deployment solutions.

2. Easy Application Maintenance and Extension

  • Midway Serverless provides standard definitions for input and output parameters and events of cloud platform functions.
  • Midway Serverless provides multiple sets of development solutions that integrate with frontend React, Vue, and other frameworks in the community.
  • Midway Serverless uses TypeScript as its basic language to facilitate application extension and definition.
  • It provides comprehensive solutions for injecting the Midway system iconic dependencies.

3. Lighter-Weight and Freer Ecosystem

  • The function system reuses the Koa ecosystem and web middleware capabilities, making it easier to handle traditional web applications.
  • Midway Serverless provides the egg component and reuses the egg plugin ecosystem, making the enterprise-level development link simpler and smoother.
  • The Midway system provides unified decorator capabilities, making it faster and more convenient to migrate traditional web applications to a serverless system.

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!

Serverless and FaaS

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.

Vendor Lock-in Prevention

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.

2

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.

3

Both API gateways and common HTTP triggers can provide APIs in a unified programming plane, making it easier to write code.

TS and Decorator

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.

4

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:

5

Community Ecosystem Reuse

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.

6

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:

7

Frontend Empowerment

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.)

8

We will describe unified frontend and backend capabilities in a subsequent article.

Applications and Functions

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.

What's Next

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!

0 0 0
Share on

You may also like

Comments

Related Products