📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

๐Ÿ“š Interview question

You're the architect for a new consumer product on Azure. It launches with about 1,000 users, but the business plan says 10 million within a few years. How would the design evolve from 1,000 to 10 million users? Tell me what you would build on day one, what changes at roughly each 10× step, what triggers each change, and what you would deliberately not build yet.

Evolving a system design from 1,000 to 10 million users: a simple day-one architecture, the changes at each order of magnitude (caching, replicas, async work, CDN, partitioning, multi-region, cells), the metrics that trigger each step, and avoiding premature scale.

Staff / Architect Architecture Expert azure capacity-planning evolutionary-architecture modular-monolith scalability system-design

๐ŸŽฏ Key points

  • Day one: a modular monolith on a managed platform (App Service or Container Apps), one Azure SQL database, Blob Storage, Front Door, Entra External ID, IaC and CI/CD, OpenTelemetry — boring and cheap
  • Build for change, not for scale: clear module boundaries, stateless app tier, async-ready seams (outbox), and IDs generated without a central sequence
  • ID trade-off: UUIDv7 is time-ordered, so it avoids most of the index fragmentation of random GUIDs (NEWID) and works across shards and regions, but it is 16 bytes vs 8 for bigint; measure it on the clustered key
  • ~10k–100k users: autoscale, caching (Redis / HybridCache), CDN for static and media, background workers with Service Bus, read replica, zone redundancy
  • ~1M users: CQRS read models and a search index, extracting the 1–2 modules with different scale or team needs, rate limiting, SLOs and on-call
  • ~10M users: shard the hot data by user or tenant key (Cosmos DB or sharded SQL), multi-region or cells (independent stack copies per user slice), data residency and tested DR
  • Changes are triggered by measured signals at each stage (p99 latency, DB CPU/log rate, queue age, cost per user, deploy contention) and checked with load tests at 2× the next step
  • What not to build early: microservices, multi-region, sharding, Kubernetes, event sourcing — each has a trigger and an exit cost

โฑ 30-second answer

On day one I build the simplest thing that can grow: a modular monolith on App Service or Container Apps, one Azure SQL database, Blob Storage behind Front Door, a managed identity provider, IaC, CI/CD and OpenTelemetry. I invest in seams โ€” module boundaries, a stateless app tier, an outbox, time-ordered IDs that don't need a central sequence โ€” rather than scale I don't need. Around 100k users I add caching, a CDN, background workers on Service Bus, a read replica and zone redundancy. Around 1M, read models, a search index, extracting the one or two modules with different scaling or team needs, and SLOs. Around 10M, sharding the hot data by user or tenant key, and either multi-region active-passive or cells โ€” independent copies of the stack, each serving a slice of users. Each step is triggered by measured signals, not user counts. The trade-off: building late risks a rushed migration; building early wastes years on complexity.

๐Ÿ—ฃ Full answer (senior)

How I would answer this in an interview

"My principle is: build for change on day one, build for scale when the numbers say so. With 1,000 users the risk isn't load, it's whether the product survives. So day one is a modular monolith in .NET 10 on Container Apps or App Service, one Azure SQL database, Blob Storage behind Front Door, Entra External ID for sign-in, Bicep or Terraform, a CI/CD pipeline, and OpenTelemetry into Application Insights. What I do invest in is seams: modules that own their tables and talk through interfaces, a stateless app tier, an outbox so I can go async later, and IDs like UUIDv7 that don't need a central sequence. That system comfortably handles the first 100,000 users.

Then I let measurements trigger each step. Around 10k to 100k: autoscale, Redis or HybridCache for hot reads, a CDN for images, background workers on Service Bus for email and image processing, a read replica, zone redundancy. Around a million: read models and a search index for the heavy queries, rate limiting, SLOs and on-call, and extracting the one or two modules that have different scaling or team needs โ€” say media processing or notifications. Around 10 million: partitioning the hot data by user or tenant, and either multi-region active-passive or a cell architecture where each cell is a full copy of the stack for a slice of users. For example, at [company] we [launched on a single App Service and database, and the first real pressure came at around 300k users from the activity feed query]. I [added a precomputed feed read model and Redis rather than splitting services], [which cut feed p99 from 2.1 s to 120 ms and postponed any service split by more than a year].

The mistake I see is designing day one for the 10 million in the business plan: microservices, Kubernetes, multi-region, sharding โ€” a big team running a distributed system for a product that hasn't found its users. The opposite mistake is having no seams, so the step to a million users becomes a rewrite. I'd write down the trigger for each step and the 'not yet' list in an ADR, and load test at twice the next step so we change before customers feel it. Architecture should grow one measured step ahead of the load, never five."


The steps

Users (rough) Peak load (illustrative) What changes Trigger to watch
1k < 5 req/s Modular monolith, one SQL DB, Blob + Front Door, IaC, CI/CD, telemetry โ€”
10k ~20 req/s Autoscale, health checks, backups tested, basic caching p95 latency, first incidents
100k ~200 req/s Redis / HybridCache, CDN for media, Service Bus workers, read replica, zone redundancy DB CPU > 60% at peak, slow pages, long-running requests
1M ~2,000 req/s Read models, search index, rate limiting, SLOs + on-call, extract 1โ€“2 modules Specific hot queries, deploy contention between teams, noisy features
10M ~20,000 req/s Partition hot data, multi-region or cells, data residency, regional DR drills Write rate near single-primary limits, regional SLO, blast radius

Arithmetic (illustrative): 10M users ร— 20% daily active = 2M DAU ร— 30 requests/day = 60M requests/day รท 86,400 โ‰ˆ 700 req/s average; ร— ~3 peak factor โ‰ˆ 2,000 req/s; heavy API-chatty clients or media can push that to 20,000. The point is the order of magnitude and the measured trigger, not the exact number.

Day-one architecture

[Clients] -> [Front Door + WAF + CDN] -> [Container Apps: modular monolith (.NET 10)]
                                             |            |             |
                                      [Azure SQL]   [Blob Storage]  [Entra External ID]
                                             |
                                      outbox table -> (later: Service Bus)
Telemetry: OpenTelemetry -> Application Insights      IaC: Bicep/Terraform      CI/CD: GitHub Actions

The 'not yet' list

Not yet Trigger to reconsider Cost if built early
Microservices Teams blocking each other, very different scaling needs Distributed systems tax, slower delivery
Kubernetes (AKS) Many services, need for its ecosystem, platform team Ops burden, skills
Sharding Write rate or size beyond one primary (even Hyperscale) Lost joins, complex ops
Multi-region Regional SLO or regulatory DR requirement ~2ร— cost, failover complexity
Event sourcing Audit/temporal domain need Steep learning curve

Production example

A [consumer marketplace] grew from [2k] to [1.4M] users on one modular monolith and one Azure SQL database (scaled up twice), adding Redis, a CDN, Service Bus workers and two read models along the way; infrastructure cost stayed around [$0.03] per monthly active user. The only service extracted was image processing, at [~600k] users, because it needed GPU-free burst scaling separate from the API.

๐Ÿ” What the interviewer is checking

Checks whether the candidate can plan an architecture's growth in measured steps โ€” simple first, seams for change, triggers for each step โ€” rather than jumping to a hyperscale design or ignoring growth.

Green flags

  • Simple day-one design with explicit seams (module data ownership, stateless tier, outbox, IDs)
  • A clear sequence of changes per order of magnitude, tied to measured triggers
  • An explicit 'not yet' list with reasons and exit costs
  • Incremental migrations and load testing ahead of growth

Red flags

  • Microservices, Kubernetes and multi-region on day one
  • No plan for growth at all
  • Triggers based only on user counts or on fashion

๐Ÿ“š Learn in depth

1. Why evolve instead of design for the end state

The 10-million-user design is a guess. Requirements, access patterns and the team will change. Building it up front pays the complexity cost for years before the load arrives, and usually optimises the wrong thing. Evolutionary architecture keeps the system easy to change and uses fitness functions (measurable checks) to decide when to change it.

2. Seams that make later steps cheap

Seam Enables later
Modules own their tables, no cross-module joins Extracting a module into a service
Stateless app tier (no in-memory session) Horizontal scaling, multi-region
Outbox table from day one Moving to Service Bus without a rewrite
UUIDv7 / coordination-free IDs Partitioning, multi-region writes
Tenant or user id on every row Choosing a shard key later
OpenTelemetry everywhere Seeing where the next bottleneck is
IaC for everything Spinning up a second region or a cell

3. The order in which things break

Typical order for a web product: (1) slow queries and missing indexes, (2) database CPU from read volume, (3) long-running work inside requests, (4) static and media bandwidth, (5) write throughput and lock contention on hot tables, (6) team coordination and deploy contention, (7) regional blast radius and residency. Each step in the table above addresses the next item.

4. Cells

At very large scale, a cell is a complete, independent copy of the stack serving a slice of users (by user id or tenant), with a thin routing layer in front:

          [global router: user -> cell]
           /            |            \
   [cell 1: AU East] [cell 2: AU East] [cell 3: AU Southeast]
   app + DB + cache  app + DB + cache  app + DB + cache

Cells cap blast radius (a bad deploy or noisy tenant affects one cell), make capacity predictable (add cells), and turn sharding into an operational routine. The cost is the routing layer, cross-cell features and fleet management.

5. Triggers as fitness functions

Write each trigger as a measurable rule and check it monthly or in alerts:

  • p99 of top-10 endpoints > 500 ms at peak for 2 weeks
  • Azure SQL CPU or log write > 60% at peak
  • Cost per monthly active user rising for 3 months
  • Lead time for changes rising as teams grow (DORA metrics)
  • Load test at 2ร— the next step fails

6. Migrations that keep the lights on

Every step is done incrementally: strangler fig for module extraction, dual writes plus backfill and comparison for new data stores, feature flags for routing, and a rollback path. Never a big-bang cut-over.

7. Try it yourself

  1. Write the day-one architecture for a product you know on one page, with its 'not yet' list and triggers.
  2. Do the capacity arithmetic for 1k, 100k and 10M users with your own DAU ratio, requests per user and peak factor.
  3. Add an architecture test (NetArchTest or ArchUnitNET) that fails when one module references another module's internals.
  4. Run an Azure Load Testing test at 2ร— your current peak and record which component saturates first.
  5. Sketch a cell architecture for the same product and list which features would cross cells.

๐Ÿ’ป Code

Day-one seams in a .NET 10 modular monolith: modules own their data and register themselves, IDs need no central sequence, and an outbox is ready for when work goes async.

namespace Marketplace.Modules.Listings;

using Microsoft.EntityFrameworkCore;

public sealed class Listing
{
    public Guid Id { get; init; } = Guid.CreateVersion7(); // time-ordered, no central sequence: partition-friendly later
    public Guid SellerId { get; init; }                     // the likely shard key, present from day one
    public required string Title { get; set; }
}

public sealed class ListingsDbContext(DbContextOptions<ListingsDbContext> options) : DbContext(options)
{
    public DbSet<Listing> Listings => Set<Listing>();
    public DbSet<OutboxMessage> Outbox => Set<OutboxMessage>();

    // Each module owns its own schema: no cross-module joins, so extraction later is a move, not a rewrite.
    protected override void OnModelCreating(ModelBuilder b) => b.HasDefaultSchema("listings");
}

public sealed record OutboxMessage(Guid Id, string Type, string Payload, DateTimeOffset CreatedAt, DateTimeOffset? SentAt);

public static class ListingsModule
{
    public static IServiceCollection AddListingsModule(this IServiceCollection services, IConfiguration config)
    {
        services.AddDbContext<ListingsDbContext>(o =>
            o.UseSqlServer(config.GetConnectionString("Marketplace")));
        // Day one: an in-process dispatcher. At ~100k users: swap for a Service Bus relay; callers don't change.
        services.AddHostedService<OutboxDispatcher<ListingsDbContext>>();
        return services;
    }

    public static IEndpointRouteBuilder MapListingsModule(this IEndpointRouteBuilder app)
    {
        var group = app.MapGroup("/listings").RequireAuthorization();
        group.MapGet("/{id:guid}", async (Guid id, ListingsDbContext db, CancellationToken ct) =>
            await db.Listings.FindAsync([id], ct) is { } l ? Results.Ok(l) : Results.NotFound());
        return app;
    }
}

An architecture test keeps the seams honest as the team grows:

namespace Marketplace.ArchitectureTests;

using NetArchTest.Rules;

public sealed class ModuleBoundaryTests
{
    [Fact]
    public void Listings_does_not_depend_on_other_modules_internals()
    {
        var result = Types.InAssembly(typeof(Modules.Listings.ListingsModule).Assembly)
            .That().ResideInNamespace("Marketplace.Modules.Listings")
            .ShouldNot().HaveDependencyOnAny("Marketplace.Modules.Orders", "Marketplace.Modules.Payments")
            .GetResult();

        Assert.True(result.IsSuccessful, string.Join(", ", result.FailingTypeNames ?? []));
    }
}

โš  Common mistakes

  • Mistake: Designing day one for the 10-million-user business plan. Why it is wrong: You pay for microservices, Kubernetes, sharding and multi-region for years before the load arrives, with a small team, and requirements will have changed by then. Instead: Start with a modular monolith on managed services and a written 'not yet' list.
  • Mistake: Having no seams in the first version. Why it is wrong: Cross-module joins, in-memory session and database sequences make every later step a rewrite. Instead: Module-owned data, a stateless tier, an outbox and coordination-free IDs from day one.
  • Mistake: Using random GUIDs (Guid.NewGuid() / NEWID()) as clustered keys to get coordination-free IDs. Why it is wrong: Random inserts split pages and fragment the clustered index, hurting write throughput. Instead: Use time-ordered UUIDv7 (Guid.CreateVersion7()), or keep a bigint clustered key with a UUIDv7 public id, and measure insert performance.
  • Mistake: Triggering changes by user count alone. Why it is wrong: Load depends on behaviour (requests per user, media, write ratio), not headcount. Instead: Define measured triggers: latency, DB saturation, cost per user, team contention.
  • Mistake: Splitting into microservices to fix a database bottleneck. Why it is wrong: The services still share the bottleneck, now with network hops. Instead: Fix data access first (indexes, cache, read models), and extract services for team or scaling-profile reasons.
  • Mistake: Treating security and privacy as a later step. Why it is wrong: More users means more personal data and a bigger target; retrofitting data classification, encryption keys and least privilege is far harder at 1M users. Instead: Classify data, use managed identities and least privilege from day one, and revisit the threat model at each step.
  • Mistake: Big-bang migrations at each step. Why it is wrong: High risk and long freezes. Instead: Strangler extraction, dual writes with backfill and verification, feature-flagged routing.
  • Mistake: Going multi-region before zone redundancy and tested backups. Why it is wrong: Doubles cost and complexity while in-region failures are still the bigger risk. Instead: Zones first, then a region when the SLO or regulation requires it, with DR drills.
  • Mistake: Not load testing ahead of growth. Why it is wrong: You find the next bottleneck when customers do. Instead: Load test at 2ร— the next step and fix what saturates first.

๐Ÿ› Senior insight: trade-offs

The staff-level answer is about sequencing and reversibility: which decisions are cheap to change later (compute platform, caching) and which are expensive (data model, identifiers, module boundaries, identity provider). Get the expensive ones right early and defer the rest. Record each future step with its trigger and expected cost in an ADR, review the triggers monthly, and let data โ€” not the business plan's headline number โ€” decide when to move.

Decision When it fits Cost When not to
Modular monolith + managed PaaS Up to roughly a million users for most products, small to mid teams Discipline on boundaries Truly independent products with separate teams from day one
Extract a service Different scaling profile, separate team, separate release cadence Network, ops, consistency To fix a slow query
Partition / shard Write rate or size beyond one primary Lost joins, complex ops Before caching and read models
Multi-region / cells Regional SLO, residency, blast-radius limits at very large scale ~2ร— infra, routing, fleet ops When zone redundancy meets the SLO

๐Ÿ”— Follow-ups the interviewer may ask

  1. When: Candidate says they would change the design when it hits a bottleneck Why: Checks they can find the bottleneck that triggers each step
    How to answer

    I find bottlenecks by walking the request path with numbers: for each component I compare the expected load from the capacity estimate with what it can handle, and the highest utilisation breaks first. The usual suspects are the single primary database (writes can't scale out), hot partitions where one key gets most of the traffic, synchronous call chains where latencies add up and availabilities multiply, and serialisation points such as a shared lock, a global counter or a single worker. I use Little's Law to check pools: 2,000 req/s ร— 50 ms = 100 concurrent DB connections, which already exceeds a default pool of 100 at any latency spike. Fixes go in order: remove work, cache, move work off the request path with a queue, then partition. The trade-off is that every fix adds staleness or complexity, and the bottleneck simply moves to the next component.

  2. When: Candidate mentions partitioning or sharding at the 10M step Why: Checks they can choose a shard key and plan resharding
    How to answer

    Partitioning splits data into pieces; sharding puts those pieces on separate servers so writes scale out. I shard last, after caching, replicas and a bigger tier, because it's hard to undo. The shard key comes from the dominant access pattern: high cardinality, even load, and most queries served by one shard โ€” in SaaS that's usually TenantId. Hash sharding spreads load evenly but loses range scans; range keeps scans but creates hot ranges; a shard map (directory) lets me move big tenants on their own. Hot keys get split, salted or isolated. I plan resharding from day one with many virtual partitions mapped to fewer nodes. Cross-shard queries go to a read model or search index, never a distributed transaction. The trade-off: linear write scale in exchange for losing joins, global constraints and simple operations.

  3. When: Candidate mentions caching, replicas and queues Why: Checks the order and reasons for each scaling technique
    How to answer

    Vertical scaling means a bigger machine โ€” simple, but it has a ceiling and stays a single point of failure. Horizontal scaling means more instances, which requires stateless services: no in-memory sessions, a shared cache, and shared ASP.NET Core Data Protection keys.

    My order, driven by where the bottleneck is:

    • Scale out stateless app instances with autoscale.
    • Cache hot reads (HybridCache, Redis), then add read replicas.
    • Move slow or spiky work to queues (Service Bus).
    • Partition data only when one database can't handle the writes or size.

    Each step trades simplicity for capacity: caches and replicas bring staleness, queues bring eventual consistency, and sharding brings cross-shard queries and operational pain.

๐Ÿ›  Real-world problems: how you handle them

Growing a consumer marketplace from launch to a million users without a rewrite
Situation
[Consumer marketplace] launched on [one App Service plan and one Azure SQL database] with [2k] users and a business plan of [10M]; team of [6] engineers growing to [25].
Signals
At [~300k] users the activity feed p99 hit [2.1 s]; Azure SQL CPU above [75%] at evening peak; image uploads timing out; two teams queuing to deploy the same app.
Investigation
Application Insights showed the feed query and image resizing as the top time consumers; Query Store confirmed the feed query dominated reads; a load test at 2× peak saturated the database first; DORA lead time had doubled as the team grew.
Resolution
Immediately scaled the database up one tier and moved image resizing to a Service Bus worker. Then added a precomputed feed read model with Redis, a CDN for images, a read replica for reporting, and later extracted image processing as its own service with its own scaling; kept everything else in the modular monolith.
Prevention
Monthly review of written triggers (latency, DB CPU, cost per MAU, lead time), load tests at 2× the next step before each marketing push, architecture tests on module boundaries, and an ADR with the 'not yet' list.

How to tell it (STAR)

**S:** We launched a [consumer marketplace] on a single app and database, with a business plan for [10M] users. **T:** As architect I had to keep it fast through growth without a rewrite or a premature microservices split. **A:** I built module boundaries, an outbox and coordination-free IDs on day one, wrote down the triggers for each next step, and when the feed and images became the bottleneck at [~300k] users I added a read model, Redis, a CDN and a worker instead of splitting services. **R:** Feed p99 dropped from [2.1 s] to [120 ms], we reached [1.4M] users on the same core architecture, and infrastructure stayed at about [$0.03] per monthly active user.

More in Senior Design Focus

Last updated 23 Nov 2026.

๐ŸŒ Sangam's Webring

โช Previous ๐Ÿ  Main Next โฉ
๐Ÿ’ฌ Chat with me