Overview
Cadence is a distributed system consisting of multiple service components that work together to provide durable workflow execution. This guide covers server architecture, prerequisites, and deployment steps for production environments.Architecture
Cadence server consists of four core services:- Frontend: Handles all client-facing API requests and rate limiting
- History: Maintains workflow execution state and event histories
- Matching: Routes tasks between workflows and workers via task lists
- Worker: Performs system workflows like archival and cross-datacenter replication
Prerequisites
System Requirements
- Operating System: Linux (recommended), macOS (development)
- Go: Version 1.23+ (if building from source)
- Database: One of the following:
- Cassandra 4.x or ScyllaDB
- MySQL 8.0+
- PostgreSQL 12+
- Memory: Minimum 4GB RAM per service instance
- CPU: 2+ cores per service instance
Network Ports
Default ports used by Cadence services:| Service | TChannel Port | gRPC Port | Metrics Port | pprof Port |
|---|---|---|---|---|
| Frontend | 7933 | 7833 | 8000 | 7936 |
| History | 7934 | 7834 | 8001 | 7937 |
| Matching | 7935 | 7835 | 8002 | 7938 |
| Worker | 7939 | - | 8003 | 7940 |
External Dependencies
- Persistence: Database for storing workflow state (required)
- Ringpop: Built-in cluster membership and service discovery
- Metrics: Prometheus or StatsD (recommended)
- Visibility: ElasticSearch/OpenSearch for advanced workflow search (optional)
- Archival: S3, GCS, or file storage for workflow history archival (optional)
Installation
Using Pre-built Binaries
Install Cadence using Homebrew (macOS/Linux):cadence-server- Main server binarycadence- CLI toolcadence-sql-tool- SQL schema managementcadence-cassandra-tool- Cassandra schema management
Building from Source
.build/bin/cadence-server.
Server Deployment
Set up the database
Initialize your persistence layer. See Database Setup for detailed instructions.
Create configuration file
Create a YAML configuration file based on your environment. See Configuration for all options.
Start services
Launch Cadence services. You can run all services in a single process or separate processes.Single Process (All Services):Separate Processes:
Service Discovery and Clustering
Cadence uses Ringpop for cluster membership and service discovery:config/production.yaml
All service instances must be able to communicate with each other on their TChannel ports for cluster membership to work properly.
Production Considerations
High Availability
- Run multiple instances of each service type (minimum 3 for production)
- Use a load balancer in front of Frontend services for client requests
- Deploy across availability zones for fault tolerance
- History shards are distributed across History service instances automatically
Monitoring
Enable metrics collection for observability:config/production.yaml
- Request latency and error rates
- Workflow execution counts
- Task queue depth
- Persistence latency
- System resource usage (CPU, memory, disk I/O)
Resource Tuning
History Shards: Configure based on expected scale:Security
- TLS/mTLS: Enable encrypted communication between services and clients
- Authentication: Configure OAuth or JWT-based authentication
- Network segmentation: Restrict database access to Cadence services only
- Secret management: Use environment variables or secret managers for credentials
Logging
Configure appropriate log levels:debug level logging to reduce overhead.
Backup and Recovery
- Database backups: Regular automated backups of persistence layer
- Point-in-time recovery: Enable database PITR capabilities
- Disaster recovery: Document and test recovery procedures
- Configuration management: Version control all configuration files
Upgrading Cadence
Review release notes
Check the CHANGELOG for breaking changes and migration requirements.
Perform rolling upgrade
Upgrade services one at a time to maintain availability:
- Update Worker services first
- Update Matching services
- Update History services
- Update Frontend services last
Troubleshooting
Services Won’t Start
- Check database connectivity
- Verify configuration file syntax
- Ensure all required ports are available
- Check logs for specific error messages
Cluster Membership Issues
- Verify network connectivity between all service instances
- Check Ringpop bootstrap hosts configuration
- Ensure TChannel ports are not blocked by firewalls
Performance Issues
- Check database performance and connection pool utilization
- Monitor service metrics for bottlenecks
- Review history shard distribution across instances
- Consider scaling out services horizontally
Next Steps
Configuration
Deep dive into configuration options
Database Setup
Detailed database configuration
Docker Deployment
Deploy using Docker containers
Kubernetes
Production Kubernetes deployment