Skip to content

Persistent runner / server mode to eliminate per-invocation CLI startup overhead #730

@devJamStudio

Description

@devJamStudio

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

  1. Batch everything into one method call — works but forces unnatural model design, bypasses per-file resource tracking
  2. Standalone Deno HTTP server — fast but exits the swamp ecosystem entirely (no resource writes, no workflow history, no vault)
  3. 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

Metadata

Metadata

Assignees

Labels

awaiting-feedbackWaiting on further inputbugSomething isn't workingexternalAn issue raised by an external contributor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions