split-executors

command
v0.41.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Command split-executors runs one registry across two executors: a long-running worker process and a bounded, invocation-scoped burst process.

It is one program with three modes so the pieces stay side by side, but the point is that they are separate deployments sharing one database and one registry:

go run ./examples/split-executors enqueue   # produce some work
go run ./examples/split-executors worker    # the long-running pool (Ctrl+C to stop)
go run ./examples/split-executors burst     # the bounded pool, one invocation

The shape it demonstrates:

  • One Registry, built once by newRegistry and compiled into both binaries. Both processes know every kind; ExecutorClass decides who runs what.
  • The worker process runs a Node (runners + scheduler) until its context is cancelled. It claims the "worker" class.
  • The burst process builds a bare Runner claiming the "burst" class, derives a deadline that reserves a teardown margin below its own budget, and calls RunUntilIdle. That is the shape of a Lambda or a Kubernetes Job.
  • The trap: the scheduler runs on exactly one process. Two schedulers means two sweeps.

It uses a shared SQLite file so both modes run on one machine with no setup. A real split deployment uses PostgreSQL, whose SKIP LOCKED claim is what makes two pools safe at concurrency above 1.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL