Skip to content

Capacity testing before cloud migration: how much infrastructure you really need

B2Bnetwork team · · 6 min

System performance

In brief

How many resources you need in the cloud does not follow from what your on-premises server has today. It follows from measuring what the system really uses at peak, and from a capacity test in the target cloud that shows how many transactions one machine of a given type can handle. A one-to-one copy of the configuration usually gives you too many CPUs and too slow disks, because in the cloud disk and network performance depend on the type and size of the resource. A test before migration turns guesswork into numbers and a cost estimate.

Why "the same as today" does not work

The simplest migration plan goes: the server has 16 cores and 128 GB of memory, so in the cloud we take a 16 vCPU, 128 GB machine. That plan is wrong in both directions at once:

ResourceOn-premises serverIn the cloudWhat follows
CPUphysical cores, often with hyper-threading on or offa vCPU is usually a thread of a core, not a whole core16 vCPUs are not always 16 cores
Utilizationa server bought for five years with headroomyou pay for every hour of the resourceaverage use is often low, peaks high
Diska shared storage array, performance depends on the whole arrayperformance depends on disk type and size and the machine's limita slow disk next to a good CPU
Networkdata center linksbandwidth depends on machine sizea small machine may have too narrow a network
Burstable instancesdo not existcheap types run fast until credits run outthey look good in a short test and slow down in a long one

For example, in AWS many instance types have two threads per core by default, and each thread is one vCPU. An application that used 16 full cores on a physical server gets eight cores with hyper-threading on 16 vCPUs. Whether that is enough is settled by a test, not a table.

Step 1: measure current usage

Before converting anything, you need to know what the system uses today. Measure for at least several weeks, including month-end, a sales peak or another known peak:

  1. CPU in percentiles, not the average. A server with 15% average use may run at 90% for an hour during the month-end close.
  2. Memory actually used by the application and the database, not allocated. A database usually takes all the memory it is given, so what matters is the working set and cache hit rates.
  3. Disk operations: operations per second, throughput and disk response times at peak.
  4. Network: traffic between servers and to users, especially between the application and the database.
  5. Business traffic over the same period: transactions per second, number of users, batch jobs.

The last point matters most, because it lets you calculate resource usage per transaction. Cloud providers' migration assessment tools size machines based on such measurements, but they do not know what traffic will come next year. How to get from a business forecast to transactions per second is covered in Capacity planning for transaction systems.

Step 2: a capacity test in the target cloud

Measurement tells you what the system uses today on old hardware. A capacity test tells you what it will use on new hardware. The test plan:

  1. Deploy the target architecture in the cloud at a smaller scale: one or two application instances, the database on the target service type, disks of the target type.
  2. Run a load test with a traffic model from logs and increase traffic until one resource saturates.
  3. Calculate unit capacity: how many transactions per second one instance of a given type handles while meeting response time thresholds, and which resource runs out first.
  4. Repeat for two or three machine types, for example compute-optimized and memory-optimized. The difference in cost per transaction can be larger than the difference in machine price.
  5. Check scaling: do two instances give almost twice as much, or does the database become the bottleneck?
  6. Run an endurance test for several hours to detect CPU credit exhaustion, disk limits and performance drops over time.

Load is often generated from the cloud, in the same region as the system. What shows up on the bill in that case is covered in Cloud load testing from multiple regions.

Step 3: from capacity to cost

The test produces a number you can convert into cost: for example, one instance of a given type handles 150 transactions per second with p95 below the threshold, and the forecast peak is 600. So you need four instances at peak plus headroom for losing one availability zone, and fewer outside the peak if the system scales automatically. Then there is the database, which rarely scales horizontally and usually needs its own calculation.

When it comes to cost, remember licenses priced per core or vCPU, for example for databases. Fewer, more powerful cores can be cheaper than more, weaker ones, even when the machine costs more. Multi-year commitments with the cloud provider are worth buying only after a few weeks in production, once the sizes are confirmed. How to choose a migration strategy for each application is covered in Cloud migration strategies.

After migration: correcting with real data

A test before migration gives you a good starting point, but it does not replace production data. For the first weeks, measure the usage of each service and compare it with the test result. Provider tools such as AWS Compute Optimizer suggest resizing based on usage history. Shrinking oversized machines after a month is one of the simplest savings, and enlarging undersized ones is something you would rather not discover at the first peak.

How a migration with similar decisions runs is shown in the case studies migrating an on-premises product to a SaaS model in the cloud and migrating a bank's development and test environments to a hybrid cloud. At B2Bnetwork, pre-migration performance testing ends with a number of instances, resource types and the resource that will run out first.

Questions and answers

Is the cloud provider's migration assessment tool enough?

As a starting point, yes. These tools size machines based on measured usage and show an approximate cost. They do not check how the application behaves on a different CPU, disks and network, or with more traffic than today. Critical systems need a capacity test in the target cloud.

How long does a capacity test before migration take?

Usually several weeks, including measuring current usage, which should cover a known peak. The cloud test itself is shorter if scripts and a workload model already exist. Most of the time goes into preparing the environment and data in the cloud in the target configuration.

Does a rehost migration also need capacity testing?

Yes, although the scope can be smaller. Moving a machine without changing the application does not change the code, but it does change the CPU, disks and network. The most common surprises are a disk slower than the on-premises storage array and a burstable instance that slows down after an hour of work.

Does autoscaling remove the need for capacity planning?

No. Autoscaling adds application instances, but not the database, not licenses and not managed service limits. You need to know how many transactions one instance handles, how long a new one takes to start and where the limit of the whole system is. This is covered further in Autoscaling in Kubernetes.

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

All in System performance →