Repository navigation
Support separate read connection for archival history reads #12466
apoorvam1
started this conversation in
Temporal Backend
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
Temporal's archival system reads full workflow histories from the database via ExecutionManager.ReadHistoryBranchByBatch using the same connection pool as the main execution path. In deployments with database read replicas (e.g., Aurora with 1 writer + 2 readers), archival reads compete with execution reads and writes on the writer node — even though archival only reads closed, immutable workflows where replication lag is harmless.
The ExecutionManager injected into the archiver provider (common/resource/fx.go) is the same singleton used by shard, execution, and task stores. All reads and writes go through a single ConnectAddr per datastore. There's no mechanism to configure a separate connection for read-only operations like archival. This means read replicas sit idle from Temporal's perspective, while archival load (which can spike during backlog catch-up with large histories) contends with latency-sensitive execution operations on the writer.
Describe the solution you'd like
Allow configuring an optional read-only datastore connection for archival history reads:
This would reduce read load on the primary database with zero correctness risk, since archived workflows are immutable and not latency-sensitive. Archival already runs at preemptable priority and is rate-limited to 15% of persistence RPS (archivalQueuePersistenceMaxRPSRatio = 0.15) — offloading it to a replica would free that budget on the writer for execution operations.
Describe alternatives you've considered
Additional context
All reactions