System Design Cases
Web Performance & Core Web Vitals
Web Performance & Core Web Vitals concept page. Google CWV (LCP < 2.5s, INP < 200ms which replaced FID in 2024, CLS < 0.1). Topology: User device (browser, main thread, web worker) + Edge/CDN + Origin (SSR/API/DB) + Telemetry (RUM beacon, CrUX, Lighthouse CI). Six animated scenarios: Bad LCP (4.2s render-blocking + 800KB hero JPEG), Optimized LCP (1.6s with preload + AVIF + critical CSS + Early Hints), CLS spike (0.4 from img without dimensions + font swap + cookie banner), Bad INP (380ms long task), Good INP (90ms via useTransition + virtualization + Web Worker offload), CI perf budget gate blocking PR. Three ADRs on browser node: performance budget enforcement in CI as hard gate, INP optimization decision tree (useTransition vs scheduler.postTask vs Web Worker), CLS bulletproofing with explicit dimensions + font metric matching.
Web performance и Core Web Vitals: field distributions, не один score
Core Web Vitals измеряют разные части пользовательского опыта: LCP — загрузку основного контента, INP — responsiveness взаимодействий, CLS — неожиданную визуальную нестабильность. На 2026 год good thresholds: LCP не более 2.5 s, INP не более 200 ms и CLS не более 0.1.
Классификация использует 75-й percentile page views. Lab test полезен для диагностики, но не заменяет field population: устройство, сеть, cache state, route и реальные взаимодействия меняют распределение.
Проверяемые утверждения
- LCP, INP и CLS имеют разные units и причины; их нельзя усреднить в физически осмысленную одну метрику.
- LCP можно разложить на TTFB, resource load delay, resource load duration и element render delay для resource-backed candidate; оптимизировать надо фактический доминирующий компонент.
- INP отражает latency пользовательских взаимодействий и требует сокращать длинную работу main thread, а не только уменьшать initial bundle bytes.
- CLS — безразмерная score неожиданных shifts. Резервирование размеров media/ads и предсказуемое добавление контента предотвращают многие shifts.
Границы и компоненты
| Компонент | Роль в модели |
|---|---|
| Real Browser Visit | document and assets; parse render interact; sampled metrics |
| Edge Delivery | document and assets; document miss; asset miss |
| Origin Renderer | document miss |
| Versioned Asset Origin | asset miss |
| Browser Main Thread | parse render interact |
| Privacy-scoped RUM Beacon | sampled metrics; aggregated measurements |
| Field Distribution Store | aggregated measurements |
Сценарии
Decompose the LCP path
A field trace separates document TTFB, discovery delay, hero transfer and element render delay. The team fixes the largest measured component instead of applying an unrelated bundle tweak.
Проверяемый исход: The LCP change has an explicit causal hypothesis and is compared at p75 by route and device class.
Protect interaction responsiveness
A user interaction arrives while application work is queued. The app yields/splits non-critical work, updates visible feedback promptly and measures the full interaction-to-paint latency.
Проверяемый исход: Long tasks no longer monopolize the main thread, and p75 INP is evaluated from real interactions rather than inferred from page-load TTFB.
Prevent an unexpected layout shift
Critical media arrives after initial layout. Intrinsic dimensions/aspect ratio reserve its slot, while late banners use a preallocated region or user-initiated transition.
Проверяемый исход: The same content loads without moving existing controls unexpectedly, and field CLS stays attributable to concrete shift sources.
Evaluate field percentiles correctly
Sampled RUM sends metric value, route template, device class and release context under a privacy policy. Aggregation computes p75 per metric instead of averaging percentiles or mixing units.
Проверяемый исход: A release decision reflects the target population and reports sample coverage, uncertainty and regressions separately.
Failure, concurrency и evolution checklist
- Segment regressions by route template, release, device class and connection quality; a global average can hide a broken critical cohort.
- Keep lab and field labels explicit. A synthetic run with no interaction cannot produce the same evidence as full field INP.
- Version metric attribution and sampling logic. A dashboard change can otherwise look like a product regression or improvement.
- Set performance budgets alongside correctness/accessibility gates; do not remove essential behavior merely to improve a score.
Security и privacy
- Minimize RUM payloads, strip URL query/fragment and user-entered content, apply retention/access control and respect the product consent/legal basis.
- Treat route/release metadata as potentially identifying when combined; sample and aggregate deliberately.
- Do not expose internal error bodies or credentials in PerformanceEntry names, custom marks or beacon payloads.
Метрики, формулы и допущения
- Good field thresholds:
LCP_p75 ≤ 2.5 s,INP_p75 ≤ 200 ms,CLS_p75 ≤ 0.1; CLS is unitless and the time metrics use milliseconds/seconds. - For a resource-backed LCP candidate:
LCP = TTFB + resource_load_delay + resource_load_duration + element_render_delayby the diagnostic decomposition. p75is the smallest observed value at or above 75% of the chosen population under the aggregation method;p75(A ∪ B)is not generally the average of subgroup p75 values.cache_hit_ratio = edge_hits / cacheable_requests; report bypasses and uncacheable requests separately rather than inflating the denominator ambiguously.
Числа и bounds выше действуют только при названных units, population и assumptions. Ни паттерн, ни browser API сами по себе не задают SLA, capacity или correctness.
Решения для production review
- Define target population, route criticality and release guardrails before selecting dashboards.
- Use field data to prioritize and lab traces/profilers to explain causes; require both for high-confidence fixes.
- Optimize the measured critical path while preserving content, security and accessibility semantics.
Первичные и официальные источники
- https://web.dev/articles/defining-core-web-vitals-thresholds
- https://web.dev/articles/optimize-lcp
- https://web.dev/articles/inp
- https://web.dev/articles/cls
Scope note
Диаграмма отражает текущие Core Web Vitals thresholds на 2026-08-25. Метрики и thresholds могут эволюционировать; они не являются SLA и не заменяют task-success research или accessibility testing.