Skip to content

[docs]: document clearly that each invocation should fit within invocation timeout #248

Description

@yaythomas

URL/Location

https://docs.aws.amazon.com/durable-execution/getting-started/key-concepts/

Describe What's Incorrect or Lacking

Document clearly that A durable execution is the complete lifecycle of a durable function, and it can include multiple individual invocations of the Lambda function. Each invocation is bound by the maximum Lambda invocation timeout.

Recommend best practice to chunk work in Max Lambda Invocation Timeout segments, rather than rely on backend retrying on timeout.

import { DurableContext, withDurableExecution } from "@aws/durable-execution-sdk-js";

export const handler = withDurableExecution(
  async (event: any, context: DurableContext) => {
    const results = await context.map(
      "process-batches",
      event.batches,
      async (ctx: DurableContext, batch: any) => await ctx.invoke("my-worker-function:prod", batch),
      { maxConcurrency: 10 }
    );
    return results.getResults();
  }
);

Each batch runs as its own execution with a fresh 900 second window. The parent suspends while batches run, so the retry limit is never in play and it does not time out.

Tune maxConcurrency to your requirements. 1 is sequential, if your workload has to be serial. (

If your workload spends idle time waiting for an external system, consider callback or wait for condition.

https://docs.aws.amazon.com/durable-execution/patterns/best-practices/determinism/

Suggested Improvement

No response

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions