Repository navigation
Skip the tenant lookup on incidence reads in single-tenant databases - #23
Merged
Merged
Conversation
…ault tenant exists Profiling the parallel read path showed no lock contention; a quarter of the time went to a second catalog lookup per call just to check the atom's tenant. With only the default tenant every atom is visible, so the reader checks that once per snapshot and skips the lookup.
venkat1701
force-pushed
the
perf/parallel-incidence-reads
branch
from
October 4, 2026 08:20
e397264 to
20c46bc
Compare
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.
Closes #9
I profiled the parallel incidence workload with JFR before touching anything, as the issue suggested. The snapshot pin map turned out not to be the problem: there's no lock contention on the read path at all. The parked threads are idle pool workers and the group committer, and pinning barely shows up in the samples.
What did show up is plain CPU work. About 26% of the samples in
Reader.incidentwere a second catalog-tree lookup (visible->View.atom) made only to check the atom's tenant. When the reader is in the default tenant and no other tenant exists, every atom is visible, and an atom that doesn't exist has no incidence entries anyway, so that lookup can be skipped. The reader works this out once per snapshot.Numbers: 10 threads doing 100k lookups each on a 50k node / 100k edge database. I ran main and this branch back to back three times. The machine was busy with other containers (load average 24 to 37), so the absolute numbers jump around, but this branch won every pair:
The bigger scaling gap from the benchmark will need a quiet machine to judge properly.
SecurityTestnow also checks that once other tenants exist, neither another tenant nor the default-tenant admin can see an atom's incidences throughINCIDENT TO, while the owner still can. Full./mvnw installpasses locally.