Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tips to reduce latency #13996

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs-v2/pages/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

@dylburger dylburger Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Increase Memory Allocation" -> "Increase memory"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the colon out of the bold here and in the rest of these sections


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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Return Static HTTP Responses" -> "Return static HTTP responses". Generally we only capitalize the first words of these sections, or proper nouns or other Pipedream features, but see here how "static" and "responses" should be lowercase.


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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change:

Reduce the number of steps and segments in your workflow

to

Reduce the number of steps and segments in your workflow, combining multiple steps into one, if possible.


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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change:

Use and increase the number of dedicated workers to eliminate cold starts, ensuring your workflow is ready to execute immediately.

to:

Use warm workers to reduce the startup time of workflows. Set as many warm workers as you want for high-volume traffic.


### 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.
Expand Down
8 changes: 8 additions & 0 deletions docs-v2/pages/workflows/settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<Callout type="info">
**Reducing Workflow Latency**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use the same terminology you do in the troubleshooting guide: "How can my workflow run faster?"


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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid duplicating the content you have in the troubleshooting guide, maybe just simplify and say:

See our guide on running workflows faster

For other ways to improve your workflow's performance, see [Troubleshooting](/troubleshooting#how-can-my-workflow-run-faster).

</Callout>

**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
Expand Down
9 changes: 8 additions & 1 deletion docs-v2/pages/workflows/triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -295,6 +294,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.


<Callout type="info">
**Reducing Workflow Latency**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same feedback from above here


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).

</Callout>

#### Customizing the HTTP response

If you need to issue a custom HTTP response from a workflow, you can either:
Expand Down
Loading