Scalability: recap and quiz
The module in four sentences
Section titled “The module in four sentences”- Scaling up and scaling out. A bigger machine is simple and stops at the largest one, more machines have no such ceiling but need work that can be split, and at equal capacity one shared queue waits less than several.
- Stateless services. Any instance can answer any request when nothing a request needs is remembered by one instance, so the state moves to a database, a shared store, the client or a queue.
- Session handling. A session can live in one instance with sticky sessions, in a shared store, or in a signed token, and each moves the difficulty: lost sessions, a lookup per request, or a token that is hard to revoke.
- Autoscaling. A policy adds instances to bring utilisation to a target and removes them when the load stays low, but capacity arrives after a delay, so a sudden spike is felt in full before it helps.
How each one is misunderstood
Section titled “How each one is misunderstood”| Idea | The common mistake | The correction |
|---|---|---|
| Scaling out | Adding instances to the part that is easy to copy | Find the bottleneck first: what the instances share sets the limit |
| Statelessness | Keeping a user’s state in the memory of the instance that served them | Put it where any instance can read it, or a removed instance takes it away |
| Sessions | Relying on sticky sessions to avoid redesigning | They lose sessions when an instance goes, and the Twelve-Factor App says never to rely on them |
| Autoscaling | Expecting it to absorb a spike | It reacts to load it has seen, and its capacity arrives after the start-up delay |
| Headroom | Setting the target as high as possible to save money | A group of 4 can survive losing one only below 75%, and a spike needs room until new instances serve |
A checklist: before saying we will just scale it
Section titled “A checklist: before saying we will just scale it”- What is the bottleneck? The component with the highest utilisation after the change, not the one that is easy to copy.
- Can the work be split? If an instance holds something no other instance has, adding instances does not help, and removing one loses it.
- How many instances at the peak? The peak over what one instance serves at the target. 1,500 requests per second on instances of 200, at 60%, is 13.
- How hot can it run? A group of N survives the loss of one only up to (N − 1) ÷ N of its capacity: 75% for 4.
- What if the load jumps? Shortfall times the reading interval plus the start-up delay is what is rejected. Decide whether to pay for spare capacity, schedule ahead, or throttle.
- What are the limits? A minimum for safety, a maximum for cost, and a scale-in delay long enough to avoid flapping.
Check what you have learnt
Section titled “Check what you have learnt”Eight questions cover the whole module. Every option is explained, whether it is right or wrong.
Scalability: module quiz
This quiz needs JavaScript to check your answers.
What comes next
Section titled “What comes next”The next module, Load balancing, is about the part this module took for granted: the thing that spreads requests across the instances. You have already met its effects. It decides whether a group shares one queue or splits into several, whether a user returns to the same instance, and which instances are in the group when one is added or removed.
Your progress
Built by GhaziAlibi.
© ShardCraft. All rights reserved.