Dapr Workflow vs Temporal Under Chaos: Deploys, Crashes and Double Charges
Dapr Workflow and Temporal both run workflows written as ordinary code, and both promise that every activity runs at least once. That makes them look interchangeable. They are not, and the difference shows up the moment something breaks while an activity is running. Dapr ties a running activity to the gRPC stream between your application and its sidecar. Temporal ties it to a timeout on the server. Most of what follows comes from that one design decision; the rest comes from how each SDK shuts down and from the databases underneath.
I tested it rather than read about it. One order saga, reserve, charge, ship, with a refund if shipping fails, runs on Dapr 1.19.1 and on Temporal Server 1.32.2. Then I broke things with Toxiproxy and Docker in the middle of the charge, at the worst possible moment: after the money moved, before the engine heard about it. I counted charges.
The short version:
- A rolling deploy in the middle of the charge charged the card twice on Dapr and once on Temporal, in every run. Temporal's worker finishes what it started before it exits. Dapr's closes its stream first, and on Dapr any break in the app's stream to the sidecar aborts the running activity and runs it again, even when it already finished. A 300 ms network blip was enough. A shutdown hook that waits for running activities before closing fixed the deploy case in my rig.
- A worker crash charged twice on both, but Dapr finished the saga one to five seconds after the new worker started, while Temporal waited out the activity timeout and took nine to fourteen.
- A charge that hung for 25 seconds was charged once on Dapr and three times on Temporal, and the Temporal saga then failed without refunding any of them. Dapr has no activity timeout at all, so a hang there waits forever.
- An idempotency key turned every duplicate charge into a single charge, on both engines. The compensation took two attempts: my first "safe" saga refunded too early and kept the money of a customer whose provider answered late. Temporal's documented answer to slow crash detection, heartbeats, fixed only half of the wait; the other five seconds were its sticky queue.
- The sidecar is not where the latency goes. Both engines cross the app link about twice per activity. The difference is the database: Temporal issued 32.2 SQL statements per step, and a few milliseconds of database latency multiplied its step time.
Everything is in the companion repository. Every block of source below is a real file there, and its first line says which one. The claims are backed by its tests, which run both engines in Docker. Where I rely on documentation alone, the text says so.
Two architectures, one API shape
From the code you write, the two look almost the same. Here is the saga on Dapr:
// src/main/java/com/wolinski/chaos/dapr/OrderSaga.java
/** Reserve, charge, ship; if the carrier refuses, refund and release. The sidecar replays this from its history. */
public class OrderSaga implements Workflow {
static final WorkflowTaskOptions RETRY = new WorkflowTaskOptions(WorkflowTaskRetryPolicy.newBuilder()
.setMaxNumberOfAttempts(3)
.setFirstRetryInterval(Duration.ofMillis(200))
.build());
@Override
public WorkflowStub create() {
return ctx -> {
String order = ctx.getInput(String.class);
ctx.callActivity("reserve", order, RETRY).await();
ctx.callActivity("charge", order, RETRY).await();
try {
ctx.callActivity("ship", order, RETRY).await();
} catch (TaskFailedException refused) {
ctx.callActivity("refund", order, RETRY).await();
ctx.callActivity("release", order, RETRY).await();
ctx.complete("cancelled");
return;
}
ctx.complete("shipped");
};
}
}And on Temporal:
// src/main/java/com/wolinski/chaos/temporal/OrderSagaImpl.java
/** The same saga as the Dapr one. The difference is the timeout: Temporal will not start an activity without one. */
public class OrderSagaImpl implements OrderSaga {
private final ShopActivities shop = Workflow.newActivityStub(ShopActivities.class, ActivityOptions.newBuilder()
.setStartToCloseTimeout(Duration.ofSeconds(5))
.setRetryOptions(RetryOptions.newBuilder()
.setMaximumAttempts(3)
.setInitialInterval(Duration.ofMillis(200))
.build())
.build());
@Override
public String place(String order) {
shop.reserve(order);
shop.charge(order);
try {
shop.ship(order);
} catch (ActivityFailure refused) {
shop.refund(order);
shop.release(order);
return "cancelled";
}
return "shipped";
}
}Same steps, the same attempt limit and first retry interval (the rest of the retry policy is each SDK's default), and the same replay model: both engines record an event history and rebuild the workflow's state by running its code again over that history. That is why the code has to be deterministic on both.
Underneath, they are built differently.
| Dapr Workflow | Temporal | |
|---|---|---|
| Where the engine runs | Inside the daprd sidecar next to every app instance | A separate server cluster, shared by many apps |
| How work reaches your code | The app opens one gRPC stream to its sidecar and receives work items on it | Workers long-poll task queues on the server over gRPC |
| Where state lives | Any Dapr state store marked actorStateStore, through Dapr actors | Temporal's own schema in Cassandra, PostgreSQL, MySQL or SQLite |
| Other moving parts | Placement and Scheduler services | Frontend, history, matching and worker services (one process here) |
| What a running activity is bound to | The stream it was sent on | A start-to-close timeout |
Dapr's documentation describes the stream: on start-up the app uses the SDK "to send a gRPC request to the Dapr sidecar and get back a stream of workflow work items", and "all interactions happen over a single gRPC channel and are initiated by the application", so the app opens no inbound ports. Temporal's documentation describes the other side: "The Temporal Server doesn't detect failures when a Worker loses communication with the Server or crashes. Therefore, the Temporal Server relies on the Start-To-Close Timeout to force Activity retries." If you set neither a start-to-close nor a schedule-to-close timeout, Temporal rejects the activity.

The last row of the table is the one this article is about.
The vocabulary
| term | what it means |
|---|---|
| sidecar | A process deployed next to each instance of your app, in Kubernetes a second container in the same pod. Dapr's is daprd. |
| activity | One step with side effects: a call to a payment provider, a database write. Both engines use the word. |
| work item stream | Dapr's long-lived gRPC stream on which the sidecar sends workflow and activity work to the app. |
| start-to-close timeout | Temporal's limit on one attempt of an activity. When it expires, the server schedules the next attempt. |
| saga | A sequence of steps where each step that succeeded has a compensating step, run in reverse if a later step fails. |
| at-least-once | Every activity runs, possibly more than once. Both engines promise this and nothing stronger. |
| blackhole | A link that stays open but delivers nothing in either direction, which is what a dead switch looks like to TCP. A cut link, in contrast, resets at once. |
The test rig
Every link the tests break goes through Toxiproxy, so a test can cut it, blackhole it or slow it down: app to Dapr sidecar, sidecar to Redis, worker to Temporal server, server to PostgreSQL. The workers run in JVMs of their own so that a crash is a real kill -9. The engines are real: daprd with its Placement and Scheduler services and a Redis state store, and Temporal Server 1.32.2 with all four services in one process on PostgreSQL 18. I started with Temporal's single-binary development server and dropped it, for a reason that comes up in the latency section.
The payment provider is a file. Every activity writes its side effect to that file first, and then, if the test left a hold file for that step, waits until the file disappears:
// src/main/java/com/wolinski/chaos/shop/Shop.java
private void effect(String effect, String step, Runnable whileWaiting) {
ledger.record(effect);
await(step, whileWaiting);
}
private void await(String step, Runnable whileWaiting) {
Path hold = holds.resolve("hold-" + step);
Path clientTimeout = holds.resolve("client-timeout-" + step);
long started = System.nanoTime();
while (Files.exists(hold)) {
if (Files.exists(clientTimeout) && System.nanoTime() - started > millis(clientTimeout) * 1_000_000) {
throw new IllegalStateException("payment client gave up waiting for " + step);
}
whileWaiting.run();
try {
Thread.sleep(20);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
}
}If the test also left a client-timeout file, the caller gives up after that many milliseconds and throws while the provider carries on, which is what a payment client with a timeout does against a slow provider. The puzzle at the end uses it. The hold is how each test puts the break exactly where it hurts. The charge has happened, the activity has not returned, and now the network fails. Counting charge: lines in the file afterwards tells you what the engine did.
What a network blip costs
Start with the smallest thing that can go wrong. On Kubernetes the app talks to its Dapr sidecar over localhost, so a real network blip on that link is rare. But the tests below show that the network is not the point: anything that closes the app's stream has the same effect, and the stream closes on every deploy, as the next section shows. Dapr's own documentation adds one more cause: "A load balancer or proxy between the app and the sidecar can close a stream that carries no traffic. AWS ALB and nginx, for example, close an idle stream after 60 seconds." A cut link is simply the easiest way to close the stream on purpose.
The first test cuts the link between the app and the engine for 300 milliseconds while the charge is held, lets the charge finish during the cut, and heals the link.
| break during the charge | Dapr charges | Temporal charges |
|---|---|---|
| App link cut for 300 ms | 2 | 1 |
| App link cut for 2 s | 2 | 1 |
| App link blackholed for 2 s | 2 | 1 |
| Dapr sidecar restarted (2 s down) | 2 | see below |
| App link cut for 10 s, longer than the 5 s timeout | 2 | 2 |
On Dapr every one of these charged twice, in every run. The sidecar's own log says why, in order:
work item stream closed
activity-processor: failed to process work item: operation aborted
dapr-blip-300: aborting activity execution (::1)
dapr-blip-300::1::0: execution of 'run-activity' failed with a recoverable error and will be retried later: execution abortedWhen the stream closes, the sidecar aborts every activity it had sent on it and schedules it again. It does not wait to see whether the result arrives. The worker meanwhile logs "The sidecar … is unavailable. Will continue retrying", reconnects about five seconds later, receives the charge again and runs it. So a 300 ms blip costs a duplicate charge and five seconds.
Temporal does not notice a 300 ms blip at all. The charge finishes during the cut, and the result still reaches the server once the link is back, because the attempt's five seconds have not run out. I did not trace whether the SDK retried the call or the call simply waited for the connection; either way the server accepted a result for an attempt it still considered running. The result is bound to the attempt, not to the connection it arrived on. Only when the break outlasts the timeout does Temporal give up on the attempt and start another, and then it charges twice like Dapr.
Dapr does document the general rule. Its activities are executed "at least once", and its SDK documentation warns that without a retry policy "runtime redelivery can still repeat execution". What it does not tell you is how little it takes. If you read "at least once" as "twice after a crash", you will be surprised by "twice after a 300 ms blip".
Restarting the engine
Restarting the Dapr sidecar is just another stream break, and it charged twice every time. Restarting Temporal Server for two seconds was less clear cut. In twelve runs it charged once eight times and twice four times. The container was down for two seconds, but the saga finished anywhere from one to seven seconds after it started again, so the server was not always ready to accept results as soon as its process was. When that ran past the five-second timeout, the attempt expired before the worker could report it. I did not break down where those seconds go. I do not assert either outcome. The lesson is that a server restart is not a two-second event, whatever the container's downtime says.
What a deploy costs
The most common way a running activity loses its worker is not a crash. It is a deploy. In this test a new worker starts, then the old one receives SIGTERM while the charge is running, and shuts down the way its SDK offers: Temporal's worker factory with shutdown() and awaitTermination, Dapr's WorkflowRuntime with close(), both from a shutdown hook as a framework closing its context would.
| rolling deploy during the charge | Dapr | Temporal |
|---|---|---|
| Charges, in each of 7 runs | 2 | 1 |
Temporal's shutdown stops polling for new work and lets the tasks it already holds finish, so the old worker completed the charge, reported it and exited. Dapr's close(), as its bytecode shows, closes the worker's stream before it shuts down its thread pool. The sidecar saw the stream close, aborted the charge and sent it to the new worker, while the old one was still finishing the first charge. In the Java SDK 1.19.1 WorkflowRuntime has start and close and nothing in between, and no way to drain it. So on Dapr, every deploy that catches an activity running repeats it, unless you build the drain yourself.
That turned out to be simple enough to try. The worker counts the activities it is running, and its shutdown hook waits until the count is zero, for up to 25 seconds, before it calls close(). With that hook the same deploy charged once in each of 7 runs. It has limits I did not test. While it waits, the stream stays open, so the old worker can still receive new work, and a busy one may not reach zero before its deadline. The wait has to fit in the grace period below. And on Kubernetes the pod's sidecar gets its own SIGTERM at the same moment and may close the stream first.

Two limits on this result. In my rig both workers talk to the same sidecar. On Kubernetes each pod has its own, and the old pod's sidecar shuts down with it; I did not test that, but it closes the same stream, so I would not expect it to help. And Temporal's clean result holds only while the running activity finishes inside the time the platform waits before it kills the process. Dapr's own documentation puts the Kubernetes termination grace period at 30 seconds by default. An activity that takes longer gets the kill, which is the crash case below: two charges on both engines.
What a crash costs
Kill the worker in the middle of the charge and start a new one two seconds later.
| worker killed during the charge | Dapr | Temporal |
|---|---|---|
| Charges | 2 | 2 |
| From new worker to saga done | 1 to 5 s | 9 to 14 s |
Both charge twice. Nothing can prevent that: the money moved and the process that knew it is gone. The difference is the wait. Dapr saw the stream die and had the charge queued for the next worker immediately. Temporal cannot see a dead worker, as its documentation says, so the second attempt had to wait for the first one's start-to-close timeout to expire. Here that cost nine to fourteen seconds with a five-second timeout. With a five-minute timeout, sensible for a slow payment provider, it costs five minutes. Heartbeats are the documented answer, and they turned out to be only half of it, as the section on fixes shows.
So the same design decision cuts both ways. Binding work to the stream makes Dapr fast to recover from a dead worker and quick to repeat work after a live one hiccups. Binding work to a timeout makes Temporal tolerant of hiccups and slow to recover from death, unless you add heartbeats.
What a hang costs
The third case is the one I did not expect. The charge does not fail and the network is fine. The charge just does not return, for 25 seconds, the way a call to a slow payment provider without a client timeout might hang.
| charge hangs for 25 s | Dapr | Temporal |
|---|---|---|
| Charges | 1 | 3 |
| Saga outcome | shipped, 25 s late | failed, nothing refunded |
Dapr waited. It has no activity timeout to expire: the retry policy's retryTimeout "limits scheduling further attempts; it is not a timeout that interrupts a running activity", in the words of its JavaScript SDK documentation, and the Java WorkflowTaskOptions has nothing else. That turned out well here, one charge. But if the call never returns, the workflow stays RUNNING forever. The engine will not fail it; only your own monitoring of how long workflows have been running will notice. The timeout is your job: on the HTTP client inside the activity, or as a durable timer raced against the activity in the workflow. Read the puzzle at the end before you add the first one.
Temporal did exactly what it was told. After five seconds the attempt timed out and the server scheduled the second attempt, which the same worker picked up and started while the first was still running, because nothing tells a running activity that its attempt expired unless it heartbeats. Five seconds later, a third. Three charges in flight at once. After the third timeout the retry policy was exhausted, the charge activity failed, and the saga failed with it, because my code only compensates when shipping fails. The workflow said the charge failed. The ledger said it succeeded three times.
The trap is in the word. A Temporal activity timeout does not mean the activity failed. It means the engine stopped waiting. The side effect may have happened any number of times. A saga that treats "charge timed out" as "nothing to refund" will keep money it should return. The fix is the same as for every at-least-once system, and I tested it below: an idempotency key that the payment provider honours, so that three attempts are one charge, and compensation that runs when the outcome is unknown, not only when it is a clean failure.
What a database outage costs
Cutting the engine off from its own database, Redis for Dapr and PostgreSQL for Temporal, was the gentlest failure of all. With a two-second cut, both engines charged once in every run, and so did Dapr with a two-second blackhole of Redis. The charge result waited in the sidecar or the server until the database came back. Temporal with a two-second blackhole of PostgreSQL was the exception: once in 11 of 14 runs, twice in 3, and the first of those three showed up only when I ran the repository from a clean copy, after ten runs in a row had charged once.
Longer outages were less consistent on Temporal: a ten-second blackhole of PostgreSQL charged once in every run, but a ten-second cut charged twice in five runs of six. I do not assert those.
One more thing the sidecar log told me unprompted: "Redis does not support transaction rollbacks and should not be used in production as an actor state store." Dapr's workflow state lives in its actor state store, so that warning applies to every workflow on this setup. Pick a store with transactions for production, and check what it really supports: the same Dapr API promises different things on different stores.
What fixes it, tested
Every failure above is the same failure: a step with a side effect ran more than once, or its outcome was unknown and the saga guessed. The repository has a second version of the saga on each engine that does what this article recommends, and the same breakages run against it. The payment provider in that version honours an idempotency key, the way real providers do:
// src/main/java/com/wolinski/chaos/shop/Shop.java
/**
* A charge with an idempotency key, the way real payment providers offer it: the first call with a key moves money,
* every later call with the same key returns the first result and moves nothing.
*/
public void charge(String order, String key, Runnable whileWaiting) {
requireProvider();
boolean late = Files.exists(holds.resolve("late-charge"));
synchronized (PROVIDER) {
if (0 < ledger.count("charge-accepted:" + key)) {
ledger.record("charge-repeated:" + order);
} else {
ledger.record("charge-accepted:" + key);
if (late) {
Thread.ofPlatform().start(() -> {
// The provider's side: it waits for the hold, not for the caller's timeout.
Path hold = holds.resolve("hold-charge");
while (Files.exists(hold)) {
try {
Thread.sleep(20);
} catch (InterruptedException e) {
return;
}
}
settle(order, key);
});
} else {
settle(order, key);
}
}
}
await("charge", whileWaiting);
}
/** What the provider knows about a key: CHARGED, PENDING (accepted, not yet processed) or NONE. */
public String chargeStatus(String key) {
requireProvider();
synchronized (PROVIDER) {
if (0 < ledger.count("charge-key:" + key)) {
return "CHARGED";
}
return 0 < ledger.count("charge-accepted:" + key) ? "PENDING" : "NONE";
}
}
private void requireProvider() {
if (Files.exists(holds.resolve("provider-down"))) {
throw new IllegalStateException("payment provider unavailable");
}
}
private void settle(String order, String key) {
synchronized (PROVIDER) {
ledger.record("charge-key:" + key);
ledger.record("charge:" + order);
}
}The saga derives the key from the workflow ID, so every attempt of the charge, on any worker, carries the same one. And it treats a charge that failed as an unknown outcome. My first version refunded by the same key at once, on the reasoning that a refund for a key that never charged does nothing. A provider that answers late breaks that. In the test it accepted the charge, the saga gave up and refunded, the refund found no charge, and the charge went through ten seconds later: an order cancelled, a customer charged, nothing refunded. So the saga now asks the provider for the key's final status, waits on a durable timer while the provider still says pending, and refunds only once the money has moved. Here is the Temporal version; the Dapr one in SafeOrderSaga.java has the same shape:
// src/main/java/com/wolinski/chaos/temporal/SafeOrderSagaImpl.java
public class SafeOrderSagaImpl implements SafeOrderSaga {
private final ShopActivities shop = Workflow.newActivityStub(ShopActivities.class, ActivityOptions.newBuilder()
.setStartToCloseTimeout(Duration.ofSeconds(5))
.setHeartbeatTimeout(Duration.ofSeconds(1))
.setRetryOptions(RetryOptions.newBuilder()
.setMaximumAttempts(3)
.setInitialInterval(Duration.ofMillis(200))
.build())
.build());
/** Compensation must not give up after a short provider outage: back off up to 10 s, for up to an hour. */
private final ShopActivities compensation = Workflow.newActivityStub(ShopActivities.class, ActivityOptions.newBuilder()
.setStartToCloseTimeout(Duration.ofSeconds(5))
.setScheduleToCloseTimeout(Duration.ofHours(1))
.setRetryOptions(RetryOptions.newBuilder()
.setInitialInterval(Duration.ofMillis(200))
.setMaximumInterval(Duration.ofSeconds(10))
.build())
.build());
@Override
public String place(String order) {
String key = "order-" + Workflow.getInfo().getWorkflowId();
shop.reserve(order);
try {
shop.chargeOnce(order, key);
} catch (ActivityFailure unknownOutcome) {
refundWhenSettled(order, key);
compensation.release(order);
return "cancelled";
}
try {
shop.ship(order);
} catch (ActivityFailure refused) {
compensation.refundOnce(order, key);
compensation.release(order);
return "cancelled";
}
return "shipped";
}
/** A provider may still process a charge the saga gave up on, so wait for its final status before refunding. */
private void refundWhenSettled(String order, String key) {
for (int check = 0; check < 300; check++) {
String status = compensation.chargeStatus(key);
if ("PENDING".equals(status)) {
Workflow.sleep(Duration.ofSeconds(1));
continue;
}
if ("CHARGED".equals(status)) {
compensation.refundOnce(order, key);
}
return;
}
throw ApplicationFailure.newFailure("charge " + key + " still pending after five minutes", "ChargeUnsettled");
}
}| breakage | naive saga | safe saga |
|---|---|---|
| Dapr, rolling deploy | 2 charges | 1 charge |
| Dapr, 300 ms blip | 2 charges | 1 charge |
| Dapr, worker crash | 2 charges | 1 charge |
| Temporal, worker crash | 2 charges | 1 charge |
| Temporal, app link cut for 10 s | 2 charges | 1 charge |
| Temporal, charge hangs for 25 s | 3 charges, failed, nothing refunded | 1 charge, refunded, cancelled |
| Temporal, charge hangs and the provider processes it late | first safe version: 1 charge, cancelled, nothing refunded | 1 charge, refunded, cancelled |
| Dapr, provider down for 6 s as the refund starts | second safe version: 1 charge, failed, nothing refunded | 1 charge, refunded, cancelled |
The engines did not change their behaviour. In each of the first five cases the provider's log shows the second call arriving with the same key and being answered without moving money. The key is what made the difference, not the engine. In the hang row the provider settles the charge at once and only its answer hangs, so the first status check after the last timeout already says the money moved.
The last row is a hole in my second version. It compensated with the charge's retry policy: three attempts, less than a second of retrying. When the provider went down for six seconds just as the saga started to compensate, the status check failed three times and the workflow failed with the customer charged and the stock reserved, the naive saga's outcome again. A compensation is the step you can least afford to give up on, so it now has a retry policy of its own on both engines, backing off up to ten seconds for up to an hour. With it, the same test ended cancelled and refunded on Dapr and on Temporal. If an hour is not enough, the workflow fails, and that is what the alert on compensations below is for.
Three things about the key that the tests do not show. A workflow ID is a good key only while it identifies one business operation: if a workflow charges twice, each charge needs its own key, and if your workflow IDs can be reused after a run closes, which Temporal's documentation says is the default policy, a new order could receive the old order's saved response. Keys also expire, as I noted for an AI agent issuing refunds on Temporal. Stripe's documentation says that for its v1 API keys can be removed once they are at least 24 hours old, and a key reused after that is treated as a new request, so a retry policy that keeps trying for days outlives its protection. And two requests with the same key at the same moment are a separate case. Temporal's overlapping attempts produce them during a hang, and so does a Dapr deploy, where the new worker repeats a charge the old one is still waiting for. My test provider simply treats the second request as a repeat. Stripe does not: its documentation says it saves no result for a request that "conflicts with another request that's executing concurrently", and that such a request can be retried. Your activity has to expect that answer.
Heartbeats are half the answer
The safe Temporal saga also sets a one-second heartbeat timeout, and its charge heartbeats while it waits. I expected that to cut the crash recovery from about ten seconds to about one. It did not:
| Temporal, worker killed during the charge | from new worker to saga done |
|---|---|
| No heartbeat | 9 to 14 s |
| Heartbeat timeout 1 s | 6.3 s |
| Heartbeat timeout 1 s and sticky queue timeout 1 s | 2.3 s |
The workflow's event history showed where the rest went. The heartbeat ended the dead attempt quickly, and the new attempt completed. But the workflow task that followed was first offered to the dead worker, and it sat there for 5.0 seconds until the history recorded WORKFLOW_TASK_TIMED_OUT with SCHEDULE_TO_START. That is Temporal's sticky execution: a worker caches each workflow it runs and gets the next tasks for it on a queue of its own. The documentation says that if the worker does not pick up a task there "within five seconds by default", the service gives up on stickiness and puts the task on the normal queue. A dead worker never picks it up, so every workflow it was running waits those five seconds once. The Java SDK's WorkerOptions.setStickyQueueScheduleToStartTimeout shortens it, and with one second the crash cost 2.3 seconds, inside the one to five seconds Dapr took across all runs. The price, which I did not measure, falls on live workers: one that stalls for longer than that, in a garbage collection pause for instance, has its task moved to the shared queue, and whichever worker takes it, if it does not have the workflow cached, has to fetch the whole history and replay it, which Temporal's documentation describes as the cost that caching exists to avoid, and one that grows with the length of the history.
One more thing the hang test showed about heartbeats. My charge heartbeats from the loop that waits for the provider, so during the 25-second hang the worker looked perfectly alive, and only the five-second start-to-close timeout ended each attempt. A heartbeat proves that the process is running, not that the call inside it is getting anywhere.
Dapr has no heartbeat and no activity timeout, so the timeout is yours to write. One option is a timeout on the client inside the activity, which the puzzle below is about. The other is to race the activity against a durable timer in the workflow: the Java SDK has ctx.anyOf(...) and ctx.createTimer(...) for it. I did not test that pattern, and note what it cannot do: the workflow stops waiting, but the activity keeps running and may still charge.
Starting a workflow with no worker
A smaller difference. Dapr refuses to start a workflow while no worker is connected to the sidecar:
FAILED_PRECONDITION: failed to create workflow instance: no workflow worker is connected for app 'orders'
(the app must be running with its workflow worker registered with its Dapr sidecar before workflows can be
started, raised, terminated, purged or waited on; retry once it has connected)Temporal accepts the start, keeps it on the task queue, and runs it when a worker appears. On Dapr, the service that starts workflows and the service that runs them are coupled in time: during a deploy, or right after a crash, starts fail and the caller has to retry. My tests hit this whenever they started a saga a moment before the new worker had connected.
What to alert on
None of the failures above made a workflow fail on its own. They showed up as a duplicate charge, a late completion or a workflow that never ends. So the signals to watch are the ones that reveal those:
- Activities that ran more than once. On Dapr, the sidecar logs "aborting activity execution" when a stream closes under a running activity, which is the moment it decides to run it again. On Temporal, an activity's history records its attempt number. Either one rising after a deploy is the duplicate in this article.
- Workflows running longer than they should. This is the only way to see a hung activity on Dapr, and an ignored timeout on Temporal. Temporal can query its visibility store for running workflows of one type started before a given time. Dapr's Java client 1.19.1 only lists instance IDs, a page at a time, so you read each one's state to find the old ones. Either way, alert on age, per workflow type.
- Time from scheduled to started. Temporal's documentation recommends watching
temporal_activity_schedule_to_start_latencyrather than setting a schedule-to-start timeout. A rise means workers are missing or too slow, the situation behind the crash and sticky-queue numbers above. - Compensations, by reason, and their retries. A refund after an unknown outcome is not an error, but if their number grows, a provider is slow, and the next step is the late-processing case. A compensation still retrying is money you owe someone.
Where the latency goes
The common worry about Dapr is the sidecar: every call takes an extra gRPC hop, so it must be slower than a worker talking to its engine directly. That framing is wrong in both halves. A Temporal worker does not talk to anything directly either. It long-polls the Temporal server over gRPC, across the network. And in a real deployment the Dapr sidecar sits next to the app on localhost, while its database is across the network.
So instead of guessing, I measured how many times one step crosses each link. I time a workflow of 1 empty activity and one of 41. The difference, divided by the 40 extra activities, is the cost of one step, with start-up and the client's own calls cancelled out. Then I add a 5 ms delay in each direction to one link and measure again. The extra time per step, divided by the 10 ms round trip, is how many round trips a step makes on that link.
| link slowed by 5 ms each way | ms per step | round trips per step |
|---|---|---|
| Dapr, none | 11.2 | |
| Dapr, app to sidecar | 29.8 | 1.9 |
| Dapr, sidecar to Redis | 54.9 | 4.4 |
| Temporal, none | 26.7 | |
| Temporal, worker to server | 42.9 | 1.6 |
| Temporal, server to PostgreSQL | 780 | 75.4 |

On the app link the two are close: about two round trips per activity either way. The gRPC hop to the sidecar is not where Dapr spends its time, and the Temporal worker pays the same kind of hop. The databases are where they differ. I also asked the databases themselves. Redis's INFO commandstats counted 39 commands per Dapr step, sent in only about four round trips, so the sidecar batches them. PostgreSQL's pg_stat_statements counted 32.2 statements per Temporal step: three write transactions of about nine statements each, plus reads of the history and the transfer queue.
Temporal's sensitivity to its database was larger than its statement count explains. With 5 ms of delay each way the step took 780 ms, the equivalent of 75 round trips, more than twice the 32.2 statements. In a separate run with 2 ms it took 401 ms, the equivalent of 94, so it is not even proportional to the delay. The mix of statements was identical with and without the delay, so it is not a slow path such as a task backlog. I did not trace it further. What it means in practice is simple enough: put the Temporal server next to its database, and measure before you put them in different availability zones.
One number I have to correct from my process orchestration article. There I measured about 50 ms per step on Temporal and did not chase it. That was the single-binary development server, temporal server start-dev. The same test on it here took 50.2 ms per step, against 26.7 ms on the real server with PostgreSQL, on the same laptop. Do not benchmark Temporal on the development server.
Read these numbers for their shape, not their size. They are one laptop, one workflow at a time, empty activities. A step that calls a payment provider takes hundreds of milliseconds of its own, and a workflow that waits days for a parcel does not care whether a step costs 11 ms or 27 ms.
A puzzle: the timeout that made it worse
After reading the hang result, a colleague adds a 30-second timeout to the payment client inside the Dapr charge activity, so that a hung call throws instead of waiting forever. The retry policy is unchanged: three attempts. A week later the provider has a bad afternoon and starts answering after 40 seconds. It processes every charge it receives; it is only slow to reply. How many times is each affected customer charged, and what does the workflow report?
The answer
Three times, and the workflow reports that the charge failed. Each attempt sends the charge, gives up after 30 seconds, and throws. The provider still processes the charge 10 seconds later. The retry policy sees a failure and tries again, three times in all, then the activity fails and the saga fails with it, unless compensation runs on failure. The client timeout turned a slow success into a reported failure, and the retry policy turned that into three charges. That is the Temporal hang result again, reproduced by hand on Dapr, and the repository has it as a test: with a 1 s client timeout and a provider that answers after 5 s, the saga charged three times and failed. The same test with the safe saga charged once, refunded once and ended cancelled. Neither engine can know whether a side effect happened when the call to it did not return. Only an idempotency key can make the retries safe, and only compensation that runs on an unknown outcome can make the failure honest.
When to reach for which
- You already run Dapr for service invocation, pub/sub or state, and your workflows are short and live inside one service: Dapr Workflow runs its engine inside the sidecar you already have, though it does add the Scheduler and Placement services, both replicated in a highly available setup, and a state store with transactions. Budget for a repeated activity on every deploy or restart that catches one running, make the worker wait for its running activities before it closes, write every activity to be idempotent, and put your own timeouts on everything an activity calls.
- Workflows belong to no single service, run for weeks, or someone needs to see and fix stuck ones: a Dapr workflow's activities can call any other service, but its code and state live with one app. Temporal's separate server, task queues and tooling are built for that. Set start-to-close timeouts from real data, add heartbeats to anything slow, shorten the sticky queue timeout if crash recovery matters, and never treat an activity timeout as a failure without compensation.
- The network between app and engine is unreliable, mobile, edge, a flaky cross-region link: Temporal's timeout model rides out short breaks without repeating work. Dapr's sidecar sits on localhost, so this matters less there, but a deploy or a restarted sidecar still repeats the running activity.
- Either way, the database decides your latency more than the engine's API does. Measure its round trips before you choose where it lives.
They are not one-to-one replacements. They make the same promise, at least once, and keep it in opposite ways.
Scope and how this was checked
./run.sh runs 24 tests on Temurin JDK 25 in a Docker image pinned by digest, against Dapr 1.19.1 (daprd, Placement, Scheduler) with Redis 8.10.2, and Temporal Server 1.32.2 with PostgreSQL 18.7, all pinned by digest, using the Dapr Java SDK 1.19.1 and the Temporal Java SDK 1.41.1. Toxiproxy 2.13.0 sits on every link. Workers that crash run in their own JVM and are killed with destroyForcibly, and containers are stopped with no grace period. A file standing in for the payment provider records each side effect, and the assertions read that file.
The failure tests assert only results that came out the same in every one of six runs or more. The remedy tests ran on the final code with everything else. The exploration that produced them, including the Temporal server restart and the ten-second PostgreSQL cut that did not, is in runs/ and in the tests tagged explore.
The limits. Each engine is a single node. I did not test Dapr on Kubernetes, where the sidecar shares a pod with the app and shuts down with it, nor Temporal in a real cluster. Nor did I change the saga's code under running instances: both engines replay history, so a deploy that changes the steps of a workflow still in flight needs each engine's versioning, Workflow.getVersion in the Temporal Java SDK, isPatched and named workflow versions in Dapr's. Redis is not a production actor store, as Dapr itself warns. The latency figures come from one laptop running everything in Docker, one workflow at a time. Having both SDKs in one build required pinning a single gRPC and Jackson version, which a real service would not need. And I did not trace why Temporal's step time grows faster than its statement count when the database is slow.