Skip to content

feat(client): limits of the bytes of a live topic and a live state (CLI-101) - #465

Merged
mark1russell7 merged 4 commits into
mainfrom
feat/cli-101-live-bytes
Nov 7, 2026
Merged

mark1russell7 merged 4 commits into
mainfrom
feat/cli-101-live-bytes

Conversation

@mark1russell7

Copy link
Copy Markdown
Owner

The fault

The live state had three limits: 1,024 keys on a topic, 16,384 bytes in a value and 4,096 topics. Their product is more than 64 GiB. A default Node heap is approximately 4.5 GB. So the limits did not bound the memory of a host. Approximately 260 full topics fill that heap.

The change

  • maxTopicBytes (default 1 MiB) bounds the JSON bytes of the values of one topic. It bounds a snapshot and a window event too.
  • maxBytes (default 64 MiB) bounds the JSON bytes of all values of a state.
  • A set that adds bytes above a limit gets FORBIDDEN, reason write-not-allowed. A set that makes a value smaller goes. A refused set changes nothing.
  • A value from another host has the same limits. A value that does not fit is not kept, and the old value of its key ends with the reason expired.
  • The getter bytes gives the sum. The end of a key and close() give the bytes back.
  • An ASCII text needs no TextEncoder: its bytes are its length.

Version

The changeset is minor: a set that 0.48 kept can now get a refusal. The changeset has the migration step. The strategist decides the version call.

The defaults

The defaults are not yet from a measure. The bench of #464 reads the heap of a key, the cost of a snapshot and the block of a window event at these edges. Its run sets the defaults before this merges.

Checks

  • The typecheck of @procedures/client is clean.
  • The tests related to live-state.ts: 1,052 passed.
  • The API report is updated.
  • ste-lint has no error on the changed prose.

🤖 Generated with Claude Code

…LI-101)

The product of the keys, the bytes of a value and the topics was above
64 GiB, so the limits did not bound the memory of a host. maxTopicBytes
(1 MiB) bounds a topic, its snapshot and its window event. maxBytes
(64 MiB) bounds the state. A value from another host has the same
limits. The getter bytes gives the sum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mark1russell7 added a commit that referenced this pull request Nov 6, 2026
…ix (CLI-101)

snapshot-k64, window-s10-k64 and window-s100-k64 read a topic of 64 keys
of 16,384 bytes. The report gives the heap of a topic and of a state at
the limits of bytes of #465, and the share of the heap limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mark1russell7 mark1russell7 added the reads-pending A run of a prediction of this PR's item is not read yet. Do not merge. label Nov 6, 2026
…efaults (CLI-101)

Run 42152574477 of the bench live-limits: a full topic at 1 MiB keeps 1,075,659 bytes, a full state at 64 MiB keeps 68,842,177 bytes (1.53 percent of a 4,496,293,888-byte heap).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mark1russell7 mark1russell7 removed the reads-pending A run of a prediction of this PR's item is not read yet. Do not merge. label Nov 6, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mark1russell7
mark1russell7 merged commit 54cdb34 into main Nov 7, 2026
19 checks passed
@mark1russell7
mark1russell7 deleted the feat/cli-101-live-bytes branch November 7, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant