Skip to main content
emnode
Cost

Right-size underutilised Azure Database for MySQL servers

Azure Advisor flags MySQL servers that have run cold for a week and recommends halving their compute. This lesson turns that one cost recommendation into a repeatable habit: find the over-provisioned servers, prove they are genuinely idle, and scale them down without taking an outage you did not plan for.

13 min·10 sections·AZURE

Last reviewed

Right-sizing a MySQL server: the basics

What does an underutilised Azure Database for MySQL server actually cost you?

Azure Database for MySQL Flexible Server bills compute by the tier and size you pick, not by how hard the server works. A General Purpose server sized at four vCores costs the same whether it is pinned at 80 percent CPU or idling at 5 percent. Storage and backup are separate lines, but compute is usually the largest, and it is the line that a quiet server overpays on every hour of every day. The size was almost always chosen once, at provisioning time, against a guess about peak load that never arrived.

Azure Advisor watches for exactly this. Its cost recommendation 'Right-size underutilized MySQL servers' (resource type microsoft.dbformysql/servers, recommendation ID 7e76e54f-7978-4d48-9ab9-a4da5b7c69a3) fires when its telemetry shows a server has run with low resource utilisation for an extended period over the last 7 days. The recommendation is specific: reduce the compute size (vCores) by half. Advisor is not guessing that the server is idle, it is reading a week of actual utilisation and concluding the workload fits in less.

The fix is a single control-plane operation: change the server's SKU to a smaller size, or drop it to a cheaper tier such as Burstable if the workload is spiky rather than steady. The compute charge falls immediately and proportionally. The whole skill is making that change with confidence: confirming the low utilisation is the real steady state rather than a quiet week, choosing the right smaller size, and scaling at a moment when the brief restart the change requires does no harm.

In this lesson you will learn how Azure Database for MySQL Flexible Server charges for compute, how Azure Advisor decides a server is underutilised, and how to scale a flagged server down safely without provoking an avoidable outage. You will see the exact az CLI to find flagged servers and resize them, and a Bicep snippet that pins the right-sized SKU so it does not drift back up on the next redeploy.

Fun fact

The week of data that pays for itself

Advisor's right-sizing call is not a static rule of thumb, it is a reading of the last 7 days of your server's own utilisation. That short window is deliberate: it is long enough to see a full weekly cycle of business and batch load, and short enough that it reflects how the workload behaves now rather than at launch. The recommendation it produces, halve the vCores, is conservative on purpose. Microsoft sizes it so the smaller server still has clear headroom over the measured demand, which is why right-sizing a genuinely idle server so rarely causes a performance problem and so reliably shows up as a lower bill the very next month.

Finding the over-provisioned MySQL servers in a subscription

Priya runs the platform team at a SaaS company whose Azure bill has crept up quarter on quarter. The cost review keeps landing on databases, and Azure Advisor's Cost tab shows several MySQL Flexible Servers flagged as underutilised, each with the same recommendation: reduce the compute size by half.

Rather than open each server in the portal one at a time, Priya pulls the Advisor recommendations and the current server sizes together, so the team can see which servers are flagged, what they run on now, and which ones are worth resizing first.

List the MySQL right-sizing recommendations Advisor has raised, so you are working from Azure's own measurement rather than a hunch.

$ az advisor recommendation list --category Cost \ --query "[?contains(impactedField, 'DBforMySQL')].{server:impactedValue, action:shortDescription.solution}" -o table
Server Action
---------------- -----------------------------------------
orders-prod-mysql Right-size underutilized MySQL servers
reporting-mysql Right-size underutilized MySQL servers
# Two servers flagged. Check their current SKU before resizing.

Start from Advisor's own list. Each flagged server has run cold for a week by Azure's measurement, so it is a real candidate rather than a guess.

How Advisor decides a MySQL server is underutilised, and how compute is priceddeep dive

Azure Database for MySQL Flexible Server compute is defined by two properties on the server: the tier (Burstable, GeneralPurpose or MemoryOptimized) and the SKU name (the size, following the Standard_{VM name} convention, for example Standard_D2ds_v4). The SKU name encodes the vCore count and memory. Your hourly compute charge is set by that pair. Advisor's recommendation, reduce the compute size by half, is a recommendation to move to a SKU name with half the vCores within the same tier, or in some cases to drop to a cheaper tier entirely, and the charge follows the new size from the moment the change takes effect.

Advisor builds the recommendation from its own internal telemetry of the server's resource utilisation over the last 7 days. When that utilisation stays low for an extended period of the window, it concludes the workload fits comfortably in less compute and raises the recommendation against the server, with a medium impact rating and the resource type microsoft.dbformysql/servers. The 7-day window is chosen to capture a full weekly cycle, so a server that is busy only on a Monday batch run is judged on that peak, not on a quiet Sunday.

Scaling compute is a control-plane change to the server's SKU. It takes effect quickly but does involve a brief restart of the database engine as the server moves to the new compute, so existing connections drop and reconnect. This is the one operational fact that matters: the resize itself is safe and reversible, but it is not completely transparent to a live workload, which is why you choose the moment. The Advisor recommendation clears on its next assessment cycle once utilisation reflects the smaller server, rather than the instant you run the command.

What is the impact of leaving an underutilised server at full size?

The direct impact is straightforward: you pay for compute you are not using, every hour, indefinitely. A server running at half its provisioned capacity is paying roughly twice what the workload needs on its largest line. Unlike a one-off cost, this compounds quietly: the overpayment renews every billing cycle and is easy to miss precisely because nothing is broken. A right-sizing recommendation left unactioned is a standing subscription to unused capacity.

The second-order impact is that it normalises drift. When the team does not act on Advisor's cost flags, server sizes stop reflecting workloads at all, and the estate accumulates a tail of databases that were each sized generously for a peak that never came. The bill grows faster than usage, and the link between what is provisioned and what is needed is lost. Right-sizing the flagged servers re-establishes that link and makes the next round of drift visible.

On the planning side, an estate where compute tracks usage is far easier to forecast and to commit. Once servers are sized to their real workload, a reserved capacity purchase or a savings plan covers what is genuinely run rather than padding, so the discount lands on real demand. Right-sizing first and committing second is the order that captures both savings rather than locking in the over-provisioning.

How do you right-size a MySQL server safely?

Treat right-sizing as a short, deliberate loop rather than a reflex. The order matters: confirm the low utilisation is real, pick the right smaller size, resize at a quiet moment, then pin the new size so it does not drift back up.

1. Confirm the low utilisation is the steady state

Advisor measures 7 days, which is usually representative, but confirm there is no monthly batch job, quarter-end report or seasonal peak that falls outside the window. Check the server's CPU, memory and connection metrics in Azure Monitor over a longer period than a week before committing. The goal is to right-size to the real peak, not to a quiet fortnight.

2. Choose the right smaller size or tier

Advisor recommends halving the vCores. Use list-skus to see the valid sizes in the region, then pick the next size down within the same tier, or drop to the Burstable tier if the workload is spiky and mostly idle rather than steadily moderate. Leave clear headroom over the measured peak so the smaller server is comfortable, not marginal.

3. Resize at a quiet moment and watch it settle

Scaling compute restarts the database engine, so existing connections drop and reconnect. Pick a low-traffic window, make sure the application retries connections cleanly, run the resize, and then watch CPU, memory and connection metrics for a normal cycle to confirm the smaller server carries the load with headroom to spare.

4. Pin the new size in code so it does not drift back

If the server is deployed from Bicep or another template, update the SKU there to match the right-sized value. Otherwise the next redeploy silently restores the old, larger size and the saving evaporates. Pinning the size in code is what turns a one-off resize into a saving that stays captured.

# 1. See the current size of the flagged server.
az mysql flexible-server show \
  --resource-group rg-data --name orders-prod-mysql \
  --query "{tier:sku.tier, sku:sku.name}" -o table

# 2. See the valid sizes in the region before choosing the smaller one.
az mysql flexible-server list-skus --location uksouth -o table

# 3. Halve the compute: drop a 4-vCore GP server to a 2-vCore GP server.
#    This restarts the engine, so run it in a quiet window.
az mysql flexible-server update \
  --resource-group rg-data --name orders-prod-mysql \
  --tier GeneralPurpose --sku-name Standard_D2ds_v4

# 4. Pin the right-sized SKU in Bicep so a redeploy cannot push it back up.
#    resource mysql 'Microsoft.DBforMySQL/flexibleServers@2023-12-30' = {
#      name: 'orders-prod-mysql'
#      location: 'uksouth'
#      sku: {
#        name: 'Standard_D2ds_v4'
#        tier: 'GeneralPurpose'
#      }
#      properties: { /* ...existing properties... */ }
#    }

Quick quiz

Question 1 of 5

Azure Advisor raises 'Right-size underutilized MySQL servers' against a Flexible Server. What is it actually telling you?

You can now treat Azure Advisor's MySQL right-sizing flag as a clear, actionable saving rather than a notification to ignore: confirm the low utilisation is the real steady state, choose the right smaller size or tier, resize in a quiet window because the engine restarts, and pin the new SKU in code so the saving sticks. Done as a habit across every flagged server, this keeps the compute bill matched to what the workloads actually use.

Back to the library