How cadence-workflow/cadence works
High-Level Architecture Components
a) Frontend Services Layer:
• Frontend API Service (handles client requests)
• Web UI Service (port 8088)
• CLI Interface
• Client SDKs (Go, Java, Python, Ruby)
b) Core Services Layer:
• History Service (workflow history management)
• Matching Service (task distribution)
• Worker Service (background processing)
• Shard Distributor Service (shard management)
c) Persistence Layer:
• Primary Database (Cassandra/MySQL/PostgreSQL)
• Visibility Store (Elasticsearch)
• Queue Store (Kafka)
Service Interactions
a) Client-Side Flow:
• Clients → Frontend Service (workflow operations)
• Web UI → Frontend Service (monitoring/management)
• CLI → Frontend Service (administrative operations)
b) Internal Service Flow:
• Frontend Service → History Service (workflow state management)
• Frontend Service → Matching Service (task routing)
• History Service → Persistence Layer (state storage)
• Matching Service → Worker Service (task distribution)
Data Flow Patterns
a) Workflow Execution:
• Client Request → Frontend → History → Persistence
• Task Distribution: History → Matching → Workers
• State Updates: Workers → History → Persistence
b) Visibility Operations:
• Search/Query Requests → Frontend → Elasticsearch
• Event Publishing: History → Kafka → Elasticsearch
Cross-Cutting Concerns
Following supporting components:
a) Operational Components:
• Metrics Collection
• Logging System
• Health Monitoring
b) Management Components:
• Domain Management
• Task List Management
• Workflow History Archival
Scalability Aspects
Scaling patterns:
a) Sharding:
• History Shard Distribution
• Task List Partitioning
• Database Sharding
b) Load Distribution:
• Service Discovery
• Load Balancing
• Worker Pool Management
Additional Elements
Supplementary details:
• Component Types (Services, Databases, Queues)
• State Transitions
b) Annotations:
• Port Numbers
• Protocol Types (gRPC, HTTP)
• Critical Paths
Deployment Boundaries
Clear separation between:
• Core Services
• Storage Systems
• External Dependencies
• Client Components
• Core Services (Rectangle)
• Queue Systems (Parallel Lines)
• Client Components (Rounded Rectangle)