Skip to content

Capacity planning for transaction systems

B2Bnetwork team · · 6 min

System performance

In brief

Capacity planning answers the question of how many resources a transaction system needs to meet its requirements at forecast traffic, with headroom for failure and growth. It starts by converting a business forecast into transactions per second at the peak, then a test measures the capacity of a single node and the resource that runs out first. The plan accounts for the nonlinear growth of response times at high utilization, the loss of one node, batch jobs overlapping with traffic, and external limits.

From a business forecast to transactions per second

A capacity plan starts with business figures translated into traffic at the worst moment, not the average one. The average daily number of transfers, orders, or billing records says nothing about the peak, because traffic is distributed unevenly: in banking the peaks fall on payday and the end of the month, in retail on promotions, in an operator's billing on the close of the billing cycle.

An example calculation, explicitly illustrative: a bank forecasts 3 million transfers on its busiest day. Last year's traffic analysis shows that 12% of the daily volume passes in the peak hour, and in the peak 5 minutes of that hour the traffic is half as high again as the hourly average.

  • peak hour: 3,000,000 × 0.12 = 360,000 transfers, which is 100 per second,
  • worst 5 minutes: 100 × 1.5 = 150 transfers per second,
  • plus growth over the plan horizon, e.g. 20% a year for two years: 150 × 1.2 × 1.2 = approx. 216 transfers per second.

This last figure, not the daily average, is the input to further calculations and to the tests.

Little's law: how many transactions are in the system at once

Little's law links three quantities: the average number of transactions in the system (L), the rate at which they arrive (X), and the average time spent in the system (W): L = X × W. It lets you calculate how many threads, connections, or sessions must be available.

An example: at 216 transfers per second and an average service time of 0.25 s, there are on average 216 × 0.25 = 54 transfers in the system at once. If each one holds a database connection for its whole service time, the connection pool across the entire cluster cannot be smaller than several dozen, and with headroom for fluctuations and for longer service times under load it should be clearly larger. The same calculation shows what happens when the service time doubles: the number of transactions in the system also doubles, and the pool may be exhausted.

Resource utilization and response times

Response time does not grow linearly with resource utilization. In a simple single-server queue model, the response time R is S / (1 − U), where S is the service time itself and U is the resource utilization. For a service time of 50 ms:

UtilizationResponse time in the model
50%100 ms
80%250 ms
90%500 ms
95%1,000 ms

Real systems are not this simple, but the shape of the curve holds: above a certain level of utilization, a few percent more traffic doubles response times. That is why the plan is not built on 100% of the resource utilization measured in the test, but on the level at which response times still meet the requirements, usually with a clear margin.

Node capacity, the critical resource, and headroom for failure

You measure the capacity of a single node with a load test, rather than calculating it from hardware specifications. The test raises traffic in steps and yields two figures: the throughput at which the node still meets the requirements, and the resource that runs out first. In transaction systems this resource is rarely the CPU of the application servers. More often it is:

  • the database, shared by all nodes, which does not grow along with the application servers,
  • locks on hot rows and long transactions,
  • connection and thread pools,
  • external limits: payment gateway throughput, licenses counted per core or per transaction, partner API limits.

How to look for bottlenecks on the database side is described in the article Database bottlenecks.

You calculate the number of nodes with headroom for losing one of them. If the system is to keep running when one of three nodes fails, the remaining two must carry the entire peak traffic, so in normal operation each node can be loaded to at most two thirds of its measured capacity. Scaling is also rarely linear: a scalability test shows how much each additional node really gives before a shared resource becomes the limit.

Batch jobs, windows, and plan review

In transaction systems, online traffic overlaps with batch work: interest calculation, end-of-day close, invoice generation, export to the data warehouse. A capacity plan must account for the worst overlap, e.g. a month-end close on payday, or a tariff recalculation in billing while customers are actively using the application. A test that checks online traffic without batch jobs overstates the system's capacity.

A capacity plan is not a document for all time. You review it:

  1. after every major peak, comparing the forecast, the actual traffic, and resource consumption,
  2. before a change that alters the cost of a transaction: a new feature, a database migration, an architecture change,
  3. periodically, e.g. every quarter, based on the trend from production monitoring.

The best input to a review is production data: transaction rate, response times, and resource utilization in the same time window. How to collect it is described in the article Observability: logs, metrics, and traces. An example of performance testing before a change that increases traffic is the case study Performance testing of a billing system during a tariff change.

Questions and answers

How does capacity planning differ from performance testing?

A performance test measures how a specific version of the system behaves under a given traffic. Capacity planning uses test results, business forecasts, and production data to decide how many resources will be needed in the future and when to add them. The test supplies measurements; the plan translates them into infrastructure and budget decisions.

Does cloud autoscaling replace capacity planning?

No. Autoscaling adds application servers, but it does not add capacity to the shared database, does not raise partner limits or licenses, and reacts with a delay to a sudden traffic spike. A capacity plan still has to identify the critical resource, the upper limit of scaling, and whether autoscaling will keep up before the peak.

How much capacity headroom should I assume?

The headroom comes from three components: resilience to the loss of a node, forecast uncertainty, and the response time curve at high utilization. There is no single number for all systems; you set the headroom so that at the forecast peak and with one node down, response times still meet the requirements measured in the test.

Where do I get a traffic forecast when the system is new?

From the data of the system the new one replaces, from sales plans, and from comparison with similar channels. With high uncertainty, you plan two or three forecast variants and use a test to check at which of them the system stops meeting the requirements. After launch, you update the plan based on the first weeks of production traffic.

What it looks like in a project

Your system slows down under load? We'll find where it loses time.

Let's talk

Read more: System performance