Repository navigation
Conversation
Self-hosted servers run as :dev, so the invalidator kept every transaction for every app in sync-table-txes. The buffer is capped by count, not bytes, so it could fill the heap and stay full while idle. Only buffer for apps with sync-table subscriptions. Also cap the aggregator sketch cache at 256 entries, overridable with the aggregator-sketch-cache-max-size flag. Each sketch is about 1.6 MB, so the old cap of 4096 was about 6.5 GB. From instantdb#2935. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies the changes from instantdb#2935 unmodified, to fix the memory growth that makes us restart the self-hosted server.
invalidator.clj: fillsync-table-txesonly for apps with sync-table subscriptions. Self-hosted servers run as:dev, so every transaction for every app was buffered. The buffer is capped at 10,000 by count, not bytes, so it could fill the heap and stay full while idle.aggregator.clj: cap the sketch cache at 256 entries, overridable with theaggregator-sketch-cache-max-sizeflag. Each sketch is about 1.6 MB, so the old cap of 4,096 was about 6.5 GB.Known limitations, accepted as they don't affect us:
scripted-apphas no calls to_syncTableExperimental.falseremoves the cache limit. We don't set this flag.Testing: not compiled or tested yet; the machine this was prepared on has no Clojure toolchain or Postgres. It's also not yet confirmed on the VPS that this is the cause of the restarts.
To verify after deploying, check that these counts stay small while the server is idle:
jcmd <pid> GC.class_histogram | grep -E 'WalEntry|WalRecord'🤖 Generated with Claude Code