Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework

CK CK 3788 
Created at  
286 0 0

Cadence is a distributed, fault-tolerant, stateful workflow orchestration framework and programming model designed to build highly reliable and long-running applications. It allows developers to write complex business logic as simple sequential code, abstracting away the complexities of distributed systems like retries, timeouts, failures, and state persistence.

 

Why Was It Created?

Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework

Cadence was developed to address the significant challenges of building and maintaining reliable, long-running, and stateful applications in a distributed environment:

  • Complexity of Distributed Systems: Traditional distributed applications require developers to manually handle complexities such as retries, timeouts, error handling, sagas (distributed transactions), compensation logic, state persistence, and communication failures. This leads to complex, error-prone, and hard-to-maintain code.
  • Durability and Fault Tolerance: Ensuring that a business process, which might span minutes, hours, or even days, can survive arbitrary failures (worker crashes, server restarts, network partitions) and resume from its last known state without losing progress.
  • State Management: Maintaining the correct and consistent state of a long-running process across multiple microservices and external systems is notoriously difficult.
  • Observability and Debugging: Tracking the exact progress of a complex, asynchronous distributed workflow and debugging failures across services is often a significant hurdle.

Cadence aims to provide a programming model that abstracts these distributed system challenges, allowing developers to focus purely on the business logic, making applications more robust, easier to develop, and simpler to debug.

 

I understand that you meticulously record the working state... But how does this guarantee durability?

The core principle of how meticulously storing the working state (record) through Event Sourcing leads to Durability is 'Replay'.
If a Worker or server completely crashes and comes back to life (or another healthy Worker takes over the task), Cadence recovers without losing even a single millisecond of progress (Durable) in the following way:

Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework

Cadence doesn't remember the state itself, but rather meticulously records the "history of past actions" in a permanent storage device (DB) in an indelible manner. Thanks to this, no matter when any server crashes, another server can replay that history from the beginning at lightning speed to restore the state exactly as it was at the moment it stopped. This is the secret to the Durability guaranteed by Cadence.

 

 

Who Created It?

Cadence was initially developed and open-sourced by Uber Technologies. It was an internal project designed to power Uber's critical business workflows, such as ride dispatch, payments, and data processing pipelines, which demand extreme reliability and fault tolerance.

A significant portion of the original Cadence team, including its lead developers, later left Uber to form Temporal Technologies. They developed Temporal, which is a spiritual successor and an advanced evolution of Cadence, offering enhanced features and performance. While Cadence is still maintained by Uber, Temporal has become the cutting-edge iteration of these concepts.

 

History

  • Origin at Uber (Mid-2010s): Development of Cadence began internally at Uber around 2015-2016 to address the growing need for a reliable workflow engine to manage their complex and mission-critical operations.
  • Open-Sourcing (Late 2017 / Early 2018): Uber open-sourced Cadence, making it available to the broader developer community. This allowed other companies to leverage its powerful orchestration capabilities.
  • Community Adoption: Cadence gained adoption beyond Uber, with various companies using it for their distributed workflow needs.
  • Evolution to Temporal (2019 onwards): The core team behind Cadence, seeing the potential for further innovation and dedicated development, departed Uber to found Temporal Technologies. They developed Temporal, building upon the foundational concepts of Cadence but with significant architectural improvements, new features, and a dedicated commercial entity for support and development. Cadence continues to be maintained by Uber as an open-source project.

 

Architectural Features

Cadence's architecture ensures durable, fault-tolerant, and scalable workflow execution by defining "Workflow as Code" in standard programming languages, allowing developers to build complex logic with familiar constructs. Durable execution is guaranteed through event sourcing, recording all workflow steps as an immutable history, enabling state maintenance and seamless resumption from failure on any worker. Fault tolerance is further enhanced by automatic retries, configurable timeouts, and support for compensation logic in distributed transactions. This system is highly scalable, managing millions of concurrent workflows, and provides extensive visibility, debugging, and replay capabilities. Architecturally, Cadence separates the central Cadence Server, responsible for managing state, scheduling tasks, and ensuring fault tolerance, from Cadence Workers, which host and execute the actual workflow and activity logic by polling named Task Lists.

Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework

 

 

Limitations and Constraints

While powerful, Cadence comes with several considerations, including operational complexity due to managing multiple backend dependencies at scale, a notable learning curve for developers adapting to durable execution and strictly deterministic workflow code, and the crucial requirement that workflow logic must always be deterministic, with non-deterministic operations carefully encapsulated within Activities. Practical limits on workflow state size necessitate passing large data payloads by reference rather than directly embedding them, and storing the full event history for long-running or high-frequency workflows can consume significant persistence layer resources. Furthermore, as an open-source project primarily maintained by Uber, its ecosystem and evolution may differ from its successor, Temporal, leading many users to evaluate both platforms.

Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework

 

 

AWS Managed Services for Cadence's Programming Model

While AWS does not offer a direct "Managed Cadence Service," the core programming model of Cadence—orchestrating long-running, fault-tolerant distributed workflows—is well-supported and even superseded by native AWS managed services.

  • AWS Step Functions is the primary AWS managed service that aligns most closely with Cadion's programming model. It provides a serverless workflow engine that allows you to define workflows as state machines, orchestrate various AWS services and custom code, and inherently handles retries, parallel execution, error handling, and long-running processes, similar to Cadence. It offers a fully managed, high-availability, and scalable solution without requiring you to manage any underlying infrastructure for the workflow engine itself.
  • AWS Simple Workflow Service (SWF) is an older, fully managed workflow service that predates Step Functions. Cadence itself was inspired by SWF's core concepts but significantly evolved beyond it. While still available, Step Functions is generally recommended for new workflow implementations due to its flexibility, broader integrations, and serverless nature.
  • Deploying Cadence on AWS Managed Infrastructure: Alternatively, you can deploy and run the Cadence server components yourself on AWS's robust managed infrastructure services (e.g., Amazon EKS, Amazon ECS/Fargate for compute; Amazon Aurora, Amazon DynamoDB for persistence). In this scenario, AWS manages the underlying infrastructure, but you retain responsibility for managing the Cadence cluster itself.

 

 

Available Components for Workflow Orchestration on AWS

When leveraging AWS managed services to implement a Cadence-like programming model, a wide array of components are available:

  • Workflow Orchestration Engine
    • AWS Step Functions: Serverless state machine-based workflow orchestration for complex, long-running processes.
    • AWS Simple Workflow Service (SWF): Managed service for coordinating tasks in a workflow.
  • Compute Services (for Activity/Task Execution)
    • AWS Lambda: Serverless compute for running short-lived, event-driven functions (common for Step Functions "tasks").
    • Amazon ECS (Elastic Container Service) / AWS Fargate: Managed container orchestration for running containerized tasks, workers, or microservices invoked by workflows. Fargate eliminates server management.
    • Amazon EKS (Elastic Kubernetes Service): Managed Kubernetes service for deploying containerized applications and workers.
    • Amazon EC2 (Elastic Compute Cloud): Virtual machines for running custom workers or legacy applications.
  • Data Persistence & Storage
    • Amazon DynamoDB: Fully managed, highly scalable NoSQL database often used for storing workflow state, event history, or activity results.
    • Amazon Aurora (PostgreSQL/MySQL Compatible): High-performance, scalable relational database service, suitable for relational data associated with workflows or for Cadence's visibility store if self-hosting.
    • Amazon S3 (Simple Storage Service): Object storage for large artifacts, archived workflow data, or inputs/outputs of workflow steps.
  • Messaging and Eventing
    • Amazon SQS (Simple Queue Service): Fully managed message queuing service for decoupling microservices, buffering tasks, or triggering workflow steps.
    • Amazon SNS (Simple Notification Service): Pub/sub messaging service for fan-out messaging or notifying services about workflow events.
    • Amazon EventBridge: Serverless event bus that simplifies building event-driven architectures, useful for triggering workflows based on events from AWS services or custom applications.
  • Monitoring and Logging
    • Amazon CloudWatch: For collecting logs, metrics, and setting alarms for workflow execution, compute services, and databases.
    • AWS X-Ray: For tracing requests as they flow through distributed applications, providing visibility into workflow execution paths and performance.
  • Integration and API Gateway
    • Amazon API Gateway: For creating, publishing, maintaining, monitoring, and securing APIs to trigger workflows or interact with workflow-related services.
  • Security and Networking
    • AWS Identity and Access Management (IAM): For managing access to AWS resources and services used by workflows.
    • Amazon VPC (Virtual Private Cloud): For logically isolated network environments for resources.

 

 

Possible Architecture 1. Native AWS Step Functions Architecture (Managed Workflow Orchestration)

This architecture leverages AWS Step Functions as the primary managed service for orchestrating workflows, mirroring Cadence's capabilities with a serverless, managed approach.

Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework

Description:

  • Triggers: Workflows can be initiated by various events: HTTP requests via Amazon API Gateway, events from other AWS services or custom applications through Amazon EventBridge, or messages arriving in an Amazon SQS queue.
  • Workflow Engine: AWS Step Functions acts as the central orchestrator. A State Machine defines the complete workflow logic, including sequence, parallel steps, branching, error handling, retries, and timeouts. It manages the state and progress of each workflow execution.
  • Tasks/Activities: Each step in the Step Functions state machine can invoke:
    • AWS Lambda Functions for serverless execution of short-lived business logic.
    • Amazon ECS or AWS Fargate tasks for containerized applications, batch jobs, or longer-running processes.
    • Directly integrate with over 200 other AWS Services (e.g., SQS, SNS, DynamoDB, S3, SageMaker, Glue) to perform actions without writing intermediary code.
    • Callback Tasks for integrating with external services that complete asynchronously.
  • Data Persistence: Workflow data, activity results, or application state can be stored in Amazon DynamoDB (for high-performance NoSQL needs), Amazon S3 (for large objects or archives), or Amazon Aurora (for relational data). Step Functions automatically persists workflow state.
  • Monitoring & Logging: Amazon CloudWatch collects logs from Lambda functions, ECS/Fargate tasks, and Step Functions execution. AWS X-Ray provides distributed tracing to visualize the entire workflow execution path and identify performance bottlenecks.
  • Alerting: Amazon SNS can send notifications based on CloudWatch alarms for workflow failures or performance issues.

 

 

Possible Architecture 2. Self-Managed Cadence on AWS Managed Infrastructure

This architecture involves deploying the open-source Cadence server components on AWS, utilizing managed services for the underlying infrastructure, persistence, and scaling.

Cadence Programming Model - A Distributed, Fault-Tolerant, Stateful Workflow Orchestration Framework

Description:

  • Cadence Server Deployment: The Cadence services (Frontend, History, Matching, Worker) are deployed as containerized applications on Amazon EKS (Elastic Kubernetes Service) or Amazon ECS/Fargate. These managed container services handle the underlying compute and orchestration, abstracting away server management.
  • Load Balancing & API Gateway: Client applications interact with the Cadence cluster via an AWS Application Load Balancer (ALB), optionally fronted by Amazon API Gateway for API management and security.
  • Persistence:
    • Event History: Amazon DynamoDB is a common choice for storing the core event history due to its high scalability and low latency.
    • Visibility Store: Amazon Aurora (PostgreSQL/MySQL compatible) is typically used for Cadence's visibility store, which allows querying workflow executions.
  • Task Queues: Cadence relies on persistent task queues. These can be implemented using Apache Kafka deployed on Amazon MSK (Managed Streaming for Kafka) for a fully managed solution, or via a combination of SQS and DynamoDB for internal queueing.
  • Cadence Workers: Your custom business logic (activities and workflows) are run by Cadence worker processes. These workers are also deployed on Amazon ECS/Fargate or Amazon EKS. For specific short-lived activities, AWS Lambda functions can also be integrated to act as Cadence activities.
  • Monitoring & Logging: Standard AWS services like Amazon CloudWatch for logs and metrics, and potentially AWS X-Ray or open-source tools like Prometheus/Grafana (on EKS) for deeper observability.

This second approach provides more control over the Cadence deployment itself but requires managing the Cadence cluster configuration, upgrades, and scaling, even while leveraging managed AWS infrastructure.

 

We may able to use Flink

Incorporating Apache Flink into the architecture is technically entirely feasible, and it becomes a very powerful architecture, especially in domains requiring real-time large-scale stream processing or Complex Event Processing (CEP).

However, rather than simply 'replacing' an existing queue system (Amazon SQS) with Flink, it is correct architectural guidance to deploy them in 'complementary roles' because the two technologies serve different purposes.

Deploying Flink instead of SQS goes beyond simple message delivery, becoming an excellent choice when you need an "intelligent filter that analyzes, refines, and makes decisions on large-scale real-time stream data at the stage before a workflow begins."

 

Tags AWS Cadence AWS Managed Service CEP Cadence Cadence Architecture Cadence Components Cadence Programming Model Cloud Workflow Complex Event Processing Distributed Workflows Managed Workflow Serverless Workflow Workflow Workflow Orchestration 쇼핑몰 케이던스 Facebook X
Comments 0
Similar posts
  1. Optimize the performance of a search results page that experiences high traffic
    139
  2. Temporal Programming Model - Robust, Long-Running, Fault-Tolerant Applications as WorkFlows
    349
  3. System Design: High-Traffic Time-Deal Promotion System
    171
  4. Designing Resilient Infrastructure to Prevent Order Data Loss During Kafka Failures
    151
  5. Real-Time Inventory & WMS System Design
    240
  6. Enterprise-Scale 100k+ TPS Order Tracking System Architecture
    198
  7. Enterprise-Scale 100k+ TPS Order Processing System Architecture
    174
  8. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  1. Building Privacy-First Infrastructure: Network Isolation + Zero Trust for GDPR Compliance
    289
  2. Why supabase is not safe for the Fintech project?
    854
  3. The Ultimate Data Engineering Roadmap
    1,069
  4. Nine Types of Testing while we develop APIs
    511
  5. Apache Kafka - a distributed, fault-tolerant, high-throughput streaming platform
    613
  6. Comprehensive Software Development Flow : How Companies Ship Code To Production
    2,309
  7. DeepSeek v3 offers of ChatGPT's performance at 1/10 the price!
    633
  8. Difference between CPU and GPU - Why GPU is faster than CPU?
    802
  9. gRPC - Open-source Universal RPC Framework developed by Google
    766
  10. Exploring the Depths of Data Transfer: sendfile vs. kTLS
    1,317
  11. How Netflix Ensures Smooth Streaming with Open Connect CDN
    2,127
  12. Public DNS (Domain Name Service) based on IPv4, IPv6 widely used
    1,240
  13. All Engineering Software Development How can you prioritize software design trade-offs when developing a new product?
    1,339
  14. MR(Mixed Reality) Game Programming based on Unity 3D
    1,353
  15. Temporal Programming Model - Robust, Long-Running, Fault-Tolerant Applications as WorkFlows
    349
  16. Multi-AZ Kafka Architecture
    141
  17. Large-Scale Concurrency Control: Solving the DB Bottleneck from a Flood of “Likes”
    269
  18. Hybrid Methods for Recommendation Service
    213
  19. Model-Based CF: Matrix Factorization for Recommendation Service
    177
  20. Memory-Based Collaborative Filtering for Recommendation Service
    186
  21. Content-Based Filtering for Recommendation Service (aka User-based Model)
    187
  22. Stateful Databases: A Deep Dive with Cassandra & TiDB
    186
  23. Why Kubernetes? Core Features and Microservice Orchestration Strategies
    569
  24. Quiz : Twice counter
    700
  25. Kubernetes, aka K8s, is an open-source container orchestration platform
    539
  26. Architecting for Resilience: AWS High Availability Components Including API Gateway
    133
  27. Is AWS API Gateway Disaster-Proof? DR, Benefits, and Multi-AZ Architecture Explained
    140
  28. FNC(Photo/Video File Name Changer) v1.1 Release - Date Time Bug Fix & Retry Function Added
    703
  29. Smart TV Cycling Apps – TV for Fitness
    807
  30. The public could reduce server cost, and enhance performance for global service distribution
    10,740
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,730
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    86
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    198
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    234
  17. The Concept of Scaffolding in AI Agents
    222
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    253
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    328
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252