MatchIQ
Engineering

From 3 users to 5 million: how MatchIQ stays up

How MatchIQ is engineered to survive growth: static-first pages, tiered caching, provider fallbacks, database discipline and the plan for five million users.

MatchIQ TeamEngineeringUpdated 3 December 202612 min read
On this page
  1. Rule one: cache before you compute
  2. Rule two: match the cache to the data
  3. Rule three: never depend on one provider
  4. Rule four: make writes boring
  5. Rule five: protect the database from the crowd
  6. Rule six: degrade in pieces
  7. Rule seven: measure before you buy
  8. What five million actually changes
  9. What we will not do

MatchIQ started with three active users. Three people, one prediction board, and a database that had nothing to do. That is the best time to decide how the site will behave when the number is five million, because every shortcut taken at three users becomes a queue at five million.

This is not a post about buying more servers. It is about the rules we built into the product so that growth does not require a rewrite. Some of them are live today. Some are the plan for the day the traffic arrives. We will be clear about which is which.

Rule one: cache before you compute

The most expensive request is the one that reaches the database, and the second most expensive is the one that reaches a provider. So the site is built to answer as much as possible before either happens.

  • The public blog is static. Five articles are generated at build time from typed content files, not fetched from a CMS at request time.
  • Marketing and legal pages are server-rendered and cached. They do not query the database to render.
  • The application uses Next.js cache components and partial prefetching, so shared shells render once and only the dynamic parts stream.
  • Provider data is cached in process with a time window that matches how fast it changes.

Today, a reader who opens a blog post or a legal page causes no database work at all. A reader who opens the live board reads from cache unless the window has expired. The database is reserved for things that genuinely need it: accounts, sessions, plans, payments and audit records.

Rule two: match the cache to the data

A single cache timeout for every feed is either too slow or too wasteful. MatchIQ sets the window per source and, in some cases, per endpoint.

DataCache windowReason
LiveScore live scores10 secondsIn-play scores change constantly.
LiveScore day fixtures120 secondsA day's fixture list barely changes.
SportSrc match list120 secondsStream availability changes slowly.
SportSrc match detail30 secondsPlayer and stream detail moves faster.
SportyTV playlistsShort, signed windowSignatures expire, so the playlist is refreshed before the signature does.
News article text30 minutesThe story is already published and does not change.
Blog articlesBuilt at deployEditorial content changes only when we ship it.

The result is predictable upstream traffic. A provider sees a steady request rate instead of a spike for every visitor. When a page gets popular, the cache absorbs it.

Rule three: never depend on one provider

Every live sport has a primary group and a fallback group. The primary group is fetched first, in parallel. Fallbacks run only when the primary returns nothing. That one design choice cut football from roughly twenty upstream calls per refresh to a handful, and it means a single provider outage degrades one sport instead of blanking the board.

The same pattern applies to streams and news. Different sources are normalised into one shape before they reach the UI, so the page does not care which provider answered. If a provider is slow, a timeout ends the wait instead of holding the request open. If it is down, the next source runs.

Rule four: make writes boring

Reads can be cached. Writes cannot. Payments are the clearest example, so they get the strictest rules.

  • The price is resolved on the server. The browser never sends an amount.
  • A payment intent is written before the hosted checkout opens, with a 30-minute lifetime.
  • The webhook body is read raw and verified with an HMAC before it is parsed.
  • A unique transaction id makes a replayed webhook a no-op instead of a second grant.
  • Premium stacks from the later of now and the current expiry, so an early renewal never costs days.
  • Ambiguous payments go to a review queue. The system does not grant on a guess.

At five million users, the write path is where a queue belongs, not the read path. Payment confirmations, emails and audit records can be processed asynchronously with idempotency keys. A slow email provider should never hold a webhook open long enough for the payment provider to retry.

Rule five: protect the database from the crowd

PostgreSQL is excellent at serving many small reads and surprisingly good at writes, but it is not magic. The plan for five million has four layers.

  1. Connection pooling. Application instances share a bounded pool instead of opening a connection per request.
  2. Read replicas. Public, cacheable reads move to replicas, leaving the primary for writes and for reads that must be fresh.
  3. Queues. Email, webhook follow-up and analytics leave the request path and run in workers.
  4. Backpressure. Rate limits and circuit breakers stop a traffic spike or a failing dependency from turning into a database outage.

None of this is exotic. It is the difference between a database that serves a product and a database that becomes the product.

Rule six: degrade in pieces

A site that fails all at once is a design choice. MatchIQ is built so that one broken dependency removes one feature.

  • Live scores down: the board shows the last good data with a timestamp.
  • News feed down: the last cached stories stay up.
  • Stream provider down: the score board and predictions still work.
  • Payment webhook delayed: the payment sits in review instead of granting twice.
  • Email provider down: sign-in codes fail, but public pages and existing sessions keep working.

The UI is part of this contract. An empty state with an honest message is better than a spinner that never ends, and much better than a fabricated number.

Rule seven: measure before you buy

At five million users the temptation is to add infrastructure before knowing which request is slow. We would rather instrument first: request latency by route, cache hit rate, provider error rate, database time per query, queue depth and payment review volume. Every one of those numbers tells you which layer to fix.

Load tests should exercise the fallback paths, not just the happy path. A test that only proves the primary provider works has tested the least interesting scenario.

What five million actually changes

LayerTodayAt five million
Public pagesStatic or server-cached, no database readServed from the edge with stale-while-revalidate
Live dataIn-process cache with per-source windowsShared cache plus regional fan-out, with the same fallbacks
DatabaseSingle PostgreSQL primary, pooled connectionsPrimary plus read replicas, partitioned high-volume tables
WritesSynchronous where correctness mattersIdempotent queue for email, audit and follow-up work
PaymentsWebhook plus review queueSame rules, more workers and stricter rate limits
FailureProvider fallbacks and last-good dataCircuit breakers, bulkheads and automated failover
CostSmall, predictable provider billPer-route budgets and cache hit-rate targets

What we will not do

  • Poll a provider on every page view.
  • Read the database to render a page that has not changed.
  • Put a provider in the critical path without a timeout and a fallback.
  • Grant Premium because a redirect looked successful.
  • Add infrastructure we cannot measure.

Three users and five million users want the same thing: a page that opens, a score that is close to real, and a payment that is recorded once. The numbers change the cost of getting that wrong. They do not change the rules.

Does MatchIQ already serve five million users?

No. Five million is the scale the architecture is being prepared for. The article separates what is live today from the plan for that scale.

What keeps the site up when a data provider fails?

Each sport has a primary group and a fallback group. A failed provider triggers the fallback, and the UI shows the last good data with a timestamp if every source is down.

Why cache live scores at all?

Without a cache, every visitor would trigger an upstream request. A 10-second window keeps scores current while keeping provider traffic predictable.

Related reading

Put the method to work.

Open the board, read the probability and the price, and build one ticket you understand. The free tier is enough to start.