Triage a Cloud-Hosted Site Stuck on a Spinner for Most Users
System DesignModel answerLast updated
Explain how you would systematically investigate a cloud-hosted web app where most visitors see an endless loading indicator while a minority get the full page.
A web product is hosted on Google Cloud. Roughly one in five visitors gets the page rendered normally. The remaining four in five see only a loading indicator, and the real content never shows up.
Describe, step by step, how you would investigate this. Do not jump straight to a single favorite suspect such as "someone changed a config" or "the last deploy broke it". Show how you would locate the failing stage and how you would prove or rule out each explanation.
Things you may not know up front (ask or state assumptions):
- Which backend services, APIs, data stores, CDN and frontend framework are involved, and which Google Cloud products serve the app (static hosting, App Engine, Cloud Run, GKE, a load balancer, and so on).
- Whether the problem began at a particular moment, such as a release. Treat the start time as something to discover, not something given.
Questions worth asking the interviewer:
- Is the failure sticky per user, or does any user fail roughly 80% of the time?
- Do affected users have anything in common (browser, device, region, network, signed-in state, account type)?
- What does the page need to fetch or execute before it hides the spinner?
- What monitoring already exists (client error reporting, real-user monitoring, load balancer and backend logs, traces)?
Expected in your answer: how you scope the problem, what browser and server evidence you gather, a list of candidate causes for the uneven split with a test for each, and how you would mitigate, fix and prevent a repeat.
Hints
Hint 1
A spinner that never disappears means the HTML shell arrived and some later step (a script, a config fetch, an API call, a render) never finished or failed silently. Work out which stage that is before theorizing about causes.
Hint 2
A split of about 80/20 is itself a clue. Ask what in a Google Cloud setup divides traffic by a ratio or by a user attribute: multiple backend versions or instances, cache hit vs miss, a feature flag or experiment, a regional or network path, a browser capability.
Hint 3
Compare a failing load with a succeeding one side by side (network waterfall, console errors, response headers, which backend served it). Whatever differs is your lead, and each hypothesis should have a test that can disprove it.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Approach in one line
Scope the failure, use the spinner to pin it to a stage of the page load, collect evidence from both the browser and the server, then test explanations for the 80/20 split one at a time, while limiting user harm.
1. Confirm and scope
- Reproduce it myself and check dashboards: is it really about 80%, and since when? Plot the failure rate (or the drop in successful "page ready" events) against time and line it up with deploys, config pushes, certificate or DNS changes and traffic changes.
- Determine whether the split is per user (sticky) or per request. Reload several times in the same browser, and compare an incognito window. Sticky failure points to cookies, flags, cached assets, account data, region or device. Random failure points to load balancing, a bad instance or version, or cache variance.
- Slice the failing population by browser and version, OS, device, country or region, ISP, logged-in vs anonymous, app version, and whether they hit a CDN edge. A dimension where failure is near 100% on one side is the lead.
2. Use what the spinner proves
The server returned at least the shell HTML and the spinner code ran. So the failure sits between "shell loaded" and "content rendered". Possible stages: a JavaScript bundle fails to load or parse, runtime config or auth bootstrap fails, a critical API call hangs or errors, the response is malformed, or the render code throws or never resolves a promise. A common frontend bug is a spinner that is only cleared on success, so any error or timeout leaves it up forever. That would explain why the symptom looks identical for very different root causes.
3. Browser evidence (failing vs working load)
- Network tab: which request is red, pending, blocked or very slow? Look at status codes, CORS errors, mixed-content blocks, 304 vs 200,
Content-Typeof scripts (HTML returned in place of JS is typical of a stale or missing asset), and response headers such asAge,Viaand cache headers. - Console: uncaught exceptions, chunk-load errors, CSP violations, unsupported-syntax errors on older browsers.
- Application tab: stale service worker, old cached bundles, bad local storage or cookies. Test by clearing them.
- If client error reporting or real-user monitoring exists, group errors by message and release. If not, add a temporary beacon that reports which loading stage was reached.
4. Server and infrastructure evidence
- Load balancer logs (Cloud Logging): status codes, latency and backend selected for failing paths. Look for 5xx, 4xx, timeouts and a skewed distribution across backends.
- Backends: compare instances, revisions or pods. Is one Cloud Run revision, GKE deployment or App Engine version getting around 80% of traffic and failing? Traffic splitting, a half-finished rollout or one unhealthy zone can all produce an uneven ratio. Check health checks, autoscaling, cold starts, CPU or memory saturation, and restarts.
- CDN and caching: are some edges serving a stale
index.htmlthat references deleted hashed bundles? Compare cache hit and miss outcomes with failure outcomes. - Dependencies: database or third-party latency, connection pool exhaustion, quota limits, expired credentials or secrets, and an IAM change affecting a service account.
- Traces: follow a failing request end to end and find where time is lost or an error appears.
5. Hypotheses for the 80/20 split, each with a test
| Hypothesis | How to confirm or rule out |
|---|---|
| Traffic split between a good and a bad version or instance | Backend or revision label in logs vs outcome; route all traffic to one version and re-measure |
| Stale CDN or browser cache referencing missing bundles | 404s on hashed assets; purge cache and compare |
| Feature flag or experiment bucket | Failure rate by flag value; flip the flag for a test user |
| Browser or device incompatibility | Failure by user agent; reproduce on that browser |
| Region or network path problem (DNS, edge, firewall) | Failure by geography or ISP; test from a different network |
| Auth or cookie issue (expired tokens, third-party cookie blocking, CORS) | Compare logged-in and anonymous, inspect failing preflight or 401 calls |
| Backend dependency slow or failing for a subset of data | Failure by account or data shape; check slow queries |
| Frontend error handling leaves spinner on any failure | Force an API error locally and watch the UI |
I would work through the cheapest and most discriminating tests first, and change one thing at a time so each result is interpretable.
6. Mitigate, fix, prevent
- Mitigate early: if a release or flag correlates, roll back or disable it, shift traffic to the healthy version, purge caches, or scale up. Communicate status to stakeholders.
- Fix the root cause once confirmed, and verify with the same metric used to detect it (success rate back to normal across all slices).
- Prevent recurrence: give the spinner a timeout and an error state with a retry; add client-side error reporting and a "content rendered" metric with alerting; use canary or gradual rollouts with automatic rollback; version and invalidate assets safely (keep old hashed bundles during rollouts); add a synthetic check from several regions and browsers; write a blameless postmortem.
Common mistakes
- Settling on "it must be the last deploy" without evidence.
- Looking only at server logs and ignoring what the browser actually experienced.
- Changing several things at once, so the cause stays unclear.
- Forgetting that a quiet failure (no error shown) is itself a bug worth fixing.
- Skipping mitigation while chasing the root cause.