aws / aws/aws-durable-execution-sdk-js

[Feature]: Deduplicate SerDes deserialization within an invocation

Open
#864 0 comments 0 reactions 0 assignees View on GitHub
enhancement parity pkg:sdk
Dominant language
TypeScript
Stars
84
Forks
28
Avg merge
1d 19h
Merged PRs (30d)
43

Description

## What would you like?

Deduplicate repeated SerDes deserialization within a single Lambda invocation.

Async, context-dependent SerDes implementations may perform filesystem or network I/O. Repeated access to the same checkpointed result or exception currently calls `safeDeserialize()` again, even when the SerDes, serialized input, and durable payload identity are unchanged.

## Possible Implementation

- Add an invocation-scoped deserialization cache around SDK-managed SerDes calls.
- Key entries by SerDes object identity, durable execution ARN, entity identity, payload kind when available, and a digest of the serialized input.
- Store the in-flight `Promise` immediately so concurrent callers share one external read.
- Cache successful values, including `undefined`, but remove failed promises so a later call can retry.
- Bound completed entries with an LRU or weak-reference policy where practical.
- Clear all entries at the end of the Lambda invocation; do not retain a process-global cache across replays.
- Add tests for concurrent deduplication, cache hits, distinct contexts/data, `undefined`, failures, eviction, and invocation isolation.

## Is this a breaking change?

No.

## Does this require an RFC?

No.

## Additional Context

This is primarily valuable for filesystem and other external-service SerDes implementations. The Java SDK work in aws/aws-durable-execution-sdk-java#648 uses an invocation-scoped bounded cache and shares in-flight deserializations.

Contributor guide

Open the contributing guide

Research direction

Start by locating the SDK-managed SerDes calls and the Lambda invocation lifecycle that should own the cache. Review how durable execution ARN, entity identity, payload kind, and serialized input are available at those call sites. Done means concurrent and repeated deserializations are deduplicated within one invocation, failures can retry, entries are bounded, and the cache is cleared before the next invocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.