Cluster Mode
A single Swift process uses one CPU core efficiently. To use all available cores, Prism can spawn multiple worker processes — each running its own copy of the server.PrismClusterManager handles spawning, monitoring, and restarting workers.
Quick Start
Multi-Process Server
Cluster Configuration
Configuration Options
Detecting Primary vs Worker
Process Role Detection
PRISM_WORKER=true and PRISM_WORKER_ID=N in the environment of each child process.
Managing Workers
Worker Management
Worker Status
Auto-Restart
WhenrestartOnCrash is enabled, the manager monitors workers every second. If a worker exits with a non-zero status, it’s automatically replaced:
Practical Example
Production Cluster
All workers share the same port. On macOS, Network.framework handles port sharing via SO_REUSEPORT. Each incoming connection is distributed to one worker.