OpenFn / OpenFn/kit

Runtime & worker: optimistations for large state objects

Open
#1,374 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DevX
Dominant language
TypeScript
Stars
21
Forks
23
Avg merge
1d 22h
Merged PRs (30d)
17

Description

I want to think about how to optimise large state objects

At the end of each step we do a bunch of processing on objects, including:

  • cleaning up the returned state
  • serializing the state object out of the worker thread
  • serializing the state object out of the child process
  • serializing the state object through the websocket
  • trying to work out the size of the object (once or many times)
  • I think there's some stuff about removing circular references

I'd like to explore things like:

  • using shared memory buffers to reduce serialization
  • using heuristics to guess that state object is large (Ie, an array of 10k items, or an object more than 100 properties deep), and then optimising around that (like bailing out of serialization and circularity checking earlier)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the end-of-step processing for state objects in the runtime and worker, tracing cleanup, size checks, circular-reference handling, and serialization through the worker thread, child process, and websocket. Compare the costs of these paths for large state objects and define benchmarks and acceptance criteria before choosing an optimization; the issue does not name files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.