Lanes, storage, and transport
See how a lane connects Runlane to storage and workers.
Runlane calls its infrastructure setup a lane. Every runtime has one lane.
A lane answers two questions:
- Where does Runlane store task state?
- How does a worker find out that work is ready?
Runlane runtime
|
v
+--------- lane ---------+
| Storage |
| - run state |
| - retries and waits |
| |
| Delivery |
| - poll storage |
| - transport wakeup |
+------------------------+The short version is:
lane = storage + deliveryDelivery is not always a transport. A worker can poll storage directly. A transport such as SQS is useful when a broker or platform needs to wake the worker.
The lanes Runlane ships
| Lane | Storage | Delivery | Best for |
|---|---|---|---|
createLocalLane() from @runlane/lane-local | Dev process memory | Poll over the loopback bridge | Development |
createTestLane() from @runlane/lane-local | Test process memory | Poll memory | Tests without dev |
@runlane/lane-postgres-polling | Postgres | Poll Postgres, with a best-effort wake signal | A small production setup with always-on workers |
@runlane/lane-postgres-sqs | Postgres | SQS wakeups | Lambda or long-running SQS consumers |
@runlane/lane-redis-polling | Redis or Valkey | Poll storage, with pub/sub hints | Direct claims on an existing Redis deployment |
@runlane/lane-redis-streams | Redis or Valkey | Redis Streams wakeups | Long-running Stream consumers |
@runlane/lane-redis-sqs | Redis or Valkey | SQS wakeups | Lambda or long-running SQS consumers |
postgresHttpLane() from @runlane/lane-postgres-http | Postgres | Signed HTTP POSTs to your app | Running tasks in your own route |
redisHttpLane() from @runlane/lane-redis-http | Redis or Valkey | Signed HTTP POSTs to your app | Running tasks in your own route |
The local lane requires runlane dev and loses its state when dev exits. The test lane releases its store when the last same-name handle closes. Postgres lanes keep run state across restarts. Redis lanes store state outside the app process; see their durability boundary. Each Redis namespace lives on one primary, including in Cluster.
Storage holds the truth
Storage keeps the current run state and the history needed to recover it. It also holds leases, schedules, durable steps, wait tokens, queue capacity, and pending delivery records.
When two workers race, storage decides which write wins. The broker does not make that decision.
Delivery wakes or finds workers
With storage polling, a worker asks storage for runnable work:
worker -- poll and claim --> storageWith a transport, the message is only a wakeup:
transport message
|
v
worker --> read storage --> run or ignoreThe message is not the only copy of the job. Duplicate, late, and stale messages are safe to pass to core because core reads the current stored run before it acts.
HTTP push wakes your app without a broker. postgresHttpLane() and redisHttpLane() pair storage with signed POSTs from @runlane/transport-http. lifetime is required. In in_request mode, which works on every supported host, the route holds the request and its maxInFlight permit until the attempt finishes. The sending request and await runlane.trigger() also wait for the attempt. Set publishTimeout above maxDuration plus settlement. Nested child publication needs more outgoing maxConcurrentPublishes slots than concurrent in-request parents, plus spare incoming and queue capacity; otherwise avoid nested triggers in these handlers. In process mode, it replies 202 after claiming the run in storage, releases the permit, and continues the task in the app process. This needs a long-lived server; serverless background execution requires a host lifetime callback such as after or waitUntil. Queue concurrency and your host's limits control how many tasks run at once. See HTTP delivery.
The transport provider owns broker details such as receipt handles, offsets, visibility timeouts, and message settlement.
Core still owns the workflow
The lane does not decide how retries, waits, cancellation, leases, or task validation work. Runlane core owns those rules. Providers supply storage and delivery mechanics.
A lane can also include optional operator reads for run lists and event history. The Local, Postgres, and Redis providers include them. Postgres and Redis update operator projections in the same atomic commit as stored records.
Know who owns each connection
Starting the runtime starts lane-owned resources. Closing the runtime closes them.
If your app passes an existing database or provider client into a lane, the app still owns that client unless the provider says otherwise.
Use choose a lane to pick a deployment. If you are adding a database or broker, start with build providers.
Named run output uses the lane's storage boundary. Postgres retains committed chunks across restarts; the local lane retains them only while runlane dev runs. Subscriptions read authoritative source positions. The optional lane.runSignal wakes a reader sooner; it never supplies state. Local hints cross the dev bridge; test-lane hints share the same named test store. Postgres lanes share one dedicated run-listener connection across their subscribers. Redis lanes share one lazy pub/sub listener for work and run hints on each storage driver. Readers keep polling as a fallback. A transport wakeup carries no stream values. See streams.