How Alibaba’s Midway‑FaaS Framework Redefines Serverless Architecture
This talk explains the evolution of Alibaba’s internal Midway‑FaaS framework, detailing how it abstracts vendor‑specific serverless functions, introduces standardized serverless.yml, flexible runtime hooks, and TypeScript‑based development to achieve vendor lock‑in avoidance, scalability, cost efficiency, and improved developer productivity across multiple cloud platforms.
Community Background
The Serverless community is rapidly growing and has become one of the four major directions of Alibaba’s front‑end committee, offering both opportunities and challenges. Various cloud providers (AWS, Azure, Google, Alibaba Cloud, Tencent Cloud) offer their own function services, each with its own standards and innovations such as Alibaba Cloud’s CustomRuntime and Tencent Cloud’s Service 2.0.
Vendor Lock‑In Prevention
Different cloud providers use different signatures for function entry points. For example, Alibaba Cloud supports req, res, context and event, context, callback, while Tencent Cloud and AWS have their own variations. The community’s Serverless Framework uses a serverless.yml file to define resources for each platform, but plugin support varies across providers.
To avoid vendor lock‑in, we designed a framework that standardizes serverless.yml and abstracts the input parameters into a unified FaaSContext. The callback is converted to a Promise‑based async function, and the original context is exposed as a property of FaaSContext. This allows a consistent function signature: async function handler(FaaSContext, event?).
Flexibility
We aim for a flexible deployment model that lets functions scale horizontally and vertically. Traditional web routes become independent HTTP triggers, each deployed as a separate function. By aggregating functions into a single instance when appropriate, we reduce cold‑start overhead and lower costs.
Our configuration‑only approach lets developers adjust deployment density (high‑density deployment) without changing code, supporting both individual and aggregated function deployments.
Development Efficiency
With growing team sizes, standardization, extensibility, and maintainability become critical. By introducing TypeScript interfaces such as FaaSContext, we provide strong typing and IDE support. The Midway‑FaaS framework, built on TypeScript, offers IoC, decorators, and other modern features while remaining compatible with existing FaaS workflows.
Runtime Extension
We defined a lifecycle with four stages— RuntimeStart, FunctionStart, Invoke, Close —each offering before/after hooks. The lightweight LightRuntime implements this lifecycle across platforms, while a runtime-engine manages execution.
Additionally, we introduced a Layer concept (inspired by AWS Lambda) that can be attached to any runtime to provide cross‑scenario capabilities such as unified monitoring, metrics, and migration support.
After nearly a year of iteration, the framework has been used to migrate Alibaba’s Taobao guide business and other BU projects to a Serverless model, successfully passing large‑scale promotional events.
We plan to open the Midway‑FaaS capabilities to the community; the code is already on GitHub and is in public beta, with a v1.0 release expected next January.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Taobao Frontend Technology
The frontend landscape is constantly evolving, with rapid innovations across familiar languages. Like us, your understanding of the frontend is continually refreshed. Join us on Taobao, a vibrant, all‑encompassing platform, to uncover limitless potential.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
