目录
正在加载目录…
正在阅读专栏 分布式共识系统专栏 第 26 篇 · 共 59 篇 · 44%

MIT 6.5840:Lecture 17 AWS Lambda

发布于 2026-09-21 10:06 · 最后编辑于 2026-09-21 18:14 · 版本 v2 · 字数 18,499 · 预计阅读 37 分钟 👁 31 次阅读

本篇逐页逐行译注 MIT 6.5840 Spring 2026 Lecture 17 的 AWS Lambda guest lecture,覆盖 container loading、lazy loading、deduplication、microVM、Firecracker、cache hierarchy、erasure coding、tenant isolation、SnapStart 与安全边界。

MIT 6.5840:Lecture 17 AWS Lambda

TL;DR

  • Lambda 的抽象:Lambda 是响应 events 运行用户代码、并自动管理 compute resources 的 compute service。
  • 本讲重点:serverless 的 container image 越来越大,但 cold start 仍需很快;AWS 通过 deterministic flattening、chunking、分层 cache 和按需加载来隐藏 storage layout。
  • 缓存层次:worker-local L1、AZ-local shared L2 和 S3 authority L3 共同提供低延迟与可扩展性;不同层级的 latency、capacity 和 failure trade-off 不同。
  • 去重与完整性:chunk 可以按内容命名,使用 SHA2;对于 encrypted data,则用确定性的 key/IV 派生与 AES-GCM 生成可去重的 ciphertext。
  • 隔离与安全:同样的按需加载技术不仅解决 cold starts,也可用于 tenant isolation 和 session isolation;权限边界限制 flattener、worker 与其他主体能做的事情。

名词解释

名词含义本讲对应物
AWS Lambda事件驱动的 serverless compute service自动管理 compute resources
Cold start新建 execution environment 时的启动延迟container loading 的主要目标
MicroVM运行 function code 的轻量虚拟机由 Firecracker 提供
FirecrackerAWS 的轻量 virtualization monitorLambda worker 中的 MicroVM
Deterministic flattening把 container image 展平成确定性的 filesystem image便于 chunk、deduplicate 和按需读取
Chunk被独立存储和加载的数据块512kB chunks
L1/L2/L3不同 locality 和 latency 的 cache/storage 层级worker、AZ、S3
Erasure coding用冗余编码抵抗 storage failure 的技术Any 4 of 6
SnapStart通过 snapshot 降低启动成本的机制与 MicroVM snapshot、memory uniqueness 相关
userfaultfd在 user space 处理 page faults 的 file descriptor按需加载 memory chunks
Tenant isolation多租户服务之间的隔离防止 untrusted code 相互影响
Content-addressed name根据内容摘要命名对象SHA2(chunk data)

目录

章节内容
版本与来源固定 AWS Lambda PDF
逐页翻译57 页原页截图与文本层逐行译注
机制小结container loading、cache hierarchy、erasure coding 与 isolation
本篇验收页面、图片尺寸和文本覆盖记录

版本与来源

  • 课程版本:MIT 6.5840 Spring 2026。
  • 官方 PDF:AWS Lambda guest lecture slides,Marc Brooker,57 页。
  • 本地源文件 SHA-256:63b29a9b1c3d0369815b997ab9210942e271491437ae86718ce0491f54ad27e9。
  • 课程日程:MIT 6.5840 Spring 2026 Schedule。
  • 配套阅读:On-demand Container Loading、Firecracker、Restoring Uniqueness in MicroVM Snapshots。
  • 页面与图片处理:源 PDF 页面尺寸为 792×612 points;每页渲染为 1584×1224 PNG,笔记中统一以 792 宽度嵌入。这样保留原始 4:3 比例与页面内图片、图表、公式和文字的相对位置。
  • 翻译边界:PDF 文本层按页面和源文本顺序逐行保留并翻译;页面截图保留原始 slide 的全部视觉内容,包括未进入 PDF 文本层的 diagram labels、公式、照片、矢量图和版权声明。AWS 的版权声明原样保留。

逐页翻译

第 1 页:AWS Lambda

assets/Lecture 17 AWS Lambda/p01

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

© 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved.

© 2026,Amazon Web Services, Inc. 或其 affiliates。保留所有权利。

AWS Lambda

AWS Lambda。

(specifically container loading and snapstart)

(具体聚焦 container loading 和 SnapStart。)

Marc Brooker

Marc Brooker。

VP/Distinguished Engineer

VP / Distinguished Engineer。

mbrooker@amazon.com

mbrooker@amazon.com。

第 2 页:Lambda 定义

assets/Lecture 17 AWS Lambda/p02

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

“AWS Lambda is a compute service that runs your code in

“AWS Lambda 是一种 compute service,它会运行你的 code,

response to events and automatically manages the

以响应 events,并自动管理

compute resources.”

compute resources。”

第 3 页:示例代码页面

assets/Lecture 17 AWS Lambda/p03

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的代码和视觉布局已通过原页截图保留;PDF 文本层没有额外正文。

第 4 页:为什么需要 Lambda

assets/Lecture 17 AWS Lambda/p04

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Why?

为什么?

• Building scalable, fault-tolerant systems is hard.

• 构建 scalable、fault-tolerant systems 很难。

• Driving high hardware utilization is hard.

• 提高 hardware utilization 很难。

• Multi-tenancy makes it easier.

• Multi-tenancy 让这件事更容易。

• The cloud needs glue.

• cloud 需要 glue。

• Code close to data is more efficient?

• Code 靠近 data 会更 efficient 吗?

第 5 页:Lambda 组件图

assets/Lecture 17 AWS Lambda/p05

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的 Lambda 组件图已按原尺寸和位置保留;PDF 文本层没有额外正文。

第 6 页:客户代码与管理组件

assets/Lecture 17 AWS Lambda/p06

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的 diagram labels 已在原页截图中保留;PDF 文本层没有额外正文。

第 7 页:示例代码与组件图

assets/Lecture 17 AWS Lambda/p07

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的代码和组件图已按原页截图保留;PDF 文本层没有额外正文。

第 8 页:简单、容易、快速

assets/Lecture 17 AWS Lambda/p08

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

“… simple …”

“……simple……”

“… easy …”

“……easy……”

“… fast …”

“……fast……”

第 9 页:复杂、困难

assets/Lecture 17 AWS Lambda/p09

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

“… complex …”

“……complex……”

“… complicated …”

“……complicated……”

“… difficult …”

“……difficult……”

第 10 页:Container image 的变化

assets/Lecture 17 AWS Lambda/p10

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Before

Before。

After

After。

250MB max

最大 250MB。

10GB max

最大 10GB。

Code or .zip

Code 或 .zip。

Container image

Container image。

Custom tools

Custom tools。

Standard tools

Standard tools。

第 11 页:不增加更慢的 cold starts

assets/Lecture 17 AWS Lambda/p11

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Before

Before。

After

After。

250MB max

最大 250MB。

10GB max

最大 10GB。

Code or .zip

Code 或 .zip。

Container image

Container image。

Custom tools

Custom tools。

Standard tools

Standard tools。

without slower cold starts!

并且不带来更慢的 cold starts!

第 12 页:带宽

assets/Lecture 17 AWS Lambda/p12

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

150 Pb/s

150 Pb/s。

第 13 页:启动时实际需要的数据

assets/Lecture 17 AWS Lambda/p13

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Harter et al: Only 6.4% of container

Harter 等人:只有 6.4% 的 container

data is needed at startup!

data 在 startup 时是需要的!

Harter et al, Slacker: Fast Distribution with Lazy Docker Containers, FAST’16

Harter 等人,《Slacker: Fast Distribution with Lazy Docker Containers》,FAST’16。

第 14 页:数据需求曲线

assets/Lecture 17 AWS Lambda/p14

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的曲线图和坐标标签已按原页截图保留;PDF 文本层没有额外正文。

第 15 页:按需加载

assets/Lecture 17 AWS Lambda/p15

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Find a way, invisible to applications, to load

找到一种对 applications invisible 的方式,来按需加载

data on demand and deduplicate common

data,并 deduplicate common

data.

data。

第 16 页:MicroVM 与 Firecracker

assets/Lecture 17 AWS Lambda/p16

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Customer’s Function Code

Customer 的 Function Code。

MicroVM

MicroVM。

Firecracker

Firecracker。

virtio block

virtio block。

Agache et al, “Firecracker: Lightweight Virtualization for Serverless Applications”, AWS, 2020

Agache 等人,《Firecracker: Lightweight Virtualization for Serverless Applications》,AWS,2020。

第 17 页:插入延迟

assets/Lecture 17 AWS Lambda/p17

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Customer’s Function Code

Customer 的 Function Code。

MicroVM

MicroVM。

Firecracker

Firecracker。

virtio block

virtio block。

Insert lies here

Insert lies here(这里插入 lies)。

第 18 页:Container image 不是 filesystem

assets/Lecture 17 AWS Lambda/p18

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

But…

但是……

Container images aren’t filesystems.

Container images 不是 filesystems。

第 19 页:确定性展平与 chunks

assets/Lecture 17 AWS Lambda/p19

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Deterministic

Deterministic。

Flattening

Flattening。

Ext4

Ext4。

filesystem

filesystem

image

image。

512kB

512kB。

chunks

chunks。

第 20 页:按需加载的延迟要求

assets/Lecture 17 AWS Lambda/p20

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

But…

但是……

Real storage is really fast (<100μs), so loading

Real storage 非常快(<100μs),因此 loading

on demand must be really fast too.

on demand 也必须非常快。

第 21 页:Lambda worker 与完整数据集

assets/Lecture 17 AWS Lambda/p21

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Lambda worker

Lambda worker。

Really fast storage with the

具有完整 data set 的

whole dataset.

really fast storage。

<1ms

<1ms。

第 22 页:Lambda worker

assets/Lecture 17 AWS Lambda/p22

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Lambda worker

Lambda worker。

页面中的 storage/cache 图已按原页截图保留;PDF 文本层没有更多正文。

第 23 页:延迟与缓存层次

assets/Lecture 17 AWS Lambda/p23

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

This is fake data, aimed to give the general idea, because I can’t share the real numbers.

这些是 fake data,只是为了表达 general idea,因为我不能分享 real numbers。

第 24 页:不同 storage levels

assets/Lecture 17 AWS Lambda/p24

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

On-worker L1

On-worker L1。

In-AZ L2

In-AZ L2。

In S3 (aka L3)

In S3(也就是 L3)。

This is fake data, aimed to give the general idea, because I can’t share the real numbers.

这些是 fake data,只是为了表达 general idea,因为我不能分享 real numbers。

第 25 页:L1、L2、L3 topology

assets/Lecture 17 AWS Lambda/p25

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Customer’s

Customer 的

Code

Code。

MicroVM

MicroVM。

Firecracker

Firecracker。

Local Cache

Local Cache。

L1

L1。

Lambda Worker

Lambda Worker。

AZ-Local

AZ-Local。

Shared Cache

Shared Cache。

L2

L2。

Authority: S3

Authority:S3。

L3

L3。

第 26 页:图示页面

assets/Lecture 17 AWS Lambda/p26

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的图示已按原页截图保留;PDF 文本层没有额外正文。

第 27 页:图示页面

assets/Lecture 17 AWS Lambda/p27

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的图示已按原页截图保留;PDF 文本层没有额外正文。

第 28 页:图示页面

assets/Lecture 17 AWS Lambda/p28

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的图示已按原页截图保留;PDF 文本层没有额外正文。

第 29 页:容量问题

assets/Lecture 17 AWS Lambda/p29

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

How Big?

有多大?

第 30 页:缓存成本

assets/Lecture 17 AWS Lambda/p30

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Jim Gray and Franco Putzolu, IBM Research, 1977 (picture thanks to Pat Helland)

Jim Gray 和 Franco Putzolu,IBM Research,1977(图片感谢 Pat Helland)。

cost of caching = cost of reloading

caching 的成本 = reloading 的成本。

第 31 页:容量上界

assets/Lecture 17 AWS Lambda/p31

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Max(size needed for cost,

Max(为 cost 所需的 size,

size needed for latency)

为 latency 所需的 size)。

第 32 页:failure

assets/Lecture 17 AWS Lambda/p32

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

What about failures?

failures 怎么办?

第 33 页:复制与 failure

assets/Lecture 17 AWS Lambda/p33

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Figure shamelessly borrowed from Decandia et al, Dynamo: Amazon’s Highly Available Key-value Store, SOSP’07

Figure 毫不避讳地借自 Decandia 等人的《Dynamo: Amazon’s Highly Available Key-value Store》,SOSP’07。

第 34 页:图示页面

assets/Lecture 17 AWS Lambda/p34

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的复制图示已按原页截图保留;PDF 文本层没有额外正文。

第 35 页:图示页面

assets/Lecture 17 AWS Lambda/p35

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的复制图示已按原页截图保留;PDF 文本层没有额外正文。

第 36 页:副本数量

assets/Lecture 17 AWS Lambda/p36

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

• One Copy

• One Copy。

• Not durable enough.

• 不够 durable。

• Two Copies

• Two Copies。

• 2x the cost! (or, half the effective cache size)

• 2 倍 cost!(或者,effective cache size 减半。)

第 37 页:Erasure Coding

assets/Lecture 17 AWS Lambda/p37

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Erasure Code

Erasure Code。

“Any 4 of 6”

“6 个中的任意 4 个”。

第 38 页:延迟曲线

assets/Lecture 17 AWS Lambda/p38

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的 latency 曲线已按原页截图保留;PDF 文本层没有额外正文。

第 39 页:p99

assets/Lecture 17 AWS Lambda/p39

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

p99

p99。

第 40 页:曲线页面

assets/Lecture 17 AWS Lambda/p40

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的曲线图已按原页截图保留;PDF 文本层没有额外正文。

第 41 页:其他类型的 chunks

assets/Lecture 17 AWS Lambda/p41

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

What about chunks of other stuff?

其他东西的 chunks 呢?

Like memory?

比如 memory?

第 42 页:MicroVM snapshot

assets/Lecture 17 AWS Lambda/p42

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Brooker, et al, Restoring Uniqueness in MicroVM Snapshots, https://arxiv.org/pdf/2102.12892

Brooker 等人,《Restoring Uniqueness in MicroVM Snapshots》,https://arxiv.org/pdf/2102.12892。

第 43 页:snapshot 中的 uniqueness

assets/Lecture 17 AWS Lambda/p43

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Brooker, et al, Restoring Uniqueness in MicroVM Snapshots, https://arxiv.org/pdf/2102.12892

Brooker 等人,《Restoring Uniqueness in MicroVM Snapshots》,https://arxiv.org/pdf/2102.12892。

第 44 页:userfaultfd

assets/Lecture 17 AWS Lambda/p44

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

userfaultfd - create a file descriptor for handling

userfaultfd——创建一个 file descriptor,用于处理

page faults in user space

user space 中的 page faults。

第 45 页:不仅是 cold starts

assets/Lecture 17 AWS Lambda/p45

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Not only cold starts!

不只是 cold starts!

Tenant Isolation (for multi-tenant

Tenant Isolation(用于 multi-tenant

services handling untrusted code).

处理 untrusted code 的 services)。

Session isolation (e.g. for AI agents).

Session isolation(例如用于 AI agents)。

第 46 页:Questions

assets/Lecture 17 AWS Lambda/p46

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Questions

Questions。

46

46。

第 47 页:Erasure Coding 与 complexity

assets/Lecture 17 AWS Lambda/p47

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Erasure Coding

Erasure Coding。

vs

对比。

Complexity

Complexity。

第 48 页:延迟曲线

assets/Lecture 17 AWS Lambda/p48

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

页面中的延迟曲线已按原页截图保留;PDF 文本层没有额外正文。

第 49 页:权限边界

assets/Lecture 17 AWS Lambda/p49

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

• Deterministic Flattener

• Deterministic Flattener。

• Can only put chunks, not read them.

• 只能 put chunks,不能 read chunks。

• Worker

• Worker。

• Can only read chunks for the functions it is running.

• 只能 read 它正在运行的 functions 对应的 chunks。

• Everybody else

• 其他所有主体。

• Can do basically nothing.

• 基本上什么也不能做。

第 50 页:未加密 chunk 的命名

assets/Lecture 17 AWS Lambda/p50

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Chunk data

Chunk data。

Chunk name =

Chunk name =

SHA2(

SHA2(

)

)。

第 51 页:加密 chunk 的命名

assets/Lecture 17 AWS Lambda/p51

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Chunk data

Chunk data。

Chunk name =

Chunk name =

SHA2(AES(

SHA2(AES(

))

))。

Key

Key。

IV

IV。

第 52 页:AES-GCM ciphertext

assets/Lecture 17 AWS Lambda/p52

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

Chunk ciphertext =

Chunk ciphertext =

AESgcm(

AESgcm(

 key = f(

   key = f(

 iv = [0,…])

   iv = [0,…])

Chunk data ,

Chunk data,

Chunk data ),

Chunk data)。

Douceur et al, “Reclaiming Space from Duplicate Files in a Serverless Distributed File System”, Microsoft, 2002

Douceur 等人,《Reclaiming Space from Duplicate Files in a Serverless Distributed File System》,Microsoft,2002。

第 53 页:ciphertext 的命名

assets/Lecture 17 AWS Lambda/p53

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

chunk ciphertext

chunk ciphertext。

Chunk name =

Chunk name =

SHA2(

SHA2(

)

)。

第 54 页:为什么不用 GCM tag

assets/Lecture 17 AWS Lambda/p54

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

chunk ciphertext

chunk ciphertext。

Chunk name =

Chunk name =

SHA2(

SHA2(

)

)。

Q: Why not use the GCM tag?

问题:为什么不使用 GCM tag?

第 55 页:Customer KMS Key

assets/Lecture 17 AWS Lambda/p55

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

chunk 1, name, key

chunk 1、name、key。

chunk 2, name, key

chunk 2、name、key。

…

……

chunk N, name, key

chunk N、name、key。

Customer’s KMS Key

Customer 的 KMS Key。

第 56 页:KMS Key 与 function

assets/Lecture 17 AWS Lambda/p56

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

chunk 1, name, key

chunk 1、name、key。

chunk 2, name, key

chunk 2、name、key。

…

……

chunk N, name, key

chunk N、name、key。

Customer’s KMS Key

Customer 的 KMS Key。

第 57 页:权限边界总结

assets/Lecture 17 AWS Lambda/p57

© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

© 2020,Amazon Web Services, Inc. 或其 Affiliates。保留所有权利。

• Deterministic Flattener

• Deterministic Flattener。

• Can only put chunks, not read them.

• 只能 put chunks,不能 read chunks。

• Worker

• Worker。

• Can only read chunks for the functions it is running.

• 只能 read 它正在运行的 functions 对应的 chunks。

• Everybody else

• 其他所有主体。

• Can do basically nothing.

• 基本上什么也不能做。

机制小结

1. Container loading 的核心矛盾

Container image 的上限从 250MB 扩大到 10GB,但 startup 期间通常只需要很小一部分 data;如果把整个 image 先加载完,cold start 会受到 storage、network 和 latency 的共同影响。解决方向是把 container image deterministic flatten 成 filesystem image,再切成 512kB chunks,让 application 看不到底层 loading 过程。

2. L1/L2/L3 cache hierarchy

Lambda worker 上有最靠近 MicroVM 的 local cache(L1),Availability Zone 内有 shared cache(L2),S3 作为 authority(L3)。越靠近 worker,latency 越低但容量越有限;越靠近 authority,容量和持久性越强但 latency 更高。按需加载要求每一层都足够快,尤其不能让 <100μs 的 real storage 访问被过慢的 miss path 抵消。

3. Reliability 与 erasure coding

单个 copy 不够 durable,两个 copies 会直接增加 cost 或减少 effective cache size。Erasure coding 用多个编码块换取 failure tolerance,例如 Any 4 of 6:任意 4 个块即可恢复原始内容。代价是编码、解码、调度和 tail latency 的 complexity,需要在 erasure coding 与 complexity 之间权衡。

4. Memory snapshot 与 isolation

相同的 chunking/按需加载思想也可用于 memory 和 MicroVM snapshots。userfaultfd 允许在 user space 处理 page faults,从而延迟加载 memory pages。这样不仅能降低 cold starts,还能用于 multi-tenant services 的 tenant isolation,以及 AI agents 等场景的 session isolation。

5. Deduplication、加密与权限

未加密 chunk 可以用 SHA2(chunk data) 作为 chunk name;加密后,如果每次使用随机 key/IV,就无法稳定 deduplicate,因此需要确定性的派生方式来产生可复用的 ciphertext name。与此同时,Deterministic Flattener 只能 put chunks,Worker 只能 read 当前运行 functions 的 chunks,其他主体基本没有权限,形成数据去重与安全隔离之间的边界。

本篇验收

  • [x] 官方 AWS Lambda PDF 已固定:57 页,SHA-256 与来源记录一致。
  • [x] 每页均嵌入原始页面截图;原始页面 792×612 points,PNG 为 1584×1224,Obsidian 显示宽度固定为 792。
  • [x] PDF 文本层按页面顺序逐行保留并翻译;页面内未进入文本层的 diagram、公式、照片和矢量文字由原页截图完整保留。
  • [x] container loading、cold starts、deterministic flattening、512kB chunks、MicroVM、Firecracker、L1/L2/L3、erasure coding、userfaultfd、tenant/session isolation、SHA2、AES-GCM、KMS Key 和权限边界均覆盖。
  • [x] AWS 版权声明和原始引用按页面位置保留。
  • [ ] 中文译文仍建议进行一次人工术语审校;自动审计验证页面与文本层覆盖,不证明图片内文字的翻译语义正确。
← 返回列表
← 上一篇 MIT 6.5840:Lecture 16 Cache Consistency: Memcached at Facebook 下一篇 → MIT 6.5840:Lecture 18 Ray

评论 (0)

暂无评论,来留下第一条吧。
登录 或 注册 后才能发表评论