Skip to content

Performance Megathread - Is your workflow run slow? Look here first #1930

@VaguelySerious

Description

@VaguelySerious

This issue gathers all known performance issues that are NOT due to edge-cases.

If your workflow performs well in most cases, but hits performance problems in some cases, please open a separate issue, and optionally link it here.

Known bottlenecks

Replay invocation overhead

Between every step, the workflow enqueues an event replay. This means invocation overhead, queue overhead, and initial state fetching overhead on each step call.

Replay event fetching overhead

  • Event replays need to fetch all event
    • This happens on a paginated endpoint, which cause multiple network roundtrips for non-trivial runs (Event pagination is inefficient for long runs #1928)
    • Events come with user payloads, which the World backend may choose to resolve lazily, requiring further network roundtrips, usually when the user payload is large
      • Keeping your step inputs/outputs small is the best way to reduce network overhead here at this point in time
      • Using DurableAgent/WorkflowAgent will almost certainly result in large step inputs/outputs as the full conversation needs to be passed to/from the LLM. This can be reduced to some extent.

Cold starts

Workflow "use workflow" and "use step" functions get bundled separately (< 5.0.0-beta.5) or as one bundle (>= 5.0.0-beta.5), each of which can incur cold starts separate from the API bundles that start the workflows.

The best ways to reduce this overhead are:

  • Reduce bundle size
  • Pre-warm functions
    • On Vercel, using Fluid compute (highly recommended) will intelligently pre-warm your functions (and reduce costs)
  • Use >= 5.0.0-beta.5 to half the amount of bundles that need to be warm

Cross-region networking

Your app, workflow runtime, and DB should all run in the same network region.

As of May 5, 2026, workflows run against iad1 (us-east), so it's recommended to run your workflow-enabled app and the connected databases or other services in the same region. See #1931 for updates.


A note on pre-releases

Performance improvements go through a QA phase before being released as 5.x..x-beta releases currently. If you want the latest improvements now, considering using pre-releases (nightly build) by installing tarballs from https://workflow-tarballs.labs.vercel.dev/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions