Vertical scaling: bigger shapes

Reading · 6 min · Module 7, lesson 1 of 549 min left in this module

Module 7 · ScalingLesson 1 of 5

Goal: Decide from a service's graphs whether a bigger shape will help, and change it.

Key idea

Vertical scaling gives each spherelet more CPU and memory by moving the service to a bigger shape. It helps when one copy of your app runs out of room, and does nothing when the slow part is somewhere else.

Lesson 5.2.3 set out the two numbers you scale: the shape of each spherelet and how many there are. This lesson is the first of those, read from the graphs you learned in Module 3.

When a bigger shape helps

Start with the Metrics tab, with the Max view on, so one struggling spherelet isn't hidden by an average.

  • Memory near the shape's ceiling, or deploys and restarts ending in Out of memory. The app needs more memory than a Flex spherelet's 512 MB. A bigger shape fixes it at once; then check whether memory keeps climbing, which points to a leak that will fill the bigger shape too.
  • CPU pinned at the ceiling while p95 latency on the Traffic tab rises, even at low traffic. Each request is doing more work than the spherelet's share of a processor can finish quickly.

If requests are slow but CPU and memory sit well below the ceiling, the time is going elsewhere: a database, another service's API, a lock. A bigger shape costs more and changes nothing.

When it doesn't

Some apps can't use what you add. A process that does all its work on one thread gains little beyond 1 vCPU, so Performance's 2 vCPU won't double its speed. And a bigger shape is still one copy: if it crashes, the service is down until it restarts. Capacity for more traffic, and surviving a crash, come from more spherelets (next lesson).

Changing the shape

  1. Open the Spherelets card

    Open the service, then Settings, and find the Spherelets card. Choose Edit.

    You should seeSpherelet type shows the current shape, such as Flex.

  2. Pick the new shape

    Under Spherelet type, choose Standard or Performance, then Save.

    You should seeAn Apply changes? dialog.

  3. Apply it

    Choose Save & redeploy. Save only saves the change for your next deploy instead.

    You should seeThe Spherelets card shows the new shape, and the service stays Running.

The change rolls out like any update: a new spherelet of the new shape starts beside the old one and takes traffic once it's healthy (lesson 5.7.2). It can be quick enough that the status never leaves Running. Your account needs room for spherelets of the new shape; a trial account runs Flex only (lesson 5.1.1), so read these steps for now.

Check yourself

A Flex service's deploy log shows Out of memory each time it starts. CPU was low. What do you try first?
Requests take 3 seconds. CPU sits at 10% and memory at 30%. Will Performance help?

In the docs