Latch Overview

Solenoid Latch is a distributed locking API that provides mutual exclusion for serverless and edge workloads without running Redis, DynamoDB, or any infrastructure.

Lock requests queue in FIFO order. HTTP connections hang until the lock is available — no polling loops, no retry storms. Locks auto-release via dead-man’s-switch TTL alarms when clients crash or disconnect.

Capabilities

  • FIFO fairness — locks granted in strict arrival order, preventing starvation
  • Hanging requests — no polling loops; your request completes when the lock is freed
  • Dead-man’s-switch auto-release — TTL alarms free locks from crashed clients automatically
  • Reentrant locking — re-acquire with the same token to refresh TTL without self-blocking
  • Abort signal cleanup — client disconnects remove waiters from the queue immediately
  • Configurable TTL and timeout — up to 15 minutes (900,000ms) each
  • Queue depth limits — max 100 waiters per lock key to prevent resource exhaustion

Lock Semantics

  • Default TTL: 10 seconds. Maximum: 15 minutes.
  • Default timeout: 10 seconds. Maximum: 15 minutes.
  • Max queue depth: 100 waiters per key. The 101st receives a 429 response.

Key Format

Lock keys support alphanumeric characters, dashes, underscores, and colons. Use colons for namespacing:

  • deploy:prod — production deployments
  • user:123:checkout — user-specific operations
  • migration:v2 — database migrations

Use Cases

  • Deploy coordination — ensure only one deployment runs at a time
  • Resource throttling — limit concurrent access to expensive external APIs
  • Job deduplication — prevent duplicate webhook processing; first request wins
  • Critical section protection — serialize writes to shared state across serverless functions

Billing

Each acquire and release costs 1 credit from your shared pool. Status checks are free.

See Pricing for tier details.

Next Steps