Chunk size and auto-load limits
What this is
chunk_size controls how many focus instances a historic / partitioned / sync-cursor validation call processes in one Function invocation. It is an operational setting on ViewConfigState (and view YAML / orchestrator payload). It is not a RuleSet or Data Product quality.rules field.
Auto-load then pulls related instances into the RDF graph for those focuses (forward via sh:node, reverse via neat:reverseDirectRelation or recognized reverse SPARQL). Separate hard caps bound how many related instances one call may load.
User mental model
chunk_size → how many focus nodes this Function call validates
auto-load → neighbours loaded for those focuses (SHACL-guided)
reverse → groups of at most 100 focuses per search (up to 1000 neighbours)
caps → max_auto_load_instances (default 10_000 total related)
Larger chunks amortize Function overhead. Reverse neighbours are read in groups of 100 focuses, so a larger chunk issues more of those reads. It does not put every focus in the chunk onto one shared page of 1000 neighbours.
General impact of chunk_size
Larger chunk_size |
Smaller chunk_size |
|---|---|
| Fewer Function invocations and partition steps for the same estate | More invocations; longer wall-clock for historic |
| Higher peak DMS / RDF memory per call | Lower peak memory per call |
| More reverse groups of 100 focuses in the same call | Fewer reverse groups per call |
| Default library value 200 when unset | Valid positive integers only |
Typical places it appears:
- View YAML / Toolkit:
chunk_size: 200(Quickstart config) - Orchestrator / partitioned payload:
chunk_size(Invoke) - Live ops:
ViewConfigState.chunk_sizefor{view_space}__{view_external_id}in the data-quality config space
Changing chunk_size does not change SHACL rule meaning. It changes batching and auto-load pressure. Redeploy or re-run historic after changing stored ViewConfigState so the next partitioned/sync payload picks up the new value.
Explicit impact on reverse direct relations
How reverse auto-load queries
When a reverse relation rule only checks existence and view type (for example DQ-012 / DQ-013 presence or DQ-016 / DQ-017 view typing on a scalar through_property with a stub neighbour *ExistenceShape), focus ids in the validation chunk are split into groups of at most 100 and resolved via instances.aggregate:
instances.aggregate(view=neighbour view, group_by=[through_property], aggregates=Count("externalId"), filter=through_property matches this group, limit=1000)
Each matched focus materializes min(count, witness_cap) lightweight witness nodes in the validation RDF graph (1 witness for pure existence, or max(minCount, maxCount + 1) when the focus shape declares cardinality constraints) instead of loading thousands of neighbour nodes per focus. On live instance, instance_sync_cursor, and pre_persist runs (use_search_for_reverse=False), the engine queries Postgres (instances.query) directly with an explicit HasData filter on the expected neighbour view — so shared-container nodes outside that view and stale positive search-index counts after relation deletion cannot create false witnesses — and removes each focus from the query filter as soon as witness_cap distinct neighbours are found.
Witness auto-load is strictly allowlisted to pure existence, cardinality, and negative view-type guards (FILTER NOT EXISTS { ?bad a NeighbourView }) with pure *ExistenceShape neighbour stubs. When a rule inspects additional properties on the reverse neighbour, projects an unguarded neighbour variable, traverses complex property paths, targets the neighbour class with custom SHACL targets, uses SHACL inference rules, or uses a list through_property, the engine automatically loads full neighbour nodes: each group of at most 100 focuses runs instances.search(view=neighbour view, ..., limit=1000) and bisects saturated groups, adding explicit HasData view-membership filtering when falling back to or paging with Postgres (instances.list / instances.query).
When the same related node is reached through multiple views (forward sh:node, multiple reverse relations, across auto-load depths, or already present in the input focus chunk), auto-load merges every referenced view's type, properties, and relationship edges into the RDF graph while counting each unique (space, externalId) at most once toward max_auto_load_instances.
A validation chunk of 200 focuses is two group reads per reverse property in the common case, not one page shared by all 200, and not one query per focus.
What operators see
| Symptom | Likely cause when reverse rules are correct |
|---|---|
Historic / partitioned Consistency FAIL on reverse presence (tagsRel, plan→operation, …) |
Neighbours past max_auto_load_instances, or the reverse property was not loaded (neat:reverseDirectRelation / physical SPARQL) |
| Single-instance revalidate of the same focus PASS | That focus's neighbours fit, while the chunk as a whole hit the total auto-load budget |
Related safety valve
max_auto_load_instances (default 10 000) caps total related instances across depths and is enforced inside each reverse load as well as at depth boundaries. When hit, further auto-load stops immediately, an unconditional warning is logged, and an autoload_incomplete schema issue (reason="budget") is recorded. Pre-persist Save requires an explicit lower cap (for example 250) — see Pre-persist.
Tuning vs correctness
| Action | Effect |
|---|---|
Lower per-view chunk_size on reverse-heavy views |
Fewer focuses validated together; lower peak memory. Reverse reads are already grouped by 100 focuses |
Raise max_auto_load_instances |
Allows more related instances in one call. A very high value increases memory |
Do not “fix” reverse false-fails by rewriting RuleSet Turtle or Publish when DMS still has the reverse edges and single-instance revalidate is green. Check the total auto-load budget and that reverse guidance is declared.
Rule authoring for reverse presence (SPARQL / neat:reverseDirectRelation, never sh:minCount on MultiReverseDirectRelation) stays in SHACL and CDF data models.
Operator checklist
- Confirm reverse guidance is correct (
neat:reverseDirectRelationor physical reverse SPARQL) — Auto-load. - Revalidate one failing focus. If it PASSes alone, check
max_auto_load_instancesfor that call. A chunk can still stop loading neighbours after the total related-instance budget. - Read
ViewConfigState.chunk_sizefor that view (config space). Compare with historic job “Chunk size:” logs. - For reverse-heavy views, a lower
chunk_sizereduces how many focuses are validated together. Reverse reads inside the call are already limited to 100 focuses each.