ByteByteGo 01月29日
AWS Lambda Turns 10
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

AWS Lambda自2014年诞生以来,经历了从最初的简单函数执行服务到如今功能强大的serverless计算平台的演变。文章回顾了Lambda的起源,最初旨在解决客户在EC2实例上运行零星任务的资源浪费问题。通过引入serverless计算,Lambda允许开发者无需管理服务器即可运行代码,极大地简化了开发流程。文章还详细介绍了Lambda在支持的语言、部署方式、成本效率以及关键技术创新方面的演进,如Firecracker微虚拟机、SnapStart预热技术以及Lambda Layers等,这些创新显著提升了Lambda的性能和用户体验。

🚀**Serverless计算**:Lambda开创了serverless计算模式,开发者无需管理服务器即可运行代码,平台自动根据请求量伸缩实例数量,无需进行服务器容量规划。

💡**多语言支持与容器化**:Lambda从最初仅支持Node.js扩展到支持Python、Java、Go等多种语言,并通过引入容器镜像支持,解决了大型依赖和复杂工作负载的问题,使得CI/CD流程更加便捷。

⏱️**冷启动优化**:通过引入Firecracker微虚拟机和SnapStart预热技术,Lambda显著降低了冷启动延迟,提升了函数执行效率,特别是对于启动时间较长的语言如Java。

📦**Lambda Layers**:Lambda Layers允许开发者共享通用依赖项,避免重复上传,简化了部署流程,并支持自定义运行时,进一步增强了Lambda的灵活性。

?Kiss Manual Testing Goodbye—Ship 5x Faster (Sponsored)

Build features without the drag of multi-day QA Cycles. QA Wolf covers 80% of your web and mobile app with automated tests in just four months, then maintains and updates them 24/7.

Unlimited parallel test runs validate every change in minutes, not days.

The zero flakes guarantee cuts out false alarms and wasted engineering hours.

Salesloft saves $750k a year by running over 300 tests on each PR—a clear example of how QA Wolf transforms QA speed and efficiency.

Spend less time stressing over slow test suites and more time delivering what your customers need.

Take your releases from bottlenecked to blazing-fast!

Schedule a demo to learn more


Disclaimer: The details in this post have been derived from multiple AWS reInvent talks and articles by the Amazon engineering team. All credit for information about AWS Lambda’s internals goes to the presenters and authors. The link to these videos and articles is present in the references section at the end of the post. We’ve attempted to analyze the details and provide our input about them. If you find any inaccuracies or omissions, please leave a comment, and we will do our best to fix them.

AWS Lambda turned 10 recently.

Like with most innovations at Amazon, Lambda’s origin was rooted in the team’s observation of how customers used existing services.

The AWS engineering team noticed that many customers were maintaining entire fleets of EC2 instances to handle sporadic tasks such as writing data to a database, processing files, or performing other minor functions. These instances often sat idle but consumed resources both in terms of customer costs and AWS infrastructure.

This inefficiency signaled a gap in the AWS offerings. There was no service designed to handle short-lived, lightweight computational tasks without the need for constant resource provisioning.

AWS aimed to address this problem by creating a service that could:

The goal was to make it possible for developers to "just run some code" efficiently, securely, and cost-effectively, without the complexity of managing an EC2 fleet. This led to the birth of AWS Lambda at the end of 2014.

In this article, we’ll explore how the AWS engineering team approached the creation of AWS Lambda and the innovations they have made over the years to address customer needs.

The Concept of AWS Lambda

At Amazon, crafting internal documents, such as PR/FAQs (Press Release/Frequently Asked Questions), is a foundational practice for developing new ideas and products.

The process of creating these documents is designed to clearly articulate the product vision before working on it. Writing requires the authors to be explicit about the goals, capabilities, and limitations of the proposed product. These documents help anticipate customer and stakeholder concerns. Also, the FAQ section forces the teams to think through potential questions and challenges.

The initial draft is rarely perfect and goes through feedback and revision cycles. This ensures that ideas are refined and weaknesses are addressed. 

The PR/FAQ for Lambda identified key customer problems, such as the need for cost-effective, scalable, and secure execution of short-lived tasks. It envisioned a serverless model that freed developers from managing servers, anticipated features like fine-grained billing and multi-language support, and laid the foundation for innovations like Firecracker and Lambda Layers.

Core Features at Launch

AWS Lambda introduced groundbreaking capabilities that transformed how developers approach application development and infrastructure management. Some key features were as follows:

Serverless Computing

Lambda pioneered the serverless paradigm, allowing developers to run code without provisioning, managing, or scaling servers.

Here’s how it works in practice:

This approach eliminates the need for server capacity planning and lets the developers concentrate on their application rather than operational overhead.


How I use 20+ AI models in one app

(PRESENTED BY YOU.COM)

I routinely have ChatGPT, Claude, and Gemini open side-by-side because each model excels at tasks that the others don't.

That’s why I like using You.com, the tool that combines the most popular AI models in one app:

Ends soon: Access 12 months of Pro at no cost ($180 value). Just visit the offer page to redeem your special offer as a ByteByteGo newsletter subscriber.


Supported Languages and Deployment Options

Initially, Lambda only supported Node.js, a popular JavaScript runtime. Node.js was chosen for its lightweight nature and existing usage among AWS developers. To make it work, Lambda functions must adhere to specific runtime conventions (for example, the exports.handler function in Node.js).

Over time, support was expanded to languages like Python, Java, Ruby, Go, .NET, and custom runtimes.

Lambda supported deployment via ZIP files, allowing developers to bundle their code and dependencies for easy upload. Integration with Git repositories simplified workflows for developers who could link their source code repositories to deploy directly.

Cost Efficiency

Lambda introduced fine-grained billing, where customers paid only for the compute time consumed by their functions. It was a major shift from traditional EC2-based hosting models.

The time was rounded to the nearest 250ms at launch. However, it was later reduced to 1ms billing for even greater cost efficiency.

Also, AWS offered a generous free tier, which included a set number of invocations and execution times per month, encouraging developers to experiment with Lambda at no cost. Developers could choose memory allocation between 128 MB and 10 GB (as of 2023 updates), and Lambda would automatically allocate proportional CPU power.

Key Innovations Over the Decade

AWS Lambda has significantly evolved since its launch, incorporating new features and capabilities that have expanded its use cases and improved performance.

Support for Additional Runtimes

As mentioned earlier, Lambda supported only Node.js at launch. Over the years, AWS added support for popular languages to cater to a broader developer base. Here’s when different languages were added:

In 2018, they also introduced custom runtimes. 

Introduced with the Runtime API, this feature allowed developers to implement Lambda functions in virtually any language by packaging their runtime binaries. 

See the diagram below:

Containerization Support

In 2020, Lambda began supporting container images, enabling developers to package their functions as Docker containers.

This was particularly useful for large dependencies exceeding the 250 MB limit of traditional ZIP-based deployments. By allowing containers up to 10 GB in size, Lambda could support complex workloads like machine learning inference and data-heavy applications.

A couple of technical benefits were as follows:

Reducing Cold Start Latency

Cold starts occur when Lambda initializes a runtime environment for a function that hasn’t been invoked recently. This adds latency, especially for languages like Java that require significant initialization.

The AWS engineering team made a couple of enhancements to address this:

1 - Firecracker MicroVMs

Initially, AWS Lambda used EC2 instances to run functions, dedicating a T2 instance to each tenant. This was secure but inefficient, leading to high overhead due to the need to provision entire EC2 instances for each function.

In 2018, AWS introduced Firecracker.

Firecracker is a lightweight virtual machine manager (VMM) designed to run serverless workloads such as AWS Lambda and AWS Fargate. It creates and manages microVMs using Linux’s Kernel-based Virtual Machine.

MicroVMs are isolated, secure environments that are much faster to start than traditional virtual machines. They are designed to boot in milliseconds, significantly reducing the cold start latency for Lambda functions. 

2 - SnapStart

When a Lambda function is invoked and there isn’t an already running execution environment, Lambda has to create a new one. This involves several steps:

These steps can take time, especially for complex functions or runtimes like Java, which have longer startup times.

SnapStart is a feature designed to reduce cold start latency by pre-initializing the execution environment and then using snapshots. It pre-warms function environments and captures a snapshot of the initialized runtime.

Lambda reuses this snapshot during subsequent invocations, bypassing the initialization process and significantly reducing startup time (up to 90%).

See the diagram below that shows how SnapStart works.

Lambda Layers

Introduced in 2018, Layers allow developers to share common dependencies (for example, libraries, binaries, and configuration files) across multiple functions.

Here’s how it works:

See the diagram below that shows the concept AWS Lambda Layers:

Lambda Layers help reduce deployment package size by separating common code from individual function code. This simplifies version management for shared dependencies. 

Some common use cases for Lambda Layers are as follows:

Ecosystem Improvement

Over the years, the AWS engineering team has integrated Lambda with services like API Gateway, EventBridge, S3, DynamoDB, and SQS to build complex, event-driven architectures.

AWS improved provisioned concurrency, allowing developers to pre-warm environments for latency-sensitive applications. The AWS Serverless Application Model (SAM) and AWS CDK also simplified the development and deployment of serverless applications.

Operational Excellence in AWS Lambda

AWS Lambda was designed to simplify cloud application development while prioritizing key operational goals: security, scalability, and cost-effectiveness.

Here’s how these goals help different stakeholders.

Conclusion

Lambda introduced the world to serverless computing where developers focus entirely on code and application logic, leaving infrastructure management to the cloud provider.

Organizations across industries, from startups to large enterprises, leverage Lambda to build scalable, cost-effective, and event-driven applications. 

Over its first decade, Lambda has evolved through a relentless focus on customer needs. Customers often use services like Lambda in ways the creators didn’t anticipate, driving the need for continuous innovation and feature expansion. Therefore, customer feedback has been instrumental in shaping Lambda’s capabilities.

Looking ahead, AWS aims to further optimize cold starts and runtime performance, particularly for latency-sensitive applications. Greater integration with AWS and non-AWS services is expected, enabling Lambda to support a wider range of architectures and technologies.

References:


SPONSOR US

Get your product in front of more than 1,000,000 tech professionals.

Our newsletter puts your products and services directly in front of an audience that matters - hundreds of thousands of engineering leaders and senior engineers - who have influence over significant tech decisions and big purchases.

Space Fills Up Fast - Reserve Today

Ad spots typically sell out about 4 weeks in advance. To ensure your ad reaches this influential audience, reserve your space now by emailing sponsorship@bytebytego.com.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

AWS Lambda Serverless 微虚拟机 冷启动 容器化
相关文章