Rust 再次被选中以节省成本!Rust 取代了 Python,将 Amazon Cloud 成本削减了 75%!

AWS Lambda还有一个实验性的Rust运行时,简化了Rust中的运行时功能,包括支持Lambda事件、扩展和Lambda运行时API的crate。对于1GB的RAM,Rust和Boto3代码具有类似的性能,但对于256MB的RAM,增强的Rust版本仍然表现良好,而另一个则没有。根据亚马逊员工在某个专业社交平台上的反馈,“这里的每个人都在使用Rust”,还有用户指出,Rust编译器团队的负责人Jon Gjergarten也受雇于亚马逊。闪电般快速的执行:Rust是一种以其卓越的性能而闻名的编译语言。
摘要由CSDN通过智能技术生成

As it is widely known, Lambda functions and large runtimes are not an ideal match due to slower cold start times and higher memory requirements compared to native code. On the other hand, many developers find it more efficient to develop using Java and Python rather than system languages like Rust.
众所周知,Lambda函数和大型运行时并不是理想的匹配,因为与本机代码相比,Lambda函数的冷启动时间更慢,内存需求更高。另一方面,许多开发人员发现使用Java和Python进行开发比使用Rust等系统语言更有效。

However, now there’s a way to truly “cut costs and boost efficiency” without the need to rewrite the entire Lambda function in Rust instead of Python.
然而,现在有一种方法可以真正“削减成本并提高效率”,而不需要用Rust而不是Python重写整个Lambda函数。

01 Switching to Rust: Python’s AWS Complexity Reduced, Cost Cut by 75%!
01改用Rust:Python的AWS复杂性降低,成本降低75%!

Merdler Kravitz, an engineering manager at the cloud consulting company CloudEX, provided an example of a Lambda function. This function used Python to list S3 (Simple Storage Service) buckets. It turned out that the AWS SDK Boto3 for Python was too bloated. By replacing the functions requiring Boto3 with Rust, significant benefits were achieved in terms of cost and performance, even though Python was still used for other code.
云咨询公司CloudEX的工程经理Merdler Kravitz提供了一个Lambda函数的例子。此函数使用Python列出S3(简单存储服务)存储桶。事实证明,AWS SDK Boto3 for Python过于臃肿。通过将需要Boto3的函数替换为Rust,在成本和性能方面取得了显着的优势,即使Python仍然用于其他代码。

The key to replacing Python code with Rust lies in PyO3, which provides Rust bindings for Python. Attributes in Rust code expose functions as standard Python interfaces.
用Rust替换Python代码的关键在于PyO3,它为Python提供了Rust绑定。Rust代码中的属性将函数暴露为标准Python接口。

As a result, in the example presented by Merdler Kravitz, the cold start speed improved threefold, and the memory requirements were significantly lower. For 1GB of RAM, Rust and Boto3 code had similar performance, but for 256MB of RAM, the enhanced Rust version still performed well, while the other did not.
因此,在Merdler Kravitz提出的例子中,冷启动速度提高了三倍,内存需求也显著降低。对于1GB的RAM,Rust和Boto3代码具有类似的性能,但对于256MB的RAM,增强的Rust版本仍然表现良好,而另一个则没有。

Cost Benefits of Using Rust in Lambda: An Example from re:Invent
在Lambda中使用Rust的成本效益:re:Invent的一个例子

Especially on serverless platforms, reducing the required computing resources can lower costs. “Rust is generally cheaper than Python, roughly 1/3 to 1/4 of the latter,” he claimed.
特别是在无服务器平台上,减少所需的计算资源可以降低成本。Rust通常比Python便宜,大约是后者的1/3到1/4。

At the re:Invent conference, AWS also announced that its SDK for Rust is now ready for production. Earlier in November last year, the cloud g

  • 56
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

老父亲的能量嘎嘣脆

感谢支持,共同成长

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值