2

​​​​​​​启动性能实时对比:为什么Rust适合无服务器?

 1 year ago
source link: https://www.jdon.com/64831.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

​​​​​​​启动性能实时对比:为什么Rust适合无服务器?
为什么Rust适合无服务器?因为它对用户来说更快,尤其是冷启动。请点击标题加载网页,自己尝试一下,看看有何不同。

该测试比较了Rust、Go、Python、NodeJs、Ruby、.NET、Java等几种语言在serverless平台的启动时间,结果:

  • Rust启动时最短 15ms
  • Go其次64ms
  • python83ms
  • Java8和Java11垫底400ms

第1步
在每个 AWS 支持的运行时中都编写了一个超简单的 hello-world 函数:

  • nodejs12x
  • nodejs14x
  • nodejs16x
  • nodejs18x
  • python37
  • python38
  • python39
  • dotnetcore31
  • dotnet6
  • java11
  • java8
  • ruby27

除了两个自定义运行时:

  • go在provided
  • rust在provided.al2

每个函数都打包在一个 zip 文件中,上传到 S3 存储桶。

第2步
每天,每个功能都从 S3 中获取,作为冷启动部署和调用 10 次。
然后,包含初始化持续时间、使用的最大内存和其他有用信息的 REPORT 日志行将保存到 DynamoDB 表中。

步骤 3
在所有这些调用之后,存储在 Dynabo DB 中的所有信息都会被聚合并创建一个新的 JSON 文件,然后提交给这个 repo。即:https ://github.com/maxday/lambda-perf/blob/main/data/2022-09-05.json


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK