Sockudo
Deployment

Deployment guide

Choose a Sockudo production topology, configuration strategy, and rollout path.

A good Sockudo deployment starts with the failure model, not the platform logo. Decide whether one process is sufficient, which state must survive a restart, and whether a client may reconnect to a different node. Those decisions determine the adapter, cache, queue, app manager, and history backends.

Choose a topology

DeploymentGood fitRuntime backendsMain limitation
One process, memory onlyLocal development, demos, CILocal adapter, memory cache, queue, app manager, historyRestart loses process-local state; no failover.
One production VMSmall stable workload with a simple operational modelLocal adapter; static apps or a durable app manager; optional durable historyThe host is one failure domain.
Multiple nodes with RedisMost regional production workloadsRedis adapter, cache, queue, and rate limiter; shared app manager when apps change dynamicallyRedis availability and capacity become part of the realtime path.
Multiple nodes with NATSHigh fanout or high subscription churnNATS adapter, Redis cache, durable queue and app managerNATS carries fanout, but coordination and durable features still need shared stores.
Durable Protocol V2 clusterRecovery, history, mutable messages, annotations, AI TransportShared adapter and cache plus durable history and version storesMore write amplification and more dependencies to operate.
Managed/serverless container platformModerate socket counts with platform-managed rollout and scalingShared adapter and stores from the first replicaPlatform connection duration, concurrency, and node-tuning limits apply.

Memory drivers are not shared simply because several processes use identical configuration. Every multi-node deployment needs a horizontal adapter. Any feature whose correctness crosses nodes also needs its documented shared authority.

A conventional regional cluster has:

  • at least two Sockudo instances spread across failure domains
  • a load balancer that supports WebSocket upgrades and has a deliberate idle timeout
  • Redis or another supported horizontal adapter
  • a shared Redis or Redis Cluster cache for coordination, idempotency, and distributed rate limits
  • durable app storage if app records change at runtime
  • a durable queue when webhook or push work must survive a node failure
  • durable history and version storage when Protocol V2 recovery or mutable state must cross nodes
  • metrics, structured logs, readiness checks, and a tested drain path

Start with Scaling for cross-node semantics and Security for network and secret boundaries.

Configuration strategy

Use three layers with distinct responsibilities:

  1. Put stable structure in a version-controlled TOML or JSON file: enabled features, driver choices, limits, queue reliability, history retention, and per-app policy.
  2. Put environment-specific addresses and non-secret switches in deployment variables or a generated config file.
  3. Inject app secrets, database passwords, broker credentials, and provider keys from the platform's secret store.

Sockudo does not treat environment variables as a complete alternative syntax for every nested configuration field. Complex policy and multi-app definitions belong in a file or persistent app manager. See Static configuration for exact precedence and equivalent TOML and JSON examples.

Workload questions to answer first

Document these inputs before choosing instance sizes:

InputWhy it matters
Peak concurrent sockets and reconnect surgeSets file descriptor, memory, load-balancer, and admission budgets.
Messages per second and average payloadSets CPU, network, adapter, and serialization load.
Subscribers per publishDistinguishes ingest throughput from fanout throughput.
Public, private, and presence mixAdds authentication, membership, and transition work.
Subscription churnCan dominate otherwise quiet chat or room workloads.
Protocol V1 or V2 featuresRecovery, deltas, filtering, history, and mutations change state and compute costs.
Retention and recovery objectivesSelects memory buffers versus durable stores.
Client geographyChanges handshake time, RTT, reconnect behavior, and apparent benchmark throughput.

Rollout sequence

  1. Build or pin one exact Sockudo image or binary version and required Cargo features.
  2. Validate the resolved config in staging, including startup logs and /up/<app-id>.
  3. Load test from realistic client regions and confirm the generators are not saturated.
  4. Set a per-node SOCKUDO_MAX_CONNECTIONS below the measured safe ceiling.
  5. Deploy at minimum capacity before enabling autoscaling.
  6. Remove a node while traffic is active and verify reconnect and recovery behavior.
  7. Fail or pause each shared dependency and verify readiness, alerts, and backpressure.
  8. Roll in small batches while watching connection churn, adapter errors, and recovery failures.

Production gate

Do not call a deployment ready until all of these are true:

  • /live is used for liveness and startup checks
  • /up or /up/<app-id> is used for readiness
  • the load balancer idle timeout and Sockudo heartbeat behavior have been tested together
  • file descriptor limits have been checked in the actual process or container
  • credentials are absent from images, ConfigMaps, command lines, and logs
  • every replica has a stable, unique INSTANCE_PROCESS_ID
  • multi-node drivers and feature flags pass Sockudo startup validation
  • termination grace exceeds Sockudo's shutdown grace period
  • load testing includes connect, steady-state, fanout, churn, and reconnect phases
  • dashboards distinguish a Sockudo bottleneck from the load generator, load balancer, NAT, or broker

Continue with Static configuration, then select the platform-specific guide.

On this page