Up vs out
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Vertical vs horizontal scaling: the 60-second story

    Vertical vs horizontal

    Swamped every morning. A bigger tawa, or more counters?

    A bigger tawa changes nothing else, until it won’t fit. More counters have no limit, but must all keep the same chutney.

    The real difference is where the state lives.

    Up keeps all state in one memory, so transactions, joins and locks stay local. Out spreads it across a network, so the same operations need coordination.

    384

    vCPUs in the largest general-purpose box to rent

    Price per vCPU is flat within a family, so up has no premium until the top. Its penalty is a wall, not a slope.

    Scaling up means no downtime?

    Bad: Just resize it

    A bigger instance, no code changes, no outage.

    Good: It’s a maintenance event

    EC2 stops to change type; a managed database fails over in 60–120 seconds.

    Same 192 vCPUs, same $9.68 an hour, very different failures.

    One m7i.48xlarge or 24 m7i.2xlarge cost the same. Lose the big box and everything is gone; lose one small box and you lose 4.2%.

    A sale needs 60,000 requests a second, about 160 vCPUs. One 192-vCPU box fits, on paper.

    The trick

    If just 1% of each request queues on something shared, Amdahl caps that box near 25,000 a second.

    Each tier scales its own way, set by the state it owns.

    Stateless app servers scale out from day one. The primary database climbs a ladder, from a bigger box to replicas to shards for writes.

    Up first, but leave before the ceiling

    1. Stateless tiers: out, from day one
    2. Primary database: up, then read replicas
    3. Writes outgrow the biggest box? Shard.

    Remember

    Scale stateless tiers out from day one. Scale the primary database up first, add read replicas, and shard only when writes outgrow the biggest box.