Scaling Temporal Server services: when a self-hosted cluster needs more capacity
A self-hosted Temporal cluster needs more capacity when one of its server services becomes the bottleneck, and the fix is to add instances of that service, not of the whole cluster. The four server services, frontend, history, matching and worker, scale independently, so the first task is to identify which one is saturated. Rising latency, growing backlogs or throttled requests point to different services, and adding replicas to the wrong one spends money without relieving the pressure. Before changing anything, record the current replica counts, resource use and latency for each service so you can compare the result of each change.
The frontend service is stateless, so it is the simplest to scale: add replicas behind your load balancer and confirm that client traffic spreads across them. The history service is different because each history process owns a set of history shards, and the shard count is fixed when the cluster starts. History capacity therefore grows by adding history instances and letting shards redistribute, within the limits set by the shard count you chose. Matching hosts the task queues that route work to workers, and the worker service runs Temporal's own internal system workflows. Confirm the replica ratios and shard assignment behavior for your exact Temporal Server version in the self-hosted deployment guide before you size a cluster, because these ratios change between releases.
Plan each scaling step as a change you can reverse and verify. Upgrade the server one minor version at a time, because backward compatibility is guaranteed only between successive minor versions, and check that your Helm chart version matches the server image, since chart versions below 0.73.1 do not work with server images 1.30 and later. Confirm that persistence has headroom for the added history and matching traffic, since database load often grows before server CPU does. Then retest after each change with a load profile close to your real peak. Record the outcome in your capacity runbook so the next engineer can see which service was the constraint and why.
How the Temporal server services and persistence fit together
The diagram starts with SDK clients and workers, which call the stateless frontend service. The frontend routes requests to the history service, which owns shards, and to the matching service, which serves task queues. Both rely on the persistence database, and advanced visibility is an optional store beside it. Check that the trust boundary holds, since self-hosted services should not be reachable from the public internet, and that each service can be scaled on its own.
Request flow between clients, the Temporal services, and their stores.
Which service to scale, and what fits each choice
This table compares the frontend, history, matching and worker services by role, scaling behavior, what to watch and when to add capacity. Read each row as a question to answer for your own cluster before changing replica counts, since the documented detail for each service should be confirmed in the deployment docs for your server version.
| Service | Role | Scaling behavior | What to watch and when to scale |
|---|---|---|---|
| Frontend | Entry point for client API calls, including rate limiting and authorization checks | Stateless, so replicas can generally be added behind a load balancer; confirm the exact pattern in the deployment docs | Request latency and error rates at the API edge; add replicas when latency rises under sustained client load |
| History | Owns workflow state and event histories for the shards assigned to it | Shard ownership is spread across history processes; the shard count is fixed at cluster creation, so capacity grows by adding processes up to that limit | Shard distribution across hosts, persistence latency and history service CPU; plan growth against the shard count chosen at cluster start |
| Matching | Manages task queues and delivers tasks to polling workers | Task queue partitions spread load across matching hosts; confirm partition settings and how they interact with replicas in the docs | Schedule-to-start latency, task backlog per queue and poller counts; add matching capacity when backlogs grow while workers have free slots |
| Worker (Temporal system workers) | Runs internal background tasks for the server, separate from your application workers | Scales with the server deployment; confirm which system workflows run and their resource needs for your version | Errors in system workflow logs and resource pressure on the pod or host; scale when internal jobs fall behind |
| Application workers | Run your workflow and activity code on task queues you own | Scale independently of the server by adding or removing worker processes on your own infrastructure | Schedule-to-start latency and slot usage; this is usually the first place to add capacity when task pickup slows |
How the 500-shards-per-history-process starting point works
The shard count is fixed when the cluster starts. Temporal sets numHistoryShards once, and every workflow execution is assigned to one of those shards by its workflow ID. Changing the number later means building a new cluster, so the value is a capacity decision you make before the first workflow runs. The history service then owns the shards and distributes them across its history processes. Per-process load therefore depends on two numbers together: how many shards exist and how many history processes share them. Adding history processes spreads existing shards more thinly, but it does not add shards.
The rule of thumb of one history process per 500 shards is a starting point, not a sizing rule. It gives you an initial history process count to deploy and measure, nothing more. Actual capacity depends on your workflow throughput, history event sizes, the persistence layer's latency and how many workflows are open at once. A cluster with a low event rate can run comfortably at a different ratio, and a busy one may need more history processes per shard. Treat the figure as the first point on a load curve, and confirm your history process count against the current Temporal self-hosted deployment guide and your own test results.
Validate the ratio with load tests before production, and watch history service latency, persistence latency and shard movement as load grows. Use the Choosing the Temporal history shard count decision as the place to set numHistoryShards, because that choice is irreversible and drives everything here. The sibling topic on load testing with Omes covers how to turn results into node counts. Ask your team to record the shard count, the history process count and the measured headroom in the design record, so a future scale-out decision starts from evidence rather than from this starting figure.
What to watch as load grows
Each signal below points to one Temporal Server service or to the storage behind it. Read them together: a slow persistence database often shows up first as history latency, and a backlog in matching can look like a worker problem. Check them in this order when scaling a self-hosted Temporal Service.
Frontend request latency and errors
The frontend is the stateless entry point for every client and worker call, so its latency and error rates show the load arriving at the cluster. Rising latency with healthy backends usually means the frontend pool needs more replicas. Watch for error codes that signal throttling or resource exhaustion, and compare them against the per-host and per-namespace rate limits you have configured before adding capacity. Points to: the frontend service.
History shard and persistence latency
History services own the workflow state machines, and each one handles a set of history shards. Rising shard operation latency means history is waiting on work it cannot process quickly, either from too much work per process or from slow writes underneath. Check shard ownership balance across history pods after any scale change. Points to: the history service, with the persistence layer as the likely cause.
Matching task queue backlog
Matching holds the task queues that workers poll, so a growing backlog means tasks are arriving faster than pollers take them. Compare the backlog against the number of pollers per task queue and the number of partitions it runs on. A backlog that clears only when workers are added points to worker capacity, while one that persists points to matching or partition configuration. Points to: the matching service.
Schedule-to-start latency
Schedule-to-start latency measures the time between a task being queued and a worker picking it up. It is the clearest user-facing sign that matching or worker capacity is falling behind demand. Track it per task queue so a single busy queue does not hide behind a healthy average. Points to: matching first, then the worker fleet.
Worker slot saturation
Worker slots limit how many activities and workflow tasks a worker runs at once. When slots stay fully used, pollers wait and schedule-to-start latency climbs even though the Temporal Service is healthy. Check slot usage per worker deployment and whether adding worker replicas relieves it. Saturated slots mean the bottleneck is in your worker fleet, not the server. Points to: your worker deployment.
Persistence database load and visibility indexing lag
The persistence database receives every state write, so its connection use, query latency and lock waits set the ceiling for the whole cluster. Visibility indexing lag, the delay before workflow executions appear in list and search results, is a separate signal on the visibility store, usually Elasticsearch or OpenSearch. Confirm both limits with your database and search vendors before sizing, since the exact thresholds depend on your deployment. Points to: the persistence database and the visibility store.
How to scale the services in a safe sequence
This sequence turns a scaling concern into a tested change: it confirms the server and chart versions first, measures a baseline, proves the change in staging, and then scales only the service the metrics point to.
Confirm server version and chart compatibility
Record the Temporal Server version, the server image tag, and the Helm chart version your cluster runs, then check them against the Temporal deployment documentation. Helm chart versions below 0.73.1 do not work with server images 1.30 and later, so an older chart can block any change before you start. Confirm whether the target server version is a patch on your current minor line or requires a minor upgrade, because the upgrade docs say to move one minor version at a time and to run schema upgrades before server upgrades when release notes call for it. Done when the version matrix is written down and every component is on a supported combination. Ask your platform team to keep this record with the change ticket.
Establish baseline metrics for each service
Before changing anything, capture the metrics your team uses for each of the four services: frontend, history, matching and worker. Record request latency, error rates, CPU and memory per pod, and persistence latency for the database and visibility store, under a representative load window. Note the current replica counts, shard count, and any rate-limit or throttling signals. Done when you have a dated baseline dashboard or export that another engineer can read without asking you what it means. Without this record, you cannot later show that a change helped or caused a regression.
Load test a staging cluster that matches production
Reproduce peak traffic in a staging environment that uses the same server version, chart, shard count, and persistence and visibility stores as production, and run a load test with Omes or a custom scenario. The staging cluster should differ from production only in scale, so results carry over. Run the test at the expected peak and at a higher level to find the first bottleneck. Done when the test report names the saturated component and the metric that showed it. Staging and production should not share the same database, so test writes stay isolated.
Scale the service the metrics point to
Change only the service that the baseline and load test identify as the limit. A frontend bottleneck usually calls for more stateless frontend replicas. Pressure on history calls for history capacity, which is bounded by shard distribution across history pods. Matching pressure or schedule-to-start delays point to matching and worker capacity. Change one service per run, keep the other settings unchanged, and record the new replica count in the change log. Done when the same load test shows the target latency and error rate for that service, and the other services are not newly saturated.
Add capacity to persistence and visibility when they limit
If the load test or production metrics show latency or throttling in the persistence store or the advanced visibility store, add capacity there rather than adding more Temporal service replicas. Supported persistence options include Cassandra, PostgreSQL and MySQL, and supported advanced visibility options include Elasticsearch, OpenSearch, MySQL, PostgreSQL and SQLite for development. Confirm the exact version support for your server release in the persistence and visibility documentation, and size the store with your database team. Done when persistence and visibility latency sit back within the baseline range under the same load test. SQLite is for development and testing only.
Recheck the cluster against the baseline
Rerun the same load test and compare the results with the baseline and with the previous step. Check the latency and error metrics on all four services, persistence and visibility latency, and the schedule-to-start signals for workers. Confirm that the change did not move the bottleneck to another component. Done when the staging report shows the target met and no new saturation, and the production change plan lists the exact replica and store settings to apply. If the bottleneck moved, return to the step that names the new limit.
Apply the change in production with the upgrade order
Apply the verified change in production during a planned window, using the same version and chart that you tested. If the change is bundled with a server or schema upgrade, follow the documented order: upgrade one minor version at a time, move to the latest patch of the current minor first, run schema upgrades before server upgrades when the release notes require them, and keep the chart compatible with the server image. Done when production metrics match the staging results within the baseline range for a full load window, and the change record shows the version, chart, replica counts and store settings in effect.
Security and operational considerations while scaling
Every node you add to a Temporal Service is another process that can receive traffic, hold credentials and change the database. The cards below cover the controls to apply to new instances and the safeguards to take before topology changes, so that scaling does not widen exposure or leave you without a recovery point.
Keep new hosts off the public internet
Temporal services should run on hosts that are not reachable from the public internet, with network access limited to trusted internal networks. When you add frontend, history, matching or worker hosts, place them in the same private segments and confirm that load balancers, security groups and firewall rules expose only the frontend endpoint your clients need. Check the rules on every new instance, not only the first ones you built, because scaled-out capacity is often provisioned from a template with looser defaults.
Deployment docsConfigure mTLS on every new instance
Self-hosted Temporal supports mTLS with separate settings for internode traffic and frontend traffic. Each new history, matching or frontend instance must present a certificate that the rest of the cluster trusts, and the internode settings must match the existing members, or the new process will fail to join or will accept connections it should not. Ask your platform team how certificates are issued and rotated for new hosts, and test a join in a non-production cluster before you scale production.
Security docsReplace the default authorizer on added frontends
If no Authorizer is configured, self-hosted Temporal uses the default noopAuthorizer, which allows every API request with no authentication or access control. A new frontend instance that inherits a configuration without an Authorizer exposes the same unrestricted API as the default, and a load balancer will send clients to it without warning. Before a frontend goes into rotation, confirm that its configuration sets the Authorizer, the ClaimMapper and the namespace roles you intend, and that an unauthenticated call is refused.
Security docsUpgrade one minor version at a time
Backward compatibility is guaranteed only between two successive minor versions, so a topology change that also moves the server version should be split into steps. Move each instance to the latest patch of the current minor line first, then to the next minor, and run any schema upgrade the release notes require before the server binaries change. Keep all services on compatible versions during the rolling process, and record the version of every host, because a mixed fleet is the state most likely to surprise you during an incident.
Upgrade guideBack up persistence before changing topology
Adding or removing history or matching hosts does not change the shard count, but it changes which process owns each shard, and any failed operation or schema change can leave the cluster in a state that is hard to reverse. Take and verify a backup of the persistence store, whether Cassandra, PostgreSQL or MySQL, before each change, and confirm that you can restore it into a test environment. Write down the rollback step for each stage of the rollout so that the decision to revert is made before the pressure of an incident.
Persistence docsCheck the Helm chart version
Helm chart versions below 0.73.1 do not work with server images 1.30 and later. If your deployment runs Temporal services in individual Kubernetes pods, confirm the chart version before you change replica counts or image tags, since a chart that predates the server image can render settings that the newer services reject. Pin the chart and image versions together in source control, and review the rendered manifests for each new service before applying them.
Deployment docsQuestions buyers ask about scaling Temporal services
Can the Temporal frontend be scaled horizontally?
Yes. The frontend service is stateless, so you can run more frontend instances behind a load balancer as API traffic from workers and clients grows. Scaling it does not change how workflow state is stored or partitioned. The limits you will hit first are usually elsewhere: history shard ownership, persistence throughput and per-host or per-namespace request limits. Before adding frontend capacity, confirm in your metrics that the frontend is the bottleneck, and check that the load balancer and TLS termination in front of it are not the constraint. The deployment docs for self-hosted Temporal describe running each service as its own set of pods, which is what makes independent scaling practical.
Why can't the history shard count change after the cluster starts?
The history shard count determines how workflow state is partitioned across the history service and the database. Each workflow execution is mapped to a shard by its ID, and that mapping is baked into stored data, so changing the count would move executions to shards that do not hold their state. For that reason the number is set when the cluster is created and treated as fixed. Planning it is a one-time decision with long consequences, so it belongs in the design phase, alongside the database choice and expected growth. Your team should confirm the current guidance in the Temporal documentation for your server version before choosing a value.
What drives the cost of extra nodes and persistence capacity?
Costs fall into three groups. Compute covers the frontend, history, matching and worker nodes, and it rises with request volume, workflow throughput and the number of shards each history process owns. Persistence covers the database that backs workflow state, including storage growth from retained history and the IOPS and connection capacity needed under load. Visibility covers the search store, which is recommended for anything beyond a few workflow executions and adds its own nodes and storage. Most of these costs recur monthly, while sizing, tuning and staging validation are one-time. When requesting a quote, ask the partner or your own team to separate compute, database, visibility and retention assumptions so each line can be checked against your workload profile.
How long does a sizing exercise take, and what changes its duration?
Duration depends mostly on how much representative load data you already have and how many environments you must test. A team with production metrics and a staging cluster that mirrors production can move through baseline, load test and tuning faster than one starting from scratch. Duration grows with the number of workload shapes you must model, such as high-volume short workflows, long-running workflows with many timers and bursts of activity retries. Load test cycles, database tuning and repeated runs after each change also take time. A written scope should list the workloads, environments, metrics and acceptance criteria, which is the best basis for asking a partner for a timeline.
What must our team provide before sizing starts?
The sizing work depends on four inputs. First, production or pilot metrics for workflow starts, activity throughput, task queue latency and database latency, covering at least several representative periods. Second, workload profiles describing workflow types, history length, timer and signal patterns, payload sizes and peak-to-average ratios. Third, a staging environment with the same Temporal server version, database engine and network layout as production, so results transfer. Fourth, named owners who can approve configuration changes and database capacity. Without these, load tests measure a synthetic workload that may not match what production sees. Confirm with your platform team which metrics your current monitoring already exports before the scope is written.
Can our in-house platform team size and scale Temporal themselves?
Often yes, if the team already runs stateful databases, Kubernetes or similar infrastructure and has at least one engineer who knows Temporal's service architecture well. The work requires load generation tooling, metrics analysis, database tuning and disciplined change control. The harder part is usually time: sizing competes with feature delivery, and the first serious load test tends to surface problems in persistence, visibility or worker configuration that take experience to diagnose. A useful self-assessment is whether your team can already explain the difference between schedule-to-start latency and workflow execution time, and whether it has a staging environment it can load test without disrupting production.
When is it worth bringing in an implementation partner for Temporal scaling?
A partner is worth considering when the first production cluster is business-critical, when the planned workload is large or uncertain, or when your team lacks someone who can run load tests and interpret the results. It is also useful before a major change, such as a database engine switch, a server upgrade across minor versions or a move to a multi-tenant design. DeployOpen plans, implements, tunes and documents self-hosted open-source platforms in infrastructure you control, so a fixed-scope sizing engagement can cover the workload model, load tests, configuration and runbooks. Ask for the written scope, deliverables and acceptance criteria before work starts, and retain ongoing support only if your operating model needs it.
How DeployOpen scopes and delivers Temporal scaling work
DeployOpen scopes Temporal scaling work as a fixed-scope engagement with the scope, deliverables and timeline agreed in writing before any work starts. The first stage is a baseline review of the running cluster: which Temporal Server version is deployed, how the frontend, history, matching and worker services are laid out, which persistence store and advanced visibility store back them, and how the numHistoryShards value was chosen. The review also records the metrics you already collect, such as schedule-to-start latency and persistence latency, so later changes can be compared against a known starting point. Because the Temporal Server release line has its own upgrade rules, the review confirms the current version and any pending patches before sizing begins. Ask the partner to name the exact artifacts this stage produces, including the configuration snapshot and the list of open questions for your team.
The second stage turns that baseline into a load test plan and sizing recommendations. The plan states which workflow mix, peak rate and namespaces are under test, which metrics decide pass or fail, and which settings are changed between runs, such as the number of frontend or history replicas and the worker counts. Sizing recommendations then cover service counts per role, resource requests for each pod or process, and the conditions under which you should add history capacity or revisit the shard count, which is fixed once a cluster starts. The engagement closes with a runbook handover that covers scaling procedures, alert thresholds, rollback steps and the checks your operators run after a change. Confirm with any provider whether load generation runs in your environment, who owns the test data, and what retesting is included before a recommendation is accepted. Ongoing support, upgrades and continuous load testing are available as a retainer once the handover is complete.

