优化成本
在此页面上,介绍了一些优化使用 Remotion Lambda 成本的策略。
🌐 On this page, a few strategies for optimizing the cost of using Remotion Lambda are presented.
更少的内存
🌐 Less memory
减少内存将线性降低成本。在部署 Lambda 函数时尝试不同的内存值,看看在不发生崩溃的情况下能将内存设置得多低。
🌐 Reducing the memory will linearly decrease the cost. Try out different values for the memory when deploying a Lambda function and see how low you can set it without experiencing a crash.
较低的并发
🌐 Lower concurrency
大量的计算时间花在启动 Lambda 函数、打开浏览器、上传和下载资源上。通过使用更少的 Lambda 函数,可以减少产生的开销,这最终将导致成本更低,但渲染速度也会更慢。有关更多信息,请参见Lambda 并发页面。
🌐 A lot of compute time is spent on warming up the Lambda function, opening browsers, uploading and downloading assets. By using less Lambda functions, less overhead is being produced which will ultimately result in lower cost, however also in slower render speeds. See the Lambda Concurrency page for more information.
使用成本较低的地区
🌐 Using cheaper regions
并非所有 AWS 区域的费用相同。请查看 AWS Lambda 定价表,了解你是否正在使用费用较高的区域。
🌐 Not all AWS regions have the same cost. See the AWS Lambda pricing chart to see if you are using a region that is more expensive.
预先计算数据
🌐 Pre-compute data
考虑你的计算是否会在每个被调用的 Lambda 函数上运行。如果可能,预先计算数据一次,然后将其作为 输入属性 传递给渲染。
🌐 Consider whether your computation will run on every invoked Lambda function. If possible, pre-compute data once and pass it as input props to the render.
使渲染更高效
🌐 Make the render more performant
提高渲染效率也将降低使用 Lambda 的成本。请参阅 一般性能提示。
🌐 Making your render more efficient will also reduce the cost of using Lambda. See the general performance tips.
现实生活中的优化实例
🌐 Real life optimization example
请看这个视频,了解我们如何通过发现瓶颈并消除它们来优化 Lambda 函数的成本。
🌐 See this video of how we optimized the cost of a Lambda function by finding the bottlenecks and eliminating them.
另请参阅
🌐 See also