Skip to content

🎥 Make videos programmatically with React

lambda: optimizing for speed

Jonny Burgerd9a03ff359c5
diff --git a/packages/docs/docs/lambda/cost.md b/packages/docs/docs/lambda/cost.md
index c73b3115c9..3de98ad5e3 100644
--- a/packages/docs/docs/lambda/cost.md
+++ b/packages/docs/docs/lambda/cost.md
@@ -18,10 +18,15 @@ Not all AWS regions have the same cost. See the [AWS Lambda](https://aws.amazon.
Consider whether your computation will run on every invoked Lambda function. If possible, pre-compute data once and pass it as [input props](/docs/parametrized-rendering#input-props) to the render.
+## Less memory
+
+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.
+
## Make the render more performant
Making your render more efficient will also reduce the cost of using Lambda. See the [general performance tips](/docs/performance)
## See also
+- [Optimizing for speed](/docs/lambda/optimizing-speed)
- [Performance](/docs/performance)
diff --git a/packages/docs/docs/lambda/speed.md b/packages/docs/docs/lambda/speed.md
new file mode 100644
index 0000000000..a0ab4345fe
--- /dev/null
+++ b/packages/docs/docs/lambda/speed.md
@@ -0,0 +1,29 @@
+---
+id: optimizing-speed
+title: Optimizing for speed
+slug: /lambda/optimizing-speed
+---
+
+On this page, a few strategies are presented for making a render on Lambda as fast as possible.
+
+## Higher concurrency
+
+Generally, a lower value for [`framesPerLambda`](/docs/lambda/rendermediaonlambda#framesperlambda) will result in higher concurrency and therefore an opportunity to finish the render in less absolute time. At the same time, more overhead will be produced, making the render more expensive. You will also experience diminishing returns, and adding too much concurrency can make the speed slower because the overhead of orchestrating many Lambda functions outweigh the gains.
+See the [Lambda Concurrency](/docs/lambda/concurrency) page for more information.
+
+## More memory
+
+Adding more memory on Lambda will also scale up the CPU power on Lambda proportionally, therefore making the render faster. At the same time, the cost also linearly increases with the memory you add.
+
+## `concurrencyPerLambda` property
+
+The [`concurrencyPerLambda`](/docs/lambda/rendermediaonlambda#concurrencyperlambda) property in [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) allows you to open multiple browser tabs in a single Lambda function, therefore opening an opportunity to do more work at once. If the Lambda function is too busy, increasing the concurrency might also be counterproductive.
+
+## Make the render more performant
+
+See the [general performance tips](/docs/performance) which also apply to Lambda.
+
+## See also
+
+- [Optimizing for cost](/docs/lambda/optimizing-cost)
+- [Performance](/docs/performance)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index a47e4572ee..ba13ce7749 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -379,6 +379,7 @@ module.exports = {
],
},
"lambda/optimizing-cost",
+ "lambda/optimizing-speed",
"lambda/limits",
"lambda/changelog",
"lambda/upgrading",