Skip to content

v3.6.1

Choose a tag to compare

@jkool702 jkool702 released this 06 Oct 12:45
· 412 commits to main since this release
e3ebc32

forkrun v3.6.1

Release: v3.6.1
Status: Stable release

forkrun v3.6.1 introduces the new Python frontend and substantially expands the process-execution, streaming, recovery, NUMA, and zero-copy capabilities available from Python.

The existing Bash/C execution path remains intact. The Python frontend is designed around the same underlying execution model rather than wrapping Python's conventional process-pool abstractions.

Highlights

  • New Python frontend with run(), map(), and stream() APIs.
  • Python execution modes for direct Python callables, process spawning, C plugins, and splice/streaming paths.
  • True streaming ingestion with bounded memory and backpressure.
  • Ordered and unordered output modes.
  • Zero-copy output="view" results backed by read-only mapped output storage.
  • C-backed output ordering and aggregation.
  • Process supervision, worker recovery, respawn, escrow, and trap/ACK handling.
  • NUMA-aware execution and multi-node worker placement.
  • Checkpoint/resume support.
  • Cleanroom launcher for reduced-environment execution and stronger process isolation.
  • Improved diagnostics around large parent RSS and fork cost.
  • Expanded test coverage across recovery, streaming, NUMA, output ordering, plugins, and failure paths.

Python frontend

The Python frontend has progressed from an initial compatibility layer into a full execution frontend sharing the core process-oriented design of forkrun.

Supported execution paths include:

  • mode="python" — execute Python callables in worker processes.
  • mode="spawn" — execute external/process-oriented work.
  • mode="plugin" — execute forkrun C plugins with the same high-throughput worker model.
  • mode="splice" — high-throughput streaming/splice paths for data that does not require Python-level per-record processing.

The implementation includes bounded streaming ingestion, backpressure, ordered output, unordered output, worker supervision, recovery, and NUMA-aware execution.

The Python frontend is intended to be incrementally adopted alongside the existing Bash interface rather than requiring a wholesale change in execution architecture.

Zero-copy output

output="view" provides read-only views into the mapped result storage instead of materializing every record as an independent Python bytes object.

This substantially reduces output-copying overhead for high-throughput workloads. Applications that need to retain records independently of the result mapping should materialize the records explicitly.

Because views borrow the result mapping's backing storage, retaining views can retain the underlying mapping and therefore its memory/file-backed storage.

Worker supervision and recovery

The Python execution path now includes robust worker lifecycle management:

  • worker death detection
  • worker respawn
  • in-flight batch recovery
  • escrow handling
  • trap/ACK coordination
  • recovery across multiple worker incarnations
  • bounded respawn attempts
  • supervisor handling for scanner, spill, drain, and worker failures

Worker incarnation state is propagated through the complete recovery path, preventing stale recovery state from being mistaken for a later incarnation of the same worker.

Cleanroom launcher

v3.6.1 includes an experimental cleanroom execution path.

The cleanroom launcher constructs a reduced execution environment, performs the required engine setup, supervises workers and helper processes, and provides recovery and collection without requiring the normal Python parent process to own the complete execution lifecycle.

The cleanroom path is currently opt-in and beta.

It intentionally supports a narrower API envelope than the normal Python frontend, and some advanced features remain outside that envelope. In particular, poisoned_batches reporting has limitations in the cleanroom statistics path.

The cleanroom launcher should therefore be considered an experimental execution option rather than a replacement for the normal Python frontend.

Streaming and large-input execution

The Python frontend supports true streaming operation rather than requiring the complete input to be materialized before execution.

The streaming path includes:

  • bounded ingestion
  • backpressure
  • incremental scanner operation
  • spill/ingest overlap
  • ordered and unordered output
  • recovery of in-flight work
  • bounded memory behavior suitable for inputs substantially larger than available RAM

The cleanroom path additionally provides a reduced-environment launcher suitable for workloads where isolating the execution environment from the Python parent is desirable.

NUMA

NUMA-aware execution has been extended into the Python frontend.

The design preserves forkrun's existing locality-oriented approach:

  • workers are associated with NUMA nodes
  • data is born local where possible
  • local work is preferred
  • stealing is used when necessary to maintain load balance
  • multi-node execution is supported without requiring a centralized work queue

The goal is not merely to make execution "NUMA aware", but to avoid introducing a centralized contention point into the normal execution path.

Performance

The final v3.6.1 measurements show that the Python frontend can sustain very high throughput on lightweight plugin workloads.

Representative final measurements include approximately:

  • 1.46 GB/s for large plugin workloads using zero-copy view output.
  • 1.40 GB/s for the corresponding pipe-based view path.
  • 1.02 GB/s for the corresponding materialized bytes path.
  • Multi-million-record workloads without requiring Python object materialization for the zero-copy path.
  • Compute-bound Python/UDF workloads transition naturally away from transport overhead as per-record work increases.

The exact performance depends strongly on workload, record size, output representation, input source, worker configuration, and hardware.

Reliability and testing

The release includes extensive regression coverage for:

  • worker death and respawn
  • repeated worker incarnations
  • recovery and escrow
  • ordered output
  • unordered output
  • streaming/backpressure
  • plugin execution
  • NUMA execution
  • zero-copy output
  • FD lifetime and cleanup
  • signal handling
  • helper-process failures
  • cleanroom execution
  • checkpoint/resume
  • large and jagged workloads
  • boundary conditions across worker counts and batch sizes

The recovery implementation specifically verifies that worker incarnation numbers remain consistent between the parent, worker configuration, transaction state, and recovery logic.

Build reproducibility

Normal builds record their actual build timestamp rather than substituting a fabricated fixed timestamp.

For byte-reproducible builds, the build timestamp can be supplied explicitly as a deterministic build input, allowing the resulting timestamp-dependent compiler macros and embedded version information to be reproduced exactly.

Compatibility

The existing Bash frontend and C ring backend remain supported.

The Python frontend is additive; existing Bash-based forkrun workflows do not need to migrate to Python.

Known limitations

The following are intentional limitations of this release:

  • The cleanroom launcher is experimental/beta and opt-in.
  • The cleanroom API supports a narrower feature envelope than the normal Python frontend.
  • Cleanroom poisoned_batches reporting has limitations.
  • output="view" results borrow their backing mapping; retaining views can retain the associated storage.
  • c_drain remains opt-in because its performance does not consistently exceed the default drain path.
  • As with process-based execution generally, callers should avoid invoking fork-based execution from arbitrary multithreaded parent processes. The global forkrun lock serializes forkrun's own state but cannot make arbitrary foreign threaded state fork-safe.

Upgrade

For existing Bash users, no migration is required.

Python users can begin with the high-level APIs:

import forkrun

result = forkrun.map(func, records)

and progressively select execution modes and output representations appropriate to their workload.

For high-throughput consumers, output="view" is recommended when retaining independent Python bytes objects is unnecessary.


v3.6.1 represents the first major release of the Python frontend as a production-oriented execution layer while preserving forkrun's original process-oriented, contention-free architecture.


Full Changelog: v3.6.0...v3.6.1