Open source for front-end and Node.js development, Github: github.com/midwayjs/mi… , click the direct jump point Star.
Last year, Alibaba introduced Serverless architecture and took advantage of its next-generation R&D architecture to reduce the focus of a large number of r&d staff on infrastructure and operations. For front-end developers, they only need to write a few functions to implement the back-end business logic, bringing the business online quickly and increasing the overall front-end development performance by 50%.
Over the past six months, Midway FaaS has gained a lot of attention from students and many large corporations. Thank you for joining us. Today, the Midway FaaS will evolve into the Midway Serverless and become the core scenario of the Midway system with the official release of V1.0.
V1.0 represents an official release and can be used with confidence. Through the entire Midway Serverless system, we are opening ali’s Serverless capabilities to a whole new era. As said two years ago, open source is just the beginning, and the end is far from here.
Serverless is the golden age of cloud discovery for all of you, and Node.js is the place to be, with the Midway system at the crossroads where it’s going to lead.
What is Midway Serverless
As mentioned earlier, Midway Serverless is a Serverless solution consisting of a framework, runtime, toolchain, and configuration specification. The combination of these components provides some unique capabilities for a Serverless architecture:
1. Easier migration between platforms
- Code is basically the same on every platform by providing a uniform configuration specification and entry smoothing mechanism;
- Extend the runtime apis of different cloud platforms to not only load common inter-platform extensions, but also access private deployment solutions within the company.
2. Make your application easier to maintain and expand
- Provides a standard cloud platform function entry and exit parameter event definition;
- Provide multiple sets of community front-end React, Vue and other integrated development schemes;
- We use TypeScript as the base language for extensions and definitions.
- Provides a comprehensive dependency injection solution that is the hallmark of the Midway system.
3. Ecology is lighter and freer
- The functional architecture reuses KOA’s ecology and Web middleware capabilities, making it easier to deal with traditional Web.
- Provide egg component reuse egg plug-in ecological chain, enterprise development link is more simple and smooth;
- The unification of the Midway architecture’s decorator capabilities makes traditional Web migration to a Serverless architecture faster and better.
All of the capabilities mentioned above are now open source in the Midway Serverless repository. Click on the link to go directly to Star. Github:github.com/midwayjs/mi…
Serverless and FaaS
FaaS is one form of the Serverless architecture that Midway wanted to address. Before V1.0, we had invested a lot in FaaS, but the Serverless architecture was huge and FaaS was only a small part of it. Event-driven models evolved from microservices, which were small functional blocks focused on a single responsibility and function. Today’s more “code fragmentation” software architecture paradigm offers unparalleled flexibility to business code compared to the smaller units of programming known as microservices.
Today, according to Forbes magazine, typical servers in commercial and enterprise data centers provide only 5 to 15 percent of their average maximum processing power output, which is a huge waste of resources. With the advent of the Serverless architecture, allowing service providers to provide our computing power to maximize our real-time needs will enable us to use computing resources more efficiently.
Elastic container, which can meet all the current expectations for resource utilization, is also one of the goals that cloud platform constantly pursues. For developers, no matter elastic container or elastic function, as long as a set of code can run in it to meet the needs of business. This led to the goal of Midway Serverless, expanding from the FaaS scene into other areas, whether it was functions or new architectures, to reach out to the business and the community.
Anti-platform lock
Vendor Lock-in is a question that torments the soul of everyone who uses a cloud platform. Midway Serverless’s original intent was to have a single set of code that could run on different platforms and runtimes. We don’t recommend customizing runtimes without knowing the whole picture. In fact, the official runtime is the most stable and certainly the best performing, and all benchmark runs are based on that.
Most of the enterprises we know the first problem when facing Serverless is whether my code must be tied to Ali Cloud, Tencent Cloud, AWS and so on.
Faced with this problem, Midway Serverless provides a set of “hidden” portals with generic definitions to solve this problem.
For each platform, Midway Serverless provides different runtime initiators to smooth out platform differences and regularize platform entry and exit parameters, event structures, and gateway return formats so that users are as unaware of differences in underlying containers and protocols as possible.
In addition, Midway Serverless provides a set of Spec definitions that smoothen the differences between platforms while making it easy to reuse the same toolchains and functional logic across multiple platforms.
In this way, both API Gateways and plain HTTP triggers can provide apis on a single programming plane, making writing code easier.
TS and decorators
Function writing is flexible, which brings simplicity and maintenance costs. This introduces TS into functions, and introduces standards and extensibility.
The following code, which appears to be koA’s standard syntax, is actually an API for HTTP triggers in functions. In order to be consistent with the Syntax of the Web stack, some changes have been made to make parameter fetching and call as seamless as possible, and also reduce the learning cost, and the original code can be better migrated.
On the other hand, methods decorated with decorators will become function entrances, freeing up the structure of the entire function. By building in such a way that the actual entry is hidden, not only can functions be called across multiple platforms, but also can be adapted to different routes. In the example above, there are multiple entries in a file, which can share the same code, but in fact each function is called independently, which provides convenience in management and later maintenance.
The actual structure of different cloud platforms is different. If users need to use the traditional event and context structures, we also provide different definitions for triggers of different platforms to facilitate code writing, as shown in the following figure.
Reuse community ecology
As mentioned above, the Midway Serverless architecture was designed to reuse the existing KOA ecosystem, transforming the underlying event rules of multiple platforms into a unified KOA-like API. The API’s similar purpose is for the entire KOA Web ecosystem, and we also want the entire KOA Middleware ecosystem to be reusable. As shown below, @KOA/CORS is introduced.
On the other hand, Midway, thanks to its IoC componenting capabilities, provided an egg infrastructure that was built on top of the egg infrastructure, while also being able to reuse existing Egg plug-ins to continue traditional enterprise development capabilities, such as the egg-mysql plugin shown below.
The front can assign
Cloud + development experience is one of Midway Serverless’s goals, traditional application development, front-end/back-end separation, multi-warehouse development, deployment separation. Even with node.js’s glue layer, there is no way to avoid the fragmentation of human development motion. In a Serverless system, this is not a problem.
Due to the simplification of the backend, coupled with the BaaS of cloud services, data aggregation and page rendering become easier, and the front-end can be used and developed faster.
Integration has gradually become the front-end appeal of this area. The so-called integration is not only the integration of traditional warehouse, but also the evolution of the whole development mode, and the opportunity to reshape the whole system of CI/CD from engineering system to code.
Today, Midway Serverless provides an integrated front-end development solution that incorporates the existing React and Vue ecosystem, as well as customized solutions for the entire tool chain (Webpack, Ice Scrips, UMI, etc.). Blogs, for example, also provide out-of-the-box solutions.
As for the detailed front – and back-end integration capabilities, we will write a separate article later on the details and thinking of front-end integration.
Applications and functions
Serverless is the direction for some time to come and the paving brick for the front end to move to a higher level.
I have been thinking about the relationship between the end state of functional development and applications.
At the present stage, our answer is to unify. After countless soul questioning and user demand questioning, we have come to this answer, function is the smallest embodiment of the application in the current business, more simply, it is part of the code running the application in the smallest specification container.
In the following period of time, we will focus on the access of more platforms and the migration scheme of traditional applications, so that the former users can also enjoy the dividend of Serverless flexibility, so that the cost of enterprises is lower and the business is easier to go online.
The last
Under the background of the deepening of the group’s large, medium and small front-end business architecture, with the help of the development of the group’s cloud native Serverless, Node.js saw the future in the end-to-end business delivery scenario last year.
The new generation of front-end business delivery mode of cloud + terminal has gradually become a reality, which can help the technical team to shape special forces with overall business delivery ability and help the business win quickly. But there is still a long way to go, and in order to get there early, there needs to be a strong focus on two core issues: cost of scale and speed of delivery.
We expect the Node.js/Serverless system to be fully advanced in the future through our continued investment in scale cost and speed of delivery. If you have any question, welcome to join nailing communication group: qr.dingtalk.com/action/join…
Midway Serverless, Go!
Experience courtesy: 5 minutes quick start Serverless
“Serverless” has been very popular in recent years. Everyone is keen to discuss the significance of its emergence, but little is said about how it can be used or implemented in a production environment. We designed the experience scene, hand in hand to take you 5 minutes to start Serverless, but also send 2000 Ali Cloud “the first line of code” gilt limited edition mugs!
Click to view details: developer.aliyun.com/adc/series/…
“Alibaba Cloud originator focuses on micro-service, Serverless, container, Service Mesh and other technical fields, focuses on the trend of cloud native popular technology, large-scale implementation of cloud native practice, and becomes the public account that most understands cloud native developers.”