Skip to content

Commit 6b3e564

Browse files
authored
Merge branch 'master' into snyk-fix-a79ab57c645b84ef744dec317057b3c1
2 parents e195db1 + 12d38f8 commit 6b3e564

16 files changed

+939
-594
lines changed

NOTICE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Copyright (c) 2025 Uber Technologies, Inc.
1+
Copyright (c) Cadence a Series of LF Projects, LLC.
2+
For website terms of use, trademark policy and other project policies please see lfprojects.org/policies/.
23

34
Permission is hereby granted, free of charge, to any person obtaining a copy
45
of this software and associated documentation files (the "Software"), to deal
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
---
2+
title: "Introducing Batch Future with Concurrency Control"
3+
description: "We're excited to announce Batch Future, a new feature in the Cadence Go client that provides controlled concurrency for bulk operations, preventing overwhelming downstream services while maintaining efficient parallel processing."
4+
date: 2025-09-25
5+
authors: kevinb
6+
tags:
7+
- announcement
8+
- release
9+
---
10+
11+
Are you struggling with uncontrolled concurrency when trying to process thousands of activities or child workflows? Do you find yourself hitting rate limits or overwhelming downstream services when running bulk operations? We've got great news for you!
12+
13+
Today, we're thrilled to announce **Batch Future**, a powerful new feature in the Cadence Go client that provides controlled concurrency for bulk operations. You can now process multiple activities in parallel while maintaining precise control over how many run simultaneously.
14+
15+
<!-- truncate -->
16+
17+
## The Problem: Uncontrolled Concurrency
18+
19+
Traditionally, when you need to process multiple items in a Cadence workflow, you'd write something like this:
20+
21+
```go
22+
func ProcessUsers(ctx workflow.Context, userIDs []string) error {
23+
var futures []workflow.Future
24+
for _, userID := range userIDs {
25+
future := workflow.ExecuteActivity(ctx, UpdateUserActivity, userID)
26+
futures = append(futures, future)
27+
}
28+
29+
// Wait for all activities to complete
30+
for _, future := range futures {
31+
if err := future.Get(ctx, nil); err != nil {
32+
return err
33+
}
34+
}
35+
return nil
36+
}
37+
```
38+
39+
This approach works, but it has **uncontrolled concurrency**:
40+
- All activities start simultaneously, potentially overwhelming downstream services
41+
- No way to limit concurrent executions
42+
- Difficult to manage resource usage
43+
- Can cause rate limiting or timeouts
44+
- Causing hot shard in Cadence server's task processing
45+
46+
## The Solution: Batch Future
47+
48+
With Batch Future, you can process users with **controlled concurrency**:
49+
50+
```go
51+
func ProcessUsersBatch(ctx workflow.Context, userIDs []string, concurrency int) error {
52+
// Create activity factories for each user
53+
factories := make([]func(workflow.Context) workflow.Future, len(userIDs))
54+
for i, userID := range userIDs {
55+
userID := userID // Capture loop variable for closure
56+
factories[i] = func(ctx workflow.Context) workflow.Future {
57+
return workflow.ExecuteActivity(ctx, UpdateUserActivity, userID)
58+
}
59+
}
60+
61+
// Execute with controlled concurrency
62+
batch, err := workflow.NewBatchFuture(ctx, concurrency, factories)
63+
if err != nil {
64+
return fmt.Errorf("failed to create batch future: %w", err)
65+
}
66+
67+
// Wait for all activities to complete
68+
return batch.Get(ctx, nil)
69+
}
70+
```
71+
72+
## Key Benefits: Controlled Concurrency
73+
74+
Batch Future provides several important advantages:
75+
76+
- **Controlled Concurrency**: Limit simultaneous executions to prevent overwhelming downstream services
77+
- **Resource Management**: Better control over memory and CPU usage
78+
- **Rate Limiting Protection**: Avoid hitting API rate limits by controlling execution speed
79+
- **Graceful Cancellation**: All activities can be cancelled together if needed
80+
- **Simplified Error Handling**: Single point of failure handling for the entire batch
81+
82+
## Real-World Use Cases
83+
84+
Batch Future is perfect for scenarios like:
85+
86+
### 1. Multi-Service Data Synchronization
87+
```go
88+
func SyncProductData(ctx workflow.Context, products []Product) error {
89+
// Sync to multiple services with different concurrency limits
90+
inventoryBatch := createBatch(ctx, products, 5, SyncToInventoryActivity)
91+
searchBatch := createBatch(ctx, products, 3, SyncToSearchActivity)
92+
analyticsBatch := createBatch(ctx, products, 2, SyncToAnalyticsActivity)
93+
94+
// Wait for all sync operations to complete
95+
if err := inventoryBatch.Get(ctx, nil); err != nil {
96+
return fmt.Errorf("inventory sync failed: %w", err)
97+
}
98+
if err := searchBatch.Get(ctx, nil); err != nil {
99+
return fmt.Errorf("search sync failed: %w", err)
100+
}
101+
return analyticsBatch.Get(ctx, nil)
102+
}
103+
104+
func createBatch(ctx workflow.Context, items []Product, concurrency int, activityFunc interface{}) workflow.Future {
105+
factories := make([]func(workflow.Context) workflow.Future, len(items))
106+
for i, item := range items {
107+
item := item
108+
factories[i] = func(ctx workflow.Context) workflow.Future {
109+
return workflow.ExecuteActivity(ctx, activityFunc, item)
110+
}
111+
}
112+
batch, _ := workflow.NewBatchFuture(ctx, concurrency, factories)
113+
return batch
114+
}
115+
```
116+
117+
### 2. Progressive Data Processing with Different Priorities
118+
```go
119+
func ProcessDataWithPriorities(ctx workflow.Context, data []DataItem) error {
120+
// High priority items get more concurrency
121+
highPriority := filterByPriority(data, "high")
122+
lowPriority := filterByPriority(data, "low")
123+
124+
// Process high priority items first with high concurrency
125+
highBatch, _ := workflow.NewBatchFuture(ctx, 10, createFactories(highPriority, ProcessHighPriorityActivity))
126+
127+
// Wait for high priority to complete, then process low priority with lower concurrency
128+
if err := highBatch.Get(ctx, nil); err != nil {
129+
return err
130+
}
131+
132+
lowBatch, _ := workflow.NewBatchFuture(ctx, 3, createFactories(lowPriority, ProcessLowPriorityActivity))
133+
return lowBatch.Get(ctx, nil)
134+
}
135+
```
136+
137+
### 3. Conditional Batch Processing with Retry Logic
138+
```go
139+
func ProcessOrdersWithRetry(ctx workflow.Context, orders []Order) error {
140+
// First attempt with normal concurrency
141+
factories := make([]func(workflow.Context) workflow.Future, len(orders))
142+
for i, order := range orders {
143+
order := order
144+
factories[i] = func(ctx workflow.Context) workflow.Future {
145+
return workflow.ExecuteActivity(ctx, ProcessOrderActivity, order)
146+
}
147+
}
148+
149+
batch, _ := workflow.NewBatchFuture(ctx, 5, factories)
150+
if err := batch.Get(ctx, nil); err != nil {
151+
// If batch fails, retry failed orders individually with higher concurrency
152+
return retryFailedOrders(ctx, orders, 10)
153+
}
154+
return nil
155+
}
156+
```
157+
158+
## How It Works Under the Hood
159+
160+
Batch Future leverages Cadence's existing activity infrastructure with controlled concurrency:
161+
162+
1. **Future Factories**: Creates lazy-evaluated future creation functions that aren't scheduled until needed
163+
2. **Concurrency Control**: Limits the number of pending futures
164+
3. **Queue Management**: Maintains a queue of to-be-scheduled futures and starts new ones as others complete
165+
4. **Future Management**: Returns a single future that completes when all futures finish
166+
5. **Error Propagation**: If any future fails, the error is stored in a multi-error wrapper entity, users can either cancel or fail open
167+
168+
## Getting Started
169+
170+
Ready to supercharge your workflows? Here's how to get started:
171+
172+
### 1. Update Your Go Client
173+
Make sure you're using the latest version of the Cadence Go client:
174+
175+
```bash
176+
go get github.com/uber/cadence-go-client@latest
177+
```
178+
179+
### 2. Try the Sample
180+
Check out our [Batch Future sample](https://github.com/cadence-workflow/cadence-samples/tree/master/cmd/samples/batch) to see it in action.
181+
182+
### 3. Migrate Your Workflows (With Caution)
183+
184+
**This is not a simple code change**. Migrating to Batch Future requires workflow versioning and careful production planning.
185+
186+
#### The Challenge
187+
Batch Future changes your workflow's execution pattern from individual activities to controlled batching. This creates non-deterministic changes that will break existing running workflows without proper versioning.
188+
189+
#### Migration Approaches
190+
191+
**Option A: Versioned Migration (Recommended for Production)**
192+
- Use [workflow.GetVersion()](https://cadenceworkflow.io/docs/go-client/workflow-versioning) to support both old and new patterns
193+
- Deploy code that handles both execution patterns
194+
- Gradually transition new workflows to use Batch Future
195+
- Clean up old code after all workflows complete
196+
197+
**Option B: New Workflow Type (Simpler but Requires Coordination)**
198+
- Create a new workflow type specifically for Batch Future
199+
- Update callers to use the new workflow type
200+
- Deprecate the old workflow type after migration
201+
202+
**Option C: Workflow Replacement (Not Gradual)**
203+
- Terminate existing workflows (if acceptable)
204+
- Deploy new code with Batch Future
205+
- Start new workflows with the new pattern
206+
207+
#### Testing Strategy
208+
Before deploying, use [Workflow Shadowing](https://cadenceworkflow.io/docs/go-client/workflow-replay-shadowing) to replay production workflow histories against your new code. This catches compatibility issues before they reach production.
209+
210+
#### Key Considerations
211+
- **Timeline**: Plan for weeks, not days
212+
- **Coordination**: Requires careful coordination between teams
213+
- **Monitoring**: Essential during transition period
214+
- **Rollback**: Always have a rollback plan ready
215+
- **Testing**: Extensive testing in staging environment required
216+
217+
#### When NOT to Migrate
218+
- If you have long-running workflows (weeks/months)
219+
- If you can't coordinate a proper versioning strategy
220+
- If the performance benefits don't justify the migration complexity
221+
222+
## Best Practices
223+
224+
- **Choose Appropriate Concurrency**: Start with 3-5 concurrent activities and adjust based on downstream service capacity
225+
- **Activity Factories**: Always capture loop variables in closures to avoid race conditions
226+
- **Error Handling**: Implement proper error handling for individual activity failures
227+
- **Resource Management**: Consider memory usage for large batches
228+
- **Monitoring**: Use heartbeats for long-running activities within the batch
229+
230+
## Try It Today!
231+
232+
Batch Future is available now in the latest Cadence Go client. We can't wait to see how you use it to optimize your workflows!
233+
234+
Have questions or feedback? Join our [Slack community](http://t.uber.com/cadence-slack) or open an issue on [GitHub](https://github.com/cadence-workflow/cadence-go-client).
235+
236+
Happy coding, and here's to faster, more efficient workflows!
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Cadence Joins CNCF (Cloud Native Computing Foundation)
3+
4+
date: 2025-10-06
5+
authors: enderdemirkaya
6+
tags:
7+
- announcement
8+
---
9+
10+
# Cadence Joins the CNCF (Cloud Native Computing Foundation)
11+
12+
![using.png](./cncf/cadence-joins-cncf.png)
13+
14+
We’re proud to announce that [the Cadence project](https://cadenceworkflow.io/) has joined the [CNCF (Cloud Native Computing Foundation)](https://www.cncf.io/)®, the open-source foundation that hosts and maintains critical components of modern cloud-native infrastructure including Kubernetes®, Prometheus®, and Envoy® under the [Linux Foundation](https://www.linuxfoundation.org/)®.
15+
16+
Cadence is an open-source, fault-tolerant, and highly scalable workflow orchestration engine created at Uber to help developers build and run resilient applications. It’s been powering thousands of use cases at Uber and other companies. By managing distributed state, retries, scaling, and failure recovery, Cadence enables teams to focus on business logic rather than infrastructure complexity. Mission-critical applications across industries including finance, e-commerce, healthcare, and transportation depend on Cadence.
17+
18+
Joining CNCF marks a significant milestone for the Cadence project, emphasizing the project’s open source commitment. With its [open governance](https://cadenceworkflow.io/community/governance), companies can join as maintainers and help improve long-term confidence. Increased transparency in roadmap and execution make upcoming features predictable.
19+
20+
Since its inception, the Cadence project’s ecosystem has reached over 150 companies and counting. Partners like NetApp® Instaclustr adopted the project and have offered it as a managed solution at scale. With CNCF’s support, the project aims to further its mission of simplifying distributed service development while delivering production-grade reliability at scale.
21+
22+
In the last several years, Cadence has made significant investments in its scalability, reliability, multitenancy, deployment safety, and portability, laying the necessary foundation to build enterprise-level features at scale, efficiently and reliably. It’s now a great time to build those features together, and we invite anyone to be a part of this future. Especially in the era of AI, Cadence will play a crucial role in durable orchestration.
23+
24+
## What’s Changing in the Community?
25+
26+
We’ll stop using our Slack workspace ([uber-cadence.slack.com](http://uber-cadence.slack.com)). Going forward, we’ll use CNCF’s Slack workspace ([cloud-native.slack.com](https://cloud-native.slack.com/)). Join this new workspace using [Community Inviter](https://communityinviter.com/apps/cloud-native/cncf) and join the *\#cadence-users* channel to contact us.
27+
28+
Our website ([cadenceworkflow.io](http://cadenceworkflow.io)) and our GitHub org ([github.com/cadence-workflow](http://github.com/cadence-workflow)) will stay the same and we’ll continue sharing new features from there.
29+
30+
We’ll publish our roadmap at [https://github.com/orgs/cadence-workflow/projects](https://github.com/orgs/cadence-workflow/projects). We’ll hold community meetings to brainstorm about and prioritize upcoming features. Project tracking will move from internal tools to GitHub. Projects will have dedicated issues so you can track pull requests, updates, and timelines.
31+
32+
We’ll organize regular meetups (in-person and virtual) to showcase new features, have discussions, and learn from valuable guests.
33+
34+
For maintainers, we’ll hold regular meetings to update each other. If you’d like to become a maintainer, please contact us on Slack so we can help with starter tasks and larger projects as you gain experience.
35+
36+
## How to Become a Maintainer?
37+
38+
We invite companies that are already using Cadence, or plan to adopt it in the future, to become official maintainers and help shape this critical piece of infrastructure for your organization.
39+
40+
With this important milestone, we are prioritizing the addition of new maintainers and working to make the onboarding experience as smooth as possible. Our goal is to scale the project responsibly across all areas including development, decision making, efficiency, modernization, prioritization, and more.
41+
42+
If you are interested, please reach out to us in the #cadence-users channel mentioned above, and we will help you find suitable projects to contribute to. If you already have something in mind, feel free to open an issue in the appropriate repository under [github.com/cadence-workflow](http://github.com/cadence-workflow).
43+
44+
## Acknowledgments
45+
46+
*CNCF® and the CNCF logo design are registered trademarks of the Cloud Native Computing Foundation.*
47+
48+
*Envoy®, Kubernetes®, Prometheus®, and their logos are registered trademarks of The Linux Foundation® in the United States and other countries. No endorsement by The Linux Foundation is implied by the use of these marks.*
49+
50+
*Instaclustr® and NetApp® are trademarks of NetApp, Inc.*

blog/authors.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,14 @@ arzonus:
126126
page: true
127127
socials:
128128
linkedin: https://www.linkedin.com/in/seva-kaloshin/
129-
github: arzonus
129+
github: arzonus
130+
131+
kevinb:
132+
name: Kevin Burns
133+
title: Developer Advocate @ Uber
134+
url: https://www.linkedin.com/in/kevin-burns-8182aa58/
135+
image_url: https://github.com/bueller87.png
136+
page: true
137+
socials:
138+
linkedin: https://www.linkedin.com/in/kevin-burns-8182aa58/
139+
github: bueller87

blog/cncf/cadence-joins-cncf.png

62.2 KB
Loading

docs/03-concepts/09-search-workflows.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
layout: default
3-
title: Search workflows(Advanced visibility)
3+
title: Search workflows (Advanced visibility)
44
permalink: /docs/concepts/search-workflows
55
---
66

7-
# Searching Workflows(Advanced visibility)
7+
# Searching Workflows (Advanced visibility)
88

99
## Introduction
1010

docs/03-concepts/13-workflow-queries-formatted-data.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,38 @@ This would render as:
8282

8383
---
8484

85+
## UI Examples
86+
87+
The following screenshots demonstrate how formatted query responses appear in the Cadence Web UI:
88+
89+
### Employee Database Query Results
90+
91+
This example shows formatted data returned from an employee database query, demonstrating how tabular data can be presented:
92+
93+
![Employee Database Query Results](img/employee-database-query.png)
94+
95+
*Employee records displayed in a structured table format showing Employee name, Title, and description columns with sample data for multiple employees.*
96+
97+
### Hello World Workflow Query Results
98+
99+
Here's an example of how query results are displayed for a simple workflow:
100+
101+
![Hello World Workflow Query Results](img/hello-world-workflow-query.png)
102+
103+
*The Hello World Workflow query interface showing basic workflow concepts and activity execution information, including real-world use case details and sample code links.*
104+
105+
### Query Interface
106+
107+
The Queries tab provides an interface for executing workflow queries with various predefined options:
108+
109+
![Cadence Web Queries Interface](img/cadence-queries-interface.png)
110+
111+
*The Queries tab showing available query operations including `__open_sessions`, `get_runtime_data`, and other predefined queries, along with an "Operator Runbook" option.*
112+
113+
These examples illustrate how the formatted data feature enhances the user experience by providing rich, structured displays instead of raw JSON responses.
114+
115+
---
116+
85117
## Go Implementation
86118

87119
### Type Definition
203 KB
Loading
209 KB
Loading
324 KB
Loading

0 commit comments

Comments
 (0)