---
title: "Performance"
description: "A Temporal Worker caches Workflow state in memory, while a Dex Worker reads saved state from Dex Server and caches large values on disk. A measured Worker memory benchmark with both engines, and the write and read path of each server."
canonical_url: "https://docs.superdurable.io/intro/compared-to-temporal/performance/"
source: "docs/content/intro/compared-to-temporal-performance.mdx"
locale: "en"
---

> Index of every page for AI agents: https://docs.superdurable.io/llms.txt

# Performance

A Temporal Worker caches Workflow state in memory, while a Dex Worker reads saved state from Dex Server and caches large values on disk. Dex Server writes to a log in object storage and serves reads from local disk, while the Temporal services read and write a database.

<a id="worker"></a>

## Worker memory and CPU

[Watch on YouTube](https://youtube.com/shorts/qjeMoeRau7M): Why Temporal Workers run out of memory and Dex Workers do not

> **Diagram**: Where each Worker keeps its cache, what limits it, and what a miss costs.

|           | Temporal Worker                                                       | Dex Worker                                                  |
| --------- | --------------------------------------------------------------------- | ----------------------------------------------------------- |
| Cache     | Workflow cache in memory: the state of each cached Workflow Execution | Blob cache on disk: copies of large values                  |
| Limit     | A count of Workflow Executions, 1,000 by default in Python            | Bytes, 1 GiB in the benchmark                               |
| On a miss | The evicted Workflow Execution is replayed from its Event History     | The value is downloaded again; state is saved in Dex Server |

**Temporal.** With [Sticky Execution](https://docs.temporal.io/sticky-execution), "the Worker caches the Workflow state in memory". Every SDK limits the cache by a count of Workflow Executions. The defaults are 10,000 in Go and .NET, 600 in Java, and 1,000 in Python, and TypeScript derives its default from the heap size ([Worker tuning reference](https://docs.temporal.io/develop/worker-tuning-reference)). No SDK option limits the cache by bytes or puts it on disk. An evicted Workflow Execution is replayed from its Event History on its next task.

**Dex.** Dex saves Attributes with each Step, so a Worker needs no history cache to continue a Flow. Dex sends a large value as a reference, and the SDK reads it through the [blob cache](https://docs.superdurable.io/components/application.md#blob-cache), a local directory with a byte limit. [Sticky routing](https://docs.superdurable.io/reference/server/workers.md#routing-and-availability) offers a Flow's next task to the Worker that served it before, for up to 5 seconds.

> **Diagram**: Worker working set in MiB over the seconds after the customers start to return, with a 512 MiB container limit. Temporal with the default cache climbs to the limit within about 90 seconds, stays there, and is killed for running out of memory at 330 seconds; after the restart it climbs back to the limit. Dex peaks at 85.5 MiB and answers all 3,000 follow-up messages.

The benchmark first filled 1,200 conversations, each with 40 exchanges of 8 KiB messages. Then 1,000 of them came back at 4 per second, and each sent 3 follow-up messages, 3,000 in all. The Worker ran in a container with 2 CPUs and no swap, with the Python SDK on both sides. Memory is the container's working set, as `docker stats` shows it. The Dex line ends earlier because sampling stops after a run's last reply. Each configuration ran once. The data of every run is in [bench/results](https://github.com/superdurable/dex-vs-temporal-demo/tree/f5aa9f90a5c4a51ae86387e13a5d0d48bb31bb3a/bench/results).

| Configuration                                  | Peak working set       | Mean CPU (100% is one CPU) | Follow-up messages answered |
| ---------------------------------------------- | ---------------------- | -------------------------- | --------------------------- |
| Temporal, default cache (1,000), 512 MiB limit | 512.0 MiB, 1 OOM kill  | 176.2%                     | 1,042 of 1,757 sent         |
| Temporal, cache of 50, 512 MiB limit           | 511.8 MiB, 2 OOM kills | 180.8%                     | 1,493 of 2,130 sent         |
| Temporal, cache of 50, 2 GiB limit             | 581.6 MiB              | 36.3%                      | 3,000 of 3,000              |
| Dex, 1 GiB blob cache, 512 MiB limit           | 85.5 MiB               | 17.7%                      | 3,000 of 3,000              |
| Dex, 1 GiB blob cache, 2 GiB limit             | 79.8 MiB               | 17.4%                      | 3,000 of 3,000              |

At the 512 MiB limit, the Temporal Worker was killed with the default cache and with a cache of 50, which also had 1,186 cache misses and 2,497 forced evictions. Temporal answered every message only with a 2 GiB limit, and its cache of 50 then had 1,980 misses. The Dex Worker stayed under 100 MiB at both limits.

<a id="server"></a>

## Server throughput

[Watch on YouTube](https://youtube.com/shorts/xZtFv4mOS04): How Dex works internally

> **Diagram**: Temporal: Workers and Clients call the Frontend, History, and Matching services, which read and write a database (Cassandra, MySQL, or PostgreSQL); the History service keeps in-memory caches. Dex: Workers and Clients call the active Dex Server node, which batches the writes of many Flows, writes them to a log in object storage, and then applies them to a local store that serves reads from local disk. A hot standby follows the log.

**Temporal.** The [History service](https://docs.temporal.io/temporal-service/temporal-server) persists Workflow state and events in the [database](https://docs.temporal.io/temporal-service/persistence), Cassandra, MySQL, or PostgreSQL, and keeps in-memory caches.

**Dex.** [Dex Server](https://docs.superdurable.io/components/server.md#how-it-works) writes each change to a log in object storage, then applies it to a local store. A started Flow or a SYNC Step result is in object storage before Dex reports it. Reads of current state come from local disk. The writes of many Flows share one log write: a busy node made 23 to 98 log PUTs per second in the [benchmark](https://docs.superdurable.io/intro/performance.md). History moves to object storage by default ([History offload](https://docs.superdurable.io/reference/server/configuration.md#history-offload)). A [hot standby](https://docs.superdurable.io/reference/server/high-availability.md#hot-standby) follows the log and takes over after the lease ends, 10 seconds by default.

The table gives the peak throughput of one Dex Server node on AWS, with its log in S3 Standard. [Performance](https://docs.superdurable.io/intro/performance.md) gives the conditions and the latency.

| Operation                                        | c7gd.large (2 vCPU) | c7gd.4xlarge (16 vCPU) |
| ------------------------------------------------ | ------------------: | ---------------------: |
| SYNC Steps                                       |             1,772/s |                8,403/s |
| ASYNC Steps                                      |             2,105/s |                10.1k/s |
| Flows started and completed, one Step each       |             1,111/s |                5,626/s |
| RPCs that read one Attribute                     |            15,392/s |                67.3k/s |
| RPCs that lock and update one Attribute          |             2,165/s |                13.8k/s |
| Reads of ten 16 KiB Attributes, without a Worker |             5,941/s |                11.3k/s |

Temporal Cloud limits a Namespace to 500 actions per second by default ([Temporal Cloud limits](https://docs.temporal.io/cloud/limits)).

## Next

- [Operations](https://docs.superdurable.io/intro/compared-to-temporal/operations.md): what you deploy, size, and code around on each side.
- [Performance](https://docs.superdurable.io/intro/performance.md): how the Dex Server benchmark ran, its latency, and what it costs to run.
