From b98e56f5a2702aa752f348cc2e37820e29ee6012 Mon Sep 17 00:00:00 2001 From: Andrew Chuang Date: Wed, 18 Sep 2024 16:57:57 -0300 Subject: [PATCH 1/3] add tips to reduce latency --- docs-v2/pages/troubleshooting.mdx | 12 ++++++++++++ docs-v2/pages/workflows/settings.mdx | 8 ++++++++ docs-v2/pages/workflows/triggers.mdx | 10 +++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs-v2/pages/troubleshooting.mdx b/docs-v2/pages/troubleshooting.mdx index 3b236f6913c73..684c868a87ef4 100644 --- a/docs-v2/pages/troubleshooting.mdx +++ b/docs-v2/pages/troubleshooting.mdx @@ -246,6 +246,18 @@ Pipedream also operates a [built-in key-value store](/data-stores/) that you can Use Pipedream's [built-in Delay actions](/workflows/flow-control/#delay) to delay a workflow at any step. +### How can my workflow run faster? + +Here are a few things that can help your workflow execute faster: + +1. **Increase Memory Allocation:** [Increase your workflow memory](/workflows/settings#memory) to at least 512 MB. Raising the memory limit will proportionally increase CPU resources, leading to improved performance and reduced latency. + +2. **Return Static HTTP Responses:** If your workflow is triggered by an HTTP source, [return a static HTTP response](/workflows/triggers#http-responses) directly from the trigger configuration. This ensures the HTTP response is sent to the caller immediately, before the rest of the workflow steps are executed. + +3. **Simplify Your Workflow:** Reduce the number of steps and [segments](/workflows/control-flow#workflow-segments) in your workflow. This lowers the overhead involved in managing step execution and exports. + +4. **Activate Warm Workers:** Use and increase the number of dedicated workers to [eliminate cold starts](/workflows/settings#eliminate-cold-starts), ensuring your workflow is ready to execute immediately. + ### How can I save common functions as steps? You can create your own custom triggers and actions ("components") on Pipedream using [the Component API](/components/api/). These components are private to your account and can be used in any workflow. diff --git a/docs-v2/pages/workflows/settings.mdx b/docs-v2/pages/workflows/settings.mdx index f3c31e7915002..cf2e29177bd45 100644 --- a/docs-v2/pages/workflows/settings.mdx +++ b/docs-v2/pages/workflows/settings.mdx @@ -112,6 +112,14 @@ By default, workflows run with {process.env.MEMORY_LIMIT} of memory. If you're p Increasing your workflow's memory gives you a proportional increase in CPU, so increasing your workflow's memory can reduce its overall runtime and make it more performant. + +**Reducing Workflow Latency** + +To reduce latency from the trigger to the end of your workflow, consider increasing the memory allocation to at least 512MB. This will result in significantly better performance compared to the default 256MB. +For other ways to improve your workflow's performance, see [Troubleshooting](/troubleshooting#how-can-my-workflow-run-faster). + + + **Pipedream charges credits proportional to your memory configuration**. When you modify your memory settings, Pipedream will show you the number of credits you'll be charged per execution. [Read more here](/pricing/#how-does-workflow-memory-affect-credits). ### Concurrency and Throttling diff --git a/docs-v2/pages/workflows/triggers.mdx b/docs-v2/pages/workflows/triggers.mdx index 48d331d3e54c9..47994293834a6 100644 --- a/docs-v2/pages/workflows/triggers.mdx +++ b/docs-v2/pages/workflows/triggers.mdx @@ -195,7 +195,7 @@ import got from "got"; export default defineComponent({ async run({ steps, $ }) { const pipeline = promisify(stream.pipeline); - + await pipeline( got.stream(steps.trigger.event.body.raw_body_url), fs.createWriteStream(`/tmp/raw_body`) @@ -295,6 +295,14 @@ By default, when you send a [valid HTTP request](#valid-requests) to your endpoi When you're processing HTTP requests, you often don't need to issue any special response to the client. We issue this default response so you don't have to write any code to do it yourself. + + +**Reducing Workflow Latency** + +To reduce latency for HTTP requests, return a static response directly from the trigger configuration. This ensures the HTTP response is sent to the caller immediately, before the rest of the workflow steps are executed. For more information, see [Sources](https://pipedream.com/docs/sources). + + + #### Customizing the HTTP response If you need to issue a custom HTTP response from a workflow, you can either: From 6fdefe240e72f202780d2bc2543364639d21f3fc Mon Sep 17 00:00:00 2001 From: Andrew Chuang Date: Wed, 18 Sep 2024 17:10:17 -0300 Subject: [PATCH 2/3] minor adjustments --- docs-v2/pages/troubleshooting.mdx | 6 +++--- docs-v2/pages/workflows/triggers.mdx | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs-v2/pages/troubleshooting.mdx b/docs-v2/pages/troubleshooting.mdx index 684c868a87ef4..65f402425bdf0 100644 --- a/docs-v2/pages/troubleshooting.mdx +++ b/docs-v2/pages/troubleshooting.mdx @@ -250,11 +250,11 @@ Use Pipedream's [built-in Delay actions](/workflows/flow-control/#delay) to dela Here are a few things that can help your workflow execute faster: -1. **Increase Memory Allocation:** [Increase your workflow memory](/workflows/settings#memory) to at least 512 MB. Raising the memory limit will proportionally increase CPU resources, leading to improved performance and reduced latency. +1. **Increase Memory Allocation:** Increase your [workflow memory](/workflows/settings#memory) to at least 512 MB. Raising the memory limit will proportionally increase CPU resources, leading to improved performance and reduced latency. -2. **Return Static HTTP Responses:** If your workflow is triggered by an HTTP source, [return a static HTTP response](/workflows/triggers#http-responses) directly from the trigger configuration. This ensures the HTTP response is sent to the caller immediately, before the rest of the workflow steps are executed. +2. **Return Static HTTP Responses:** If your workflow is triggered by an HTTP source, return a [static HTTP response](/workflows/triggers#http-responses) directly from the trigger configuration. This ensures the HTTP response is sent to the caller immediately, before the rest of the workflow steps are executed. -3. **Simplify Your Workflow:** Reduce the number of steps and [segments](/workflows/control-flow#workflow-segments) in your workflow. This lowers the overhead involved in managing step execution and exports. +3. **Simplify Your Workflow:** Reduce the number of [steps](/workflows/steps#code-actions) and [segments](/workflows/control-flow#workflow-segments) in your workflow. This lowers the overhead involved in managing step execution and exports. 4. **Activate Warm Workers:** Use and increase the number of dedicated workers to [eliminate cold starts](/workflows/settings#eliminate-cold-starts), ensuring your workflow is ready to execute immediately. diff --git a/docs-v2/pages/workflows/triggers.mdx b/docs-v2/pages/workflows/triggers.mdx index 47994293834a6..09b77262536f0 100644 --- a/docs-v2/pages/workflows/triggers.mdx +++ b/docs-v2/pages/workflows/triggers.mdx @@ -195,7 +195,6 @@ import got from "got"; export default defineComponent({ async run({ steps, $ }) { const pipeline = promisify(stream.pipeline); - await pipeline( got.stream(steps.trigger.event.body.raw_body_url), fs.createWriteStream(`/tmp/raw_body`) From fcfcc98277c5b238672b6bd77d928787fb7c1981 Mon Sep 17 00:00:00 2001 From: Andrew Chuang Date: Fri, 20 Sep 2024 17:06:14 -0300 Subject: [PATCH 3/3] pr review --- docs-v2/pages/troubleshooting.mdx | 8 ++++---- docs-v2/pages/workflows/settings.mdx | 6 ++---- docs-v2/pages/workflows/triggers.mdx | 5 ++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/docs-v2/pages/troubleshooting.mdx b/docs-v2/pages/troubleshooting.mdx index 65f402425bdf0..20e7ef6df4847 100644 --- a/docs-v2/pages/troubleshooting.mdx +++ b/docs-v2/pages/troubleshooting.mdx @@ -250,13 +250,13 @@ Use Pipedream's [built-in Delay actions](/workflows/flow-control/#delay) to dela Here are a few things that can help your workflow execute faster: -1. **Increase Memory Allocation:** Increase your [workflow memory](/workflows/settings#memory) to at least 512 MB. Raising the memory limit will proportionally increase CPU resources, leading to improved performance and reduced latency. +1. **Increase memory:** Increase your [workflow memory](/workflows/settings#memory) to at least 512 MB. Raising the memory limit will proportionally increase CPU resources, leading to improved performance and reduced latency. -2. **Return Static HTTP Responses:** If your workflow is triggered by an HTTP source, return a [static HTTP response](/workflows/triggers#http-responses) directly from the trigger configuration. This ensures the HTTP response is sent to the caller immediately, before the rest of the workflow steps are executed. +2. **Return static HTTP responses:** If your workflow is triggered by an HTTP source, return a [static HTTP response](/workflows/triggers#http-responses) directly from the trigger configuration. This ensures the HTTP response is sent to the caller immediately, before the rest of the workflow steps are executed. -3. **Simplify Your Workflow:** Reduce the number of [steps](/workflows/steps#code-actions) and [segments](/workflows/control-flow#workflow-segments) in your workflow. This lowers the overhead involved in managing step execution and exports. +3. **Simplify your workflow:** Reduce the number of [steps](/workflows/steps#code-actions) and [segments](/workflows/control-flow#workflow-segments) in your workflow, combining multiple steps into one, if possible. This lowers the overhead involved in managing step execution and exports. -4. **Activate Warm Workers:** Use and increase the number of dedicated workers to [eliminate cold starts](/workflows/settings#eliminate-cold-starts), ensuring your workflow is ready to execute immediately. +4. **Activate warm workers:** Use [warm workers](/workflows/settings#eliminate-cold-starts) to reduce the startup time of workflows. Set [as many warm workers](/workflows/settings#how-many-workers-should-i-configure) as you want for high-volume traffic. ### How can I save common functions as steps? diff --git a/docs-v2/pages/workflows/settings.mdx b/docs-v2/pages/workflows/settings.mdx index cf2e29177bd45..f286782704378 100644 --- a/docs-v2/pages/workflows/settings.mdx +++ b/docs-v2/pages/workflows/settings.mdx @@ -113,11 +113,9 @@ By default, workflows run with {process.env.MEMORY_LIMIT} of memory. If you're p Increasing your workflow's memory gives you a proportional increase in CPU, so increasing your workflow's memory can reduce its overall runtime and make it more performant. -**Reducing Workflow Latency** - -To reduce latency from the trigger to the end of your workflow, consider increasing the memory allocation to at least 512MB. This will result in significantly better performance compared to the default 256MB. -For other ways to improve your workflow's performance, see [Troubleshooting](/troubleshooting#how-can-my-workflow-run-faster). +**How can my workflow run faster?** +See [our guide on running workflows faster](/troubleshooting#how-can-my-workflow-run-faster). **Pipedream charges credits proportional to your memory configuration**. When you modify your memory settings, Pipedream will show you the number of credits you'll be charged per execution. [Read more here](/pricing/#how-does-workflow-memory-affect-credits). diff --git a/docs-v2/pages/workflows/triggers.mdx b/docs-v2/pages/workflows/triggers.mdx index 09b77262536f0..160dfd853d5b4 100644 --- a/docs-v2/pages/workflows/triggers.mdx +++ b/docs-v2/pages/workflows/triggers.mdx @@ -296,10 +296,9 @@ When you're processing HTTP requests, you often don't need to issue any special -**Reducing Workflow Latency** - -To reduce latency for HTTP requests, return a static response directly from the trigger configuration. This ensures the HTTP response is sent to the caller immediately, before the rest of the workflow steps are executed. For more information, see [Sources](https://pipedream.com/docs/sources). +**How can my workflow run faster?** +See [our guide on running workflows faster](/troubleshooting#how-can-my-workflow-run-faster). #### Customizing the HTTP response