Skip to content

Skip the tenant lookup on incidence reads in single-tenant databases - #23

Merged
venkat1701 merged 3 commits into
mainfrom
perf/parallel-incidence-reads
Oct 4, 2026
Merged

venkat1701 merged 3 commits into
mainfrom
perf/parallel-incidence-reads

Conversation

@venkat1701

Copy link
Copy Markdown
Collaborator

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.incident were 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:

main this branch
2.46M lookups/s 4.61M
3.43M 3.97M
1.26M 1.54M

The bigger scaling gap from the benchmark will need a quiet machine to judge properly.

SecurityTest now also checks that once other tenants exist, neither another tenant nor the default-tenant admin can see an atom's incidences through INCIDENT TO, while the owner still can. Full ./mvnw install passes locally.

…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
venkat1701 force-pushed the perf/parallel-incidence-reads branch from e397264 to 20c46bc Compare October 4, 2026 08:20
@venkat1701
venkat1701 merged commit dde5d53 into main Oct 4, 2026
@venkat1701
venkat1701 deleted the perf/parallel-incidence-reads branch October 6, 2026 00:55
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.

Parallel incidence reads stop scaling

1 participant