Netherframe Performance Guide
Overview
Netherframe's current performance story is built around a few concrete features:
- choosing the right execution workflow for the job
- deferred validation when you want to trade immediate failures for aggregated reports
- explicit concurrency control for hybrid execution
- measuring with the committed benchmark runner before changing behavior
This guide focuses on those supported paths.
Quick Wins
1. Use Deferred Validation When Iterating
from nf.core import App
app = App(deferred_validation=True)
This is useful when you expect validation failures while iterating and want to see all errors at synthesis time instead of stopping on the first one.
2. Tune Hybrid Parallelism Explicitly
from nf.core import App
app = App(max_concurrent_resources=20)
For hybrid execution workloads, explicit concurrency tuning is one of the highest-leverage settings.
3. Measure with a Stable Setup
Use the same mode, construct count, and logging setup when comparing runs.
uv run python libs/netherframe.core/tests/performance/perf_profile.py \
--mode explicit \
--count 10000 \
--profile-dir /tmp/nf_perf_profiles
For nf_autoid-based authoring, compare against the matching benchmark mode
instead of treating it as a separate runtime optimization switch:
uv run python libs/netherframe.core/tests/performance/perf_profile.py \
--mode autoid \
--count 10000 \
--profile-dir /tmp/nf_perf_profiles_autoid
Deferred Validation
Deferred validation is the main supported workflow-level performance knob today.
Benefits
- aggregates validation failures into one synthesis report
- avoids interrupting large graph construction on the first duplicate or cycle
- can be faster in error-heavy iterative development
Trade-offs
- errors surface later
- valid graphs may be slightly slower because extra bookkeeping is retained
Hybrid Execution Tuning
For hybrid execution, the main user-facing throughput knob is
max_concurrent_resources.
You can set it in code:
from nf.core import App
app = App(
max_concurrent_resources=20,
recovery_strategy="CHECKPOINT",
enable_progress_reporting=True,
)
Or for every app of the project, overriding those arguments:
[tool.nf.config]
max_concurrent_resources = 20
recovery_strategy = "checkpoint"
enable_progress_reporting = true
Or for one run: nf --max-concurrent-resources 20 apply --app platform --recovery-strategy checkpoint.
Guidance:
- increase concurrency for large hybrid workloads when the provider and target APIs can handle it
- reduce concurrency when you see provider throttling, noisy retries, or local CPU contention
- compare before and after rather than assuming higher is always faster
Authoring and Import-Time Costs
nf_autoid is part of the current authoring workflow, but its cost profile is
primarily import-time, not a backend synthesis or execution toggle.
Use the benchmark runner's explicit and autoid modes when you want to
measure authoring-style overheads directly. Do not treat nf_autoid as a
replacement for the real runtime knobs above.
Measuring Performance
Use the committed benchmark runner for repeatable numbers:
uv run python libs/netherframe.core/tests/performance/perf_profile.py --mode explicit --count 10000
For smaller ad hoc checks:
import time
from nf.core import App, Resource, Stack
app = App(nf_id="timing")
stack = Stack(nf_scope=app, nf_id="demo")
Resource(nf_scope=stack, nf_id="bucket", nf_type="aws_s3_bucket", bucket="demo-bucket")
def time_synth() -> None:
"""Synthesize the app and print how long it took (writes files: not called here)."""
start = time.perf_counter()
app.synth()
print(f"synth took {time.perf_counter() - start:.3f}s")
When measuring:
- keep logging configuration consistent across runs
- compare the same workflow mode each time: synthesis vs hybrid execution
- change one setting at a time
- prefer the committed benchmark runner for comparisons you intend to keep
Performance Checklist
- keep stacks focused and cohesive
- minimize unnecessary cross-stack references
- enable
deferred_validationwhen you want aggregated failures - tune
max_concurrent_resourcesfor hybrid workflows - keep logging stable and reasonably quiet while profiling
- compare
explicitandautoidonly when authoring style is part of the question - profile before and after changing hot paths
Related Docs
- Configuration Layout
- Performance runs:
libs/netherframe.core/tests/performance/README.mdin the repository - Logging, Debugging, and Performance