Repository navigation
perf: stop rewriting unchanged sessions every pass and share one app snapshot per poll - #86
Merged
Merged
Conversation
…snapshot per poll Compare session facts independently of elapsed mixer presentation and reuse committed rows between passes. Restrict inferred parent work to live and recently ended sessions, and resolve explicit edges from one local index. Keep dashboard single-flight sharing while evicting superseded snapshots. Batch MCP history clock reads, and expose CPU, heap and memory profiling for the desktop app and development server. The 1600-session, 25-live benchmark drops from 274 ms and 587374 allocations to 49 ms and 166243 allocations per pass. Native and UTC package tests, web cache race tests, and native, Linux and Windows vet checks pass.
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.
What changed
The collector no longer rewrites every session on every pass. It keeps the committed rows in memory, writes only sessions that changed, and links parents only among sessions that can still change. The app and
driga dev serveshare one data snapshot per poll interval across concurrent page requests, and they gain--cpu-profileand--profile-forlikeservice run.Why
On the owner's Mac, Driga's own service and app each used about one CPU core, and the app's memory grew to about 760 MB. A 60 s profile of the live service (23 live agents, 1,616 stored sessions) put 31% of samples in the collector pass transaction:
The rewrites also grew the WAL to 54 MB.
Risk and rollout
data_versionfor writes from other connections and by a shared revision for writes through the same store. A failed pass discards them.Contract changes
driga appanddriga dev servegain--cpu-profileand--profile-for.Verified
TestPassUpsertsOnlyChangedSessionsuses a SQLite trigger to confirm a pass with no changes makes no session UPDATE. It failed before the fix withunchanged session updated 1 times.go testfor collector, store, derive, web and viewer, plus-racefor web and collector.GOOS=linux go buildandGOOS=windows go vetpass.