Repository navigation
Description
Summary
Importing the same file twice with the same binary produces different namespace tables. The variation that matters is which prefixes get a code at all once the 16-bit code space fills. That decides which subjects are stored in the overflow namespace. In one BSBM import it made an explore query 25% slower while writes were pending.
Observed
Setup:
- Data: BSBM 100M N-Triples (26 GB).
- Command:
fluree create bsbm --from dataset.nt, file storage, m7a.4xlarge. - Imports A and B used the same binary, 0db5da5 on
feat/pooled-named-graphs. That branch leaves the namespace and import allocation code unchanged fromnext. - A third import was built from 0080e56, a nearby commit on the same branch.
| import | codes in table | dataFrom* prefixes coded |
producers coded (of 5,618) | vendors coded (of 2,896) | rating sites coded (of 289) | subjects in overflow (of 9,026,272) |
|---|---|---|---|---|---|---|
| A (0db5da5) | 65,534 (max 65,533) | 5,644 | 5,618 | 26 | 0 | 8,631,158 |
| B (0db5da5, re-import) | 65,534 (max 65,533) | 5,621 | 5,593 | 28 | 0 | 8,629,596 |
| 0080e56 | 65,534 (max 65,533) | 5,622 | 5,594 | 28 | 0 | 8,629,564 |
A coded producers 5,602–5,618 and lacked vendors 66–70. The other imports coded vendors up to 70 and producers only up to 5,601.
Effect. Explore Q10 was run with indexing disabled and 200 update blocks unindexed, using the same binary on both imports:
- A: 13.2–13.8 ms.
- B: 10.6–11.1 ms.
Under pending writes, Q10's time is dominated by novelty translation: subject_probe_lane_plan → cached_overlay_ops → reverse dictionary lookups, about 80% of the query. On A this executes about 16% more instructions. The likely cause is that offers from the uncoded vendors are overflow subjects keyed by their full IRI. That mechanism is inferred, not confirmed.
Cause
SharedNamespaceAllocator::get_or_allocate (fluree-db-transact/src/namespace.rs) hands out codes first-come from one counter. Chunk 0 is parsed serially; later chunks are parsed in parallel, so allocation order follows worker timing. Once USER_START..OVERFLOW is exhausted, every new prefix gets OVERFLOW, so the race decides which prefixes are coded.
Two kinds of variation
- Code numbering can vary on any import with parallel chunks. The set of prefixes is the same, but a prefix's code differs. That changes subject-id order and therefore leaf layout between imports. It should not change results; its performance effect has not been measured.
- The coded set varies once the table fills. Different prefixes get codes, so different subjects land in
OVERFLOW. That changes how those subjects are encoded and how fast queries over them run, as shown above. This is the case observed here.
Why it matters
- Reproducibility: two imports of one file are not comparable for performance. Benchmarks that compare separately imported stores can report a code regression that is really a layout difference. This confounded the BSBM Update investigation.
- User-visible performance: query speed on an imported ledger depends on a race during import.
Directions (undecided)
- Deterministic allocation. Allocate in input order, for example by merging per-chunk proposals in chunk order. Or run a pre-pass and code the most-used prefixes first; this also bears on the overflow issue.
- Visible layout. Report a digest of the namespace table at the end of import, so benchmark harnesses can detect differing layouts.
Related
- Measure namespace overflow costs near the 16-bit limit before choosing wider ids or better overflow handling #2135: overflow costs near the 16-bit limit. Allocation order decides which prefixes are coded.
- BSBM Update throughput on feat/pooled-named-graphs: original ~10% gap not reproduced under controlled inputs; small workload effect unresolved #2136: the BSBM Update regression, where this was a confounder.
Activity
bplatz commentedon Nov 23, 2026
Under
NamedLocal(#2422), BSBM 100M no longer fills the namespace table, so every import codes every prefix and the overflow placement effect measured here (Q10 ~25% slower on one import) no longer occurs.Parallel imports still number codes in a different order from run to run. That changes subject-id order but not results, and its cost hasn't been measured. Not worth extra work on the import path. For benchmark A/Bs, give every candidate a copy of one import.