Part 5 of 6 · 2 min read
Scaling plan and trade-offs
A scaling plan and its trade-offs
Think of a scaling plan like a building's own fire-escape plan. It is drawn up in advance, before it is ever actually needed, so nobody improvises under pressure.
In plain words: The first and cheapest scaling step, if read traffic on content grows large, is a read replica for content queries, since subjects, levels, and modules change rarely and tolerate the replication lag a replica introduces. An even cheaper step for the most-read content pages is an application-level cache in front of the content tables entirely, since that content barely ever changes. If progress-table write volume ever genuinely outgrows a single instance, the clear next step, following the framework from earlier in this subject, is to shard the progress table by learner_id, since nearly every query against it already filters by one learner at a time, keeping almost all transactions confined to a single shard. This design accepts one explicit trade-off: the module_id-only index used for completion counts would need to be rebuilt as a cross-shard aggregation once progress is sharded, since that specific query no longer confines itself to one shard.
A worked example. If the platform grows to millions of learners, content stays on a single instance behind a cache, while progress is sharded by learner_id, keeping each learner's own progress queries fast and confined to one shard, at the cost of module-wide completion counts now requiring a scatter-gather query across every shard.
The key lines. No new SQL; this is a scaling and sharding plan.
Content (subjects, levels, modules): read replica + cache, rarely written
Progress: shard by learner_id if volume outgrows one instance
Trade-off accepted: module-wide completion counts become cross-shard
Scaling plan
A scaling plan is a concrete, ordered set of steps prepared in advance for what to do as specific, named bottlenecks are actually reached, rather than a vague intention to "scale later."
Example: the plan above names read replicas and caching as the first steps, and sharding progress by learner_id as the step reserved for genuine write-volume growth.
Quick notes
- Separate the platform's rarely-written content hierarchy from its write-heavy learner progress table; each deserves its own design attention.
- Choose indexes by matching the platform's actual dominant queries to leftmost-column fit, not by indexing every column that might someday be filtered.
- Apply the four-question framework, consistency, scale, pattern, team cost, to this platform the same way as any other workload.
- Scale content reads first with a replica and a cache, since content changes rarely; reserve sharding for genuine progress-table write growth.
- State the trade-off a scaling plan accepts, such as a cross-shard aggregation query, rather than presenting the plan as free.