Persistent runner / server mode to eliminate per-invocation CLI startup overhead
Opened by stack72 · 4/7/2026· GitHub #730
Problem
Every swamp workflow run or swamp model method run call incurs ~80s of fixed startup overhead (swamp framework init, workflow evaluation, vault resolution, Deno process startup). The actual execution inside the Deno model is fast — e.g. processing 4 tachograph .DDD files takes 276ms of real work but 82,858ms wall time end-to-end.
This makes swamp unusable for any workload that needs to process many items over time (file ingestion pipelines, webhook handlers, scheduled batch jobs) unless all work is batched into a single monolithic method call.
Proposed Solution
A persistent runner mode that keeps the swamp runtime alive and accepts workflow/model execution requests without restarting:
# Start a persistent runner
swamp runner start --port 8080
# Submit work to the running instance (fast, no startup cost)
swamp runner run tachograph-batch-activities --input '{"dirPath": "/data/ddd"}'Expected Impact
- Per-request latency: ~82s → ~300ms (275x improvement)
- Enables real-time processing pipelines via swamp
- Vault secrets loaded once at startup, not re-resolved per call
- Deno runtime and extension models stay warm
Alternatives Considered
- Batch everything into one method call — works but forces unnatural model design, bypasses per-file resource tracking
- Standalone Deno HTTP server — fast but exits the swamp ecosystem entirely (no resource writes, no workflow history, no vault)
- Accept the overhead — only viable for infrequent one-shot runs
Environment
- swamp: 20260226.140557.0
- OS: macOS (darwin 23.6.0, aarch64)
- Use case: EU tachograph .DDD file processing pipeline
Automoved by swampadmin from GitHub issue #730
Open
No activity in this phase yet.
Sign in to post a ripple.