Skip to Content
Runlane
Reference

Redis options

Look up Redis and Valkey connections, storage, polling, Streams, and startup behavior.

These options apply to the Redis storage and delivery packages. For setup steps, see Redis polling, Redis Streams, and Redis and SQS.

Supported topologies

Standalone, Sentinel, and Cluster require Redis >=7.0 or Valkey >=7.2. Startup rejects an exposed older version; hidden or missing version information produces a warning and continues. Redis 7.0 supplies Lua ACL checks and the three-part XAUTOCLAIM reply. Valkey 7.2 starts from the compatible Redis 7.2 protocol. The live suites cover Redis 8.4.0 and Valkey 9.0.0 with node-redis 6.3.1, including authenticated TLS topologies.

Every namespace lives on one primary. In Cluster, all keys in a namespace share one hash slot and use database 0. More nodes do not increase one namespace's memory or execution capacity. Use separate namespaces and lanes for independent workloads that should use different slots. Multiple namespaces can still land on the same primary.

Connection options

Supply exactly one connection form. Polling lanes and storage take it at the top level; Streams transport takes it in connection.

FormRequired fieldsBehavior
Standaloneurl: stringA redis:// or rediss:// primary URL.
Clusternodes: { host: string; port: number }[]Nonempty seed list; discovers and reads primaries.
Sentinelsentinels: { host: string; port: number }[], primaryName: stringNonempty Sentinel seed list and the monitored primary name.
Borrowed clientclientAn already connected standalone node-redis RESP2 client; remains application-owned.

Owned connection forms accept username?, password?, and tls?. TLS accepts optional PEM ca (a string or string array), cert, key, and servername. Supply tls: {} to enable TLS without a custom certificate. Data credentials and TLS apply to discovered Cluster and Sentinel data nodes.

Cluster and Sentinel also accept nodeAddressMap?: Record<string, { host: string; port: number }> to map announced host:port addresses to reachable addresses. Sentinel accepts separate sentinelUsername?, sentinelPassword?, and sentinelTls? for its control connections. These do not replace data-node credentials.

For example, these lane configurations select Cluster and Sentinel:

import { redisPollingLane } from '@runlane/lane-redis-polling'

export const clusterLane = redisPollingLane({
  nodes: [{ host: 'redis.internal', port: 6379 }],
  namespace: 'billing-jobs',
  tls: {},
})

export const sentinelLane = redisPollingLane({
  sentinels: [{ host: 'sentinel.internal', port: 26379 }],
  primaryName: 'jobs',
  namespace: 'billing-jobs',
})

Borrowed clients must use RESP2, primary reads, no automatic key prefix, and no client-side cache. Offline queuing may remain enabled. The application connects and closes the borrowed client. Runlane closes its own worker and hint duplicates.

Owned command clients disable offline queuing and automatic socket reconnect. Sentinel command resends are disabled. A later storage or publisher operation can open a fresh connection after a failure; it never resends the uncertain request or replays its callback. A failed long-running worker must be restarted by its owner or supervisor.

Storage options

RedisStorageDriverOptions and createRedisStorageDriver() come from @runlane/redis-storage. Add these fields to one connection form:

FieldDefaultMeaning
namespaceRequired1–1,024 well-formed UTF-16 code units. Owns isolation and the Cluster hash tag.
clusterRetry{ maxRetries: 15, backoff: { type: RetryBackoffType.Exponential, delay: '1ms', maxDelay: '250ms' } }Shared RetryPolicy for definite pre-execution Cluster TRYAGAIN replies. Socket loss never authorizes replay.
maxTransactionAttempts16Positive safe integer; bounds callback replay after a definite conflict.
runHintscontractDefaults.realtime.runHintsPublish run-progress hints and enable driver.runSignal waits.
workHintscontractDefaults.delivery.workHintsPublish work hints and enable the worker subscription. Set false to remove both.
startupTimeout'2m'Initializer startup deadline shared by connection, diagnostics, namespace scan, capacity admission, and marker publication. Waiters may add one recovery lease; see startup checks.
startupChecks.persistencefalseWarn at startup when persistence looks disabled or cannot be checked. See startup checks.
telemetryOmittedProject telemetry, including the logger for structured startup diagnostics.

The logical transaction budgets are contractDefaults.storage.minTransactionRecords and minTransactionBytes; record size uses maxRecordBytes. The prepared physical request budget is 256 MiB, derived from those shared floors. A mutating transaction's record budget includes its read dependencies. There is no limits override. See storage capacity floors.

Polling lane options

Import redisPollingLane and RedisPollingLaneOptions from @runlane/lane-redis-polling. Options are flat storage options plus the polling settings below. Both hint options use the same defaults as the raw driver.

FieldDefaultMeaning
name'redis-polling'Nonempty lane name.
runHintscontractDefaults.realtime.runHintsEnable run-progress hints. Independent of worker work hints.
workHintscontractDefaults.delivery.workHintsEnable work publications and the worker subscription. Set false to use local wakes and polling.
emptyPollDelaycontractDefaults.delivery.storagePollingEmptyPollDelayPositive duration string for the first empty scan. Later waits use the shared polling backoff.

The returned lane supplies storage, operator reads, polling delivery, and optional work and run hints. Hints only lower latency. Polling with idle backoff guarantees progress while storage and worker capacity are available. Delays, retries, schedules, and lease expiry become ready through polling and maintenance, never hints.

Set workHints: false when workers cannot keep a pub/sub connection. Same-runtime commits still wake idle workers in process; work from other runtimes waits for polling. Set runHints: false as well to avoid the separate run-progress subscription.

Streams lane options

Import redisStreamsLane and RedisStreamsLaneOptions from @runlane/lane-redis-streams.

FieldDefaultMeaning
redisRequiredStorage connection and namespace options, excluding runHints and workHints.
transportRequiredStreams transport options below; connection defaults to the storage endpoint. clusterRetry inherits redis.clusterRetry unless explicitly supplied in transport.
name'redis-streams'Nonempty lane name.
runHintscontractDefaults.realtime.runHintsEnable storage run-progress hints. Independent of Streams delivery.

Streams delivers work. The lane forces storage workHints: false and rejects a supplied workHints option at either level. Set runHints only at the top level.

The transport namespace and queue catalog remain explicit even when the endpoint is shared. The returned lane supplies operator reads and a long-running worker surface. It has no native serverless delivery handler.

SQS lane options

Import redisSqsLane and RedisSqsLaneOptions from @runlane/lane-redis-sqs. It mirrors the Postgres SQS lane with a Redis provider envelope.

FieldDefaultMeaning
redisRequiredRedis storage options, excluding runHints and workHints. Accepts all four connection forms.
sqsRequiredSqsTransportOptions from @runlane/transport-sqs, including the client and queue bindings.
name'redis-sqs'Nonempty lane name.
runHintscontractDefaults.realtime.runHintsEnable run-progress hints. Set false for serverless consumers.

SQS delivers work. The lane forces storage workHints: false and rejects a supplied workHints option at either level. Set runHints only at the top level.

Provider factories own nested validation and defaults. The lane exposes operator reads and the native SqsLambdaHandler through createDeliveryHandler(), plus long-running SQS workers. It has no storage-polling work signal. See Redis and SQS for setup and SQS polling options for receive settings. Supplied Redis and SQS clients remain app-owned.

Streams transport options

Import createRedisDeliveryProvider, RedisTransportOptions, RedisDeliveryProvider, and RedisDeliveryFailure from @runlane/transport-redis. The factory returns publisher, queues, and surface.createWorker for createLane() composition.

FieldDefaultMeaning
connectionRequiredOne connection form above.
clusterRetrySame shared RetryPolicy default as storage aboveDefinite pre-execution Cluster TRYAGAIN retries for initialization, publication, worker acquisition, receipt renewal, and settlement. Socket failures never authorize resend.
namespaceRequired1–1,024 well-formed UTF-16 code units; scopes the transport Streams.
queuesRequiredOne or more queue definitions with unique names; no fixed queue-count cap.
maxBacklog10000Positive safe integer; unread plus pending entries allowed per queue.
visibilityTimeoutMs30000Integer milliseconds, 100–86,400,000. Active receipts renew; expired receipts can be reclaimed.
blockMs100Integer milliseconds, 1–1,000, for the single-queue blocking read or the multi-queue idle-check interval.
telemetryOmittedProject telemetry for delivery failures.
onDeliveryFailureOmittedAwaited observer of { failure, queue, providerMessageId } before a rejected entry is settled. Also observes retry failures.

Without an observer, failures use project telemetry. A rejected observer stops the worker and leaves its receipt pending. Handled and successfully reported Reject outcomes acknowledge and delete together; Retry leaves the receipt pending. The provider supplies its native pending-entry delivery count to core at no extra read cost. Core requests a fast claim retry only on delivery 1. When core supplies retryAfterMs within the visibility interval, fenced settlement adjusts its idle time to become eligible after that delay. Pickup still follows the existing bounded reclaim scans. Other retries keep the visibility-timeout backoff. A failed Redis command during settlement, including this adjustment, stops the worker with a structured error. The receipt stays pending until a reclaim scan picks it up.

Workers use the shared CreateProviderWorkerOptions: deliver, maxInFlight?, queues?, signal?, and shutdownGrace?. Direct workers default maxInFlight to their selected queue count. Core supplies its normalized worker concurrency.

Queue count increases stream memory, startup work, and readiness scan cost. All streams in a namespace share one Cluster slot; use separate namespaces to spread load across primaries.

With multiple selected queues, workers first check for existing unread entries without claiming messages. They then read only enough ready streams to fit free capacity, capped at 64 entries per read. Queue order rotates, and fresh and pending work alternate first use of capacity. A busy worker leaves other messages available for its peers. When no work is found across multiple queues, blockMs sets the delay before the next check; shutdown interrupts this delay. With one selected queue, a dedicated connection blocks in XREADGROUP for up to blockMs and wakes as soon as work arrives. Settlement and visibility renewal use a separate connection. Close observes any outstanding read and drains its receipts through shutdown grace.

Reclaim passes use bounded cursor pages and start again after half a visibility interval. Close stops acquisition and drains acquired deliveries through shutdown grace.

The transport accepts up to 100 messages per publish call. Each body is bounded by contractDefaults.delivery.maxEnvelopeBytes. Body plus JSON identity is also capped at 1 MiB per entry. A batch sends separate bounded requests, not one combined command. See the Streams profile.

Startup checks

start() and the first storage operation share startup. Every connection initialization checks the marker, scripting and command permissions, primary routing, and TIME. Diagnostics read INFO when available. Runlane never changes server settings and does not require CONFIG. With startupChecks: { persistence: true }, it may use read-only CONFIG GET save to clarify a persistence diagnostic.

ObservationResult
Reported allkeys-* eviction policyFail with configuration_invalid: eviction could discard authoritative records. Use noeviction.
Reported replica roleFail with configuration_invalid: use a primary endpoint.
Missing scripting or required command permissionsFail with configuration_invalid.
Incompatible marker or unrecognized nonempty namespaceFail with configuration_invalid; existing data is not converted.
First-initialization request envelope refusedFail startup; the namespace does not receive an accepted marker.
Hidden INFOEmit an info_hidden startup warning through the configured project logger and continue.
AOF and RDB snapshots disabled, with startupChecks.persistence enabledEmit a persistence_disabled warning and continue.
AOF disabled and CONFIG blocked, with startupChecks.persistence enabledEmit a persistence_unverified warning and continue. Managed services such as ElastiCache block CONFIG.
Network or service unavailableReturn a structured provider error with the original cause kept internal.

Only the first namespace initializer sends a capacity-admission request. One synthetic script call covers the real floor envelopes' request bytes, key and argument counts, and largest argument. With a 36-code-unit namespace it sends about 28.9 MB, without building full record replacements in memory. Existing namespaces and reconnects skip this request. This checks that namespace once; it does not continually certify server or proxy settings.

startupTimeout defaults to two minutes for namespace initialization. Each connection handshake uses the existing per-command timeout (5 seconds), capped by the remaining startup budget. Before the first successful start, failed handshakes retry within that budget using clusterRetry.backoff. A later reconnect fails after one handshake so the next operation can retry. Connection setup, diagnostics, scanning, admission, and marker publication consume the same remaining time. A later phase does not restart the budget. Existing namespaces skip the large capacity probe.

A process that observes another process's initialization reservation may wait up to startupTimeout plus one recovery allowance. That allowance is one quarter of startupTimeout (30 seconds by default). This gives a crashed initializer's reservation time to expire before a successor completes setup. Repeated observations do not extend the allowance again. Reservations renew every third of their lease (10 seconds by default), so a live initializer retains ownership. Set a longer startupTimeout for slower links or larger namespaces; the recovery allowance grows with it.

Runlane observes phase deadlines itself because node-redis command options do not bound a response already in flight. An expired phase deadline raises non-retryable configuration_invalid naming the phase. A stalled owned connection is destroyed and reported as a structured storage error. A server or proxy that refuses an oversized request often closes the connection or never replies, so failure to complete capacity admission also raises configuration_invalid. After a network interruption, start again.

Canonical keys have no expiry. volatile-* policies cannot evict those keys, but use noeviction for the deployment. See Redis eviction policies. The storage durability boundary applies independently of startup warnings.

Streams startup creates one fixed consumer group per queue, beginning at the existing Stream's start. It rejects a wrong key type or foreign consumer group. Worker creation checks acquisition, pending-entry, claim, acknowledgment, deletion, and consumer-cleanup permissions on each selected queue before processing any entry. Producer checks remain separate. Producers and consumers must use the same transport namespace and queue bindings.

Deployment requirements

Use a Redis-protocol primary endpoint with Lua scripting. Storage requires hash and sorted-set commands; hints require pub/sub; Streams delivery requires Streams, consumer-group, pending-entry, claim and settlement commands. Discovered Cluster and Sentinel data nodes must be reachable with the configured TLS and credentials. REST endpoints cannot replace Redis TCP connections.

Use an eviction policy other than allkeys-*; noeviction keeps authoritative records safe. The endpoint's request-size limit must fit the first namespace setup, including its capacity-admission requests. Check these limits on the deployed endpoint, including any proxy between the client and server.

Shared connection subpath

@runlane/redis-storage/connection is shared by Runlane Redis storage, transport, and lanes. It exports the schema input RedisConnectionOptions, parsed output RedisConnectionConfig, borrowed standalone client type RedisStorageClient, redisConnectionOptionsSchema, the schema-produced RedisConnectionKind, RedisCommandClient, createRedisConnection, connectRedisConnection, duplicateRedisConnection, and executeRedisScript, redisClusterRetrySchema, redisCommandTimeoutMs, and redisNamespaceSchema. createRedisConnection() sets native socket setup time, and connectRedisConnection() bounds the complete owned handshake. Both accept optional millisecond timeouts, defaulting to five seconds. duplicateRedisConnection() can override standalone socket setup time; Cluster and Sentinel duplicates inherit their source settings. Storage bounds every owned connection with its remaining startup budget. Stalled owned handshakes destroy their sockets, and provider boundaries map internal causes to structured errors.

executeRedisScript(client, source, keys, args, signal, policy) requires an explicit resolved retry policy. Use redisClusterRetrySchema.parse(input) to validate a RetryPolicy, or .parse(undefined) to select the shared default. Pass undefined for signal when no abort signal applies. The helper has no implicit retry policy.

The schema accepts the untagged connection forms above and produces the topology tag used by the native constructor. Construction performs no connection I/O; callers connect and close owned clients. Duplicates remain caller-owned. Script execution caches identities, handles definite script-cache misses and bounded pre-execution routing errors, and never authorizes an ambiguous resend. Application setup normally uses the driver or lane factories instead.

startupTimeout and clusterRetry.backoff durations must fit the Node timer platform limit of 2,147,483,647 ms.

On this page