MindForge
MindForge
DashboardHelp & Support
Dashboard
MindForge

Interview Preparation Bootcamp

Course progress

0%
0 of 177 modules complete
Start Here0/1
  • How to Use This Course
Data Structures & Algorithms0/27
  • Arrays and Hashing
  • Two Pointers
  • Sliding Window
  • Sliding Window: Harder Problems
  • Binary Search
  • Stacks
  • Practice Test: Arrays, Pointers, Windows, Search and Stacks
  • Trees: Traversals and Core Patterns
  • Binary Search Trees and Rebuilding a Tree
  • Tries (Prefix Trees)
  • Heaps and Priority Queues
  • Graphs: BFS and DFS
  • Topological Sort and Cycle Detection
  • Union-Find (Disjoint Set Union)
  • Practice Test: Trees, Heaps and Graphs
  • Dynamic Programming Basics
  • Dynamic Programming: Two Dimensions
  • Dynamic Programming: Hard String Matching
  • Backtracking
  • Backtracking: Constraint Satisfaction
  • Greedy Algorithms
  • Interval Problems
  • Bit Manipulation
  • Math and Geometry
  • String Manipulation
  • Pattern Recall and Mock Coding Rounds
  • Practice Test: DP, Backtracking, Greedy and More

System Design

Foundations0/16
  • The System Design Interview Framework
  • Back-of-the-Envelope Estimation
  • Networking and Protocols for Design
  • API Design and Idempotency
  • Load Balancing, Proxies, and Scaling Out
  • Caching and CDNs
  • Choosing a Database: Storage, Indexes and Transactions
  • Replication, Partitioning, and Sharding
  • CAP, PACELC, and Levels of Consistency
  • Messaging, Queues, and Event-Driven Architecture
  • Distributed Transactions and Data Integrity
  • Coordination, Consensus, and Distributed Locks
  • Reliability, Resilience, and Rate Limiting
  • Observability, Security, and Cost
  • System Design Cheat Sheet
  • Practice Test: System Design Foundations
Case Studies0/23
  • Design a URL Shortener
  • Design a Rate Limiter
  • Design a Notification Service
  • Design a Job Queue System
  • Design a Chat App (WhatsApp)
  • Design an Analytics Pipeline
  • Design a Multi-tenant SaaS Architecture
  • Design a Social Media Feed (Twitter/X)
  • Design a Search Autocomplete System
  • Design a File Storage Service (Dropbox)
  • Design Google Docs
  • Design a Code Review System
  • Design Netflix
  • Design YouTube
  • Design Spotify
  • Design Uber/Lyft
  • Design Airbnb
  • Design Ticketmaster (Eventbrite)
  • Design an E-commerce Cart, Checkout, and Catalog
  • Design a Payment System
  • Design a Logging and Monitoring System
  • Mock Design Rounds
  • Practice Test: System Design Case Studies
Low-Level Design0/19
  • The LLD Interview Framework and UML
  • OOP Foundations for Design
  • SOLID Principles
  • Creational Patterns
  • Structural Patterns
  • Behavioral Patterns I — Strategy, Observer, Command, State, Template Method
  • Behavioral Patterns II and Anti-Patterns
  • Concurrency in Low-Level Design
  • Design a Parking Lot
  • Design an Elevator System
  • Design a Movie Ticket Booking System
  • Design an Expense-Sharing App (Splitwise)
  • Design a Vending Machine and an ATM
  • Design a Rate Limiter and a Logging Framework
  • Design a Notification Service and an In-Memory Cache
  • Design Games — Tic-Tac-Toe, Snake and Ladder, Chess
  • Database Design for LLD
  • LLD Cheat Sheet and Recall Drill
  • Practice Test: Low-Level Design

Backend

Python0/5
  • How Python Runs Your Code
  • Functions Deep Dive: Closures, Generators, Context Managers, Scope
  • Classes Deep Dive: Method Types, MRO, Metaclasses
  • Standard Library and Serialization
  • Practice Test: Python
Django0/6
  • Django Request Lifecycle
  • Lab: Django Middleware — Request ID & Response Time
  • Django ORM and Querysets
  • Django's Cache Framework
  • Practice Test: Django
  • Django in Production: Debugging Labs
FastAPI0/5
  • FastAPI, ASGI, and Async
  • FastAPI Dependency Injection
  • FastAPI Background Tasks
  • Lab: FastAPI Async — Concurrent Aggregation
  • Practice Test: FastAPI
Databases (PostgreSQL)0/6
  • Indexing
  • Query Optimization
  • Transactions and Isolation
  • Migrations and Schema Changes
  • Hierarchical Data and Safe Concurrent Updates
  • Practice Test: Databases
Caching, Queues & Distributed Systems0/8
  • Redis Caching
  • Redis Advanced Patterns
  • Celery and Background Workers
  • Kafka and Message Queues
  • Async Pipelines
  • Distributed Systems Basics
  • Distributed Locks
  • Practice Test: Caching, Queues and Distributed Systems
APIs, Security & Deployment0/9
  • REST API Design
  • API Versioning and Error Handling
  • API Security and Authentication
  • WebSockets and Real-Time Systems
  • Docker and Containers
  • File Storage with S3
  • Testing Strategies
  • Mock Backend Round
  • Practice Test: APIs, Security and Deployment
Frontend0/38
  • HTML Document Structure and Semantics
  • CSS Box Model, Flexbox and Grid
  • CSS Architecture and Theming
  • CSS and Rendering Performance
  • Variables, Scope, Hoisting, and Truthiness
  • Functions, this, and Binding
  • Objects and Prototypal Inheritance
  • JavaScript Utility Patterns: Cloning, Caching, and Memory
  • Promises From Scratch
  • The Event Loop and Browser Rendering Pipeline
  • The DOM: Nodes, Events, and Traversal
  • Practice Test: HTML, CSS and JavaScript
  • React Rendering Fundamentals
  • React Hooks Internals
  • React Performance
  • Lab: React — Stateful Counter Component
  • State Management
  • State Machines in React
  • React Custom Hooks and Composition Patterns
  • TypeScript for React
  • React Testing
  • Practice Test: React
  • HTTP and Caching
  • Network Performance and Web Vitals
  • Code Splitting and Bundles
  • Virtualization
  • GraphQL and Data Fetching
  • Web Security
  • WebSockets and Real-time
  • SSR and Next.js
  • Micro-frontends
  • Build Tools and Bundling
  • Accessibility
  • Error Handling
  • Internationalization
  • Animation
  • Rapid Recall and Mock Frontend Rounds
  • Practice Test: Performance, Architecture and Production
Behavioral & Interview Day0/14
  • Resume and Project Walkthroughs
  • The STAR Method and Refining Your Stories
  • Conflict and Difficult Coworkers
  • Failures, Incidents, and Obstacles
  • Leadership, Mentorship, and Ownership
  • Teamwork, Communication, and Feedback
  • Growth and Handling Ambiguity
  • Career Goals, Why This Company, and Negotiation
  • Situational Questions
  • Company Research
  • Mock Behavioral Rounds
  • Interview Day
  • After the Interview
  • Practice Test: Behavioral and Interview Day
Network Performance and Web Vitals
Course contents

Interview Preparation Bootcamp

Course progress

0%
0 of 177 modules complete
Start Here0/1
  • How to Use This Course
Data Structures & Algorithms0/27
  • Arrays and Hashing
  • Two Pointers
  • Sliding Window
  • Sliding Window: Harder Problems
  • Binary Search
  • Stacks
  • Practice Test: Arrays, Pointers, Windows, Search and Stacks
  • Trees: Traversals and Core Patterns
  • Binary Search Trees and Rebuilding a Tree
  • Tries (Prefix Trees)
  • Heaps and Priority Queues
  • Graphs: BFS and DFS
  • Topological Sort and Cycle Detection
  • Union-Find (Disjoint Set Union)
  • Practice Test: Trees, Heaps and Graphs
  • Dynamic Programming Basics
  • Dynamic Programming: Two Dimensions
  • Dynamic Programming: Hard String Matching
  • Backtracking
  • Backtracking: Constraint Satisfaction
  • Greedy Algorithms
  • Interval Problems
  • Bit Manipulation
  • Math and Geometry
  • String Manipulation
  • Pattern Recall and Mock Coding Rounds
  • Practice Test: DP, Backtracking, Greedy and More

System Design

Foundations0/16
  • The System Design Interview Framework
  • Back-of-the-Envelope Estimation
  • Networking and Protocols for Design
  • API Design and Idempotency
  • Load Balancing, Proxies, and Scaling Out
  • Caching and CDNs
  • Choosing a Database: Storage, Indexes and Transactions
  • Replication, Partitioning, and Sharding
  • CAP, PACELC, and Levels of Consistency
  • Messaging, Queues, and Event-Driven Architecture
  • Distributed Transactions and Data Integrity
  • Coordination, Consensus, and Distributed Locks
  • Reliability, Resilience, and Rate Limiting
  • Observability, Security, and Cost
  • System Design Cheat Sheet
  • Practice Test: System Design Foundations
Case Studies0/23
  • Design a URL Shortener
  • Design a Rate Limiter
  • Design a Notification Service
  • Design a Job Queue System
  • Design a Chat App (WhatsApp)
  • Design an Analytics Pipeline
  • Design a Multi-tenant SaaS Architecture
  • Design a Social Media Feed (Twitter/X)
  • Design a Search Autocomplete System
  • Design a File Storage Service (Dropbox)
  • Design Google Docs
  • Design a Code Review System
  • Design Netflix
  • Design YouTube
  • Design Spotify
  • Design Uber/Lyft
  • Design Airbnb
  • Design Ticketmaster (Eventbrite)
  • Design an E-commerce Cart, Checkout, and Catalog
  • Design a Payment System
  • Design a Logging and Monitoring System
  • Mock Design Rounds
  • Practice Test: System Design Case Studies
Low-Level Design0/19
  • The LLD Interview Framework and UML
  • OOP Foundations for Design
  • SOLID Principles
  • Creational Patterns
  • Structural Patterns
  • Behavioral Patterns I — Strategy, Observer, Command, State, Template Method
  • Behavioral Patterns II and Anti-Patterns
  • Concurrency in Low-Level Design
  • Design a Parking Lot
  • Design an Elevator System
  • Design a Movie Ticket Booking System
  • Design an Expense-Sharing App (Splitwise)
  • Design a Vending Machine and an ATM
  • Design a Rate Limiter and a Logging Framework
  • Design a Notification Service and an In-Memory Cache
  • Design Games — Tic-Tac-Toe, Snake and Ladder, Chess
  • Database Design for LLD
  • LLD Cheat Sheet and Recall Drill
  • Practice Test: Low-Level Design

Backend

Python0/5
  • How Python Runs Your Code
  • Functions Deep Dive: Closures, Generators, Context Managers, Scope
  • Classes Deep Dive: Method Types, MRO, Metaclasses
  • Standard Library and Serialization
  • Practice Test: Python
Django0/6
  • Django Request Lifecycle
  • Lab: Django Middleware — Request ID & Response Time
  • Django ORM and Querysets
  • Django's Cache Framework
  • Practice Test: Django
  • Django in Production: Debugging Labs
FastAPI0/5
  • FastAPI, ASGI, and Async
  • FastAPI Dependency Injection
  • FastAPI Background Tasks
  • Lab: FastAPI Async — Concurrent Aggregation
  • Practice Test: FastAPI
Databases (PostgreSQL)0/6
  • Indexing
  • Query Optimization
  • Transactions and Isolation
  • Migrations and Schema Changes
  • Hierarchical Data and Safe Concurrent Updates
  • Practice Test: Databases
Caching, Queues & Distributed Systems0/8
  • Redis Caching
  • Redis Advanced Patterns
  • Celery and Background Workers
  • Kafka and Message Queues
  • Async Pipelines
  • Distributed Systems Basics
  • Distributed Locks
  • Practice Test: Caching, Queues and Distributed Systems
APIs, Security & Deployment0/9
  • REST API Design
  • API Versioning and Error Handling
  • API Security and Authentication
  • WebSockets and Real-Time Systems
  • Docker and Containers
  • File Storage with S3
  • Testing Strategies
  • Mock Backend Round
  • Practice Test: APIs, Security and Deployment
Frontend0/38
  • HTML Document Structure and Semantics
  • CSS Box Model, Flexbox and Grid
  • CSS Architecture and Theming
  • CSS and Rendering Performance
  • Variables, Scope, Hoisting, and Truthiness
  • Functions, this, and Binding
  • Objects and Prototypal Inheritance
  • JavaScript Utility Patterns: Cloning, Caching, and Memory
  • Promises From Scratch
  • The Event Loop and Browser Rendering Pipeline
  • The DOM: Nodes, Events, and Traversal
  • Practice Test: HTML, CSS and JavaScript
  • React Rendering Fundamentals
  • React Hooks Internals
  • React Performance
  • Lab: React — Stateful Counter Component
  • State Management
  • State Machines in React
  • React Custom Hooks and Composition Patterns
  • TypeScript for React
  • React Testing
  • Practice Test: React
  • HTTP and Caching
  • Network Performance and Web Vitals
  • Code Splitting and Bundles
  • Virtualization
  • GraphQL and Data Fetching
  • Web Security
  • WebSockets and Real-time
  • SSR and Next.js
  • Micro-frontends
  • Build Tools and Bundling
  • Accessibility
  • Error Handling
  • Internationalization
  • Animation
  • Rapid Recall and Mock Frontend Rounds
  • Practice Test: Performance, Architecture and Production
Behavioral & Interview Day0/14
  • Resume and Project Walkthroughs
  • The STAR Method and Refining Your Stories
  • Conflict and Difficult Coworkers
  • Failures, Incidents, and Obstacles
  • Leadership, Mentorship, and Ownership
  • Teamwork, Communication, and Feedback
  • Growth and Handling Ambiguity
  • Career Goals, Why This Company, and Negotiation
  • Situational Questions
  • Company Research
  • Mock Behavioral Rounds
  • Interview Day
  • After the Interview
  • Practice Test: Behavioral and Interview Day
Browsing without an account — progress is saved in this browser only.Sign in to save it

Network Performance and Web Vitals

Reading35 min

"Why is this page slow to load?" is a question you answer by reading data, not by guessing. This lesson covers the waterfall chart, the numbers you can pull in code, the exact thresholds Google checks, and the fixes, resource hints and image techniques, that turn a diagnosis into a real improvement.

Reading a waterfall

Picture a relay race where each runner has to wait for the one before them to finish, even on legs that could have run side by side. DevTools' Network tab draws exactly that: every request as a horizontal bar, split into phases, Queued → Stalled → DNS Lookup → Initial Connection → SSL → Request Sent → Waiting (TTFB) → Content Download.

Three patterns to look for, in order of how often they're the real problem.

A long Stalled bar across many requests at once usually means the browser is holding requests back because it already has too many open connections to the same server. HTTP/2 mostly fixes this by letting many requests share one connection, check the Protocol column to confirm.

A long TTFB, time to first byte, on the very first document request points at the server: a cold start, a slow backend, or missing caching. This is not a frontend problem, and nothing on the page can render until this finishes.

A "staircase," where request B doesn't start until request A finishes even though nothing forced that, usually means one thing was only discovered after reading another: the HTML finds the CSS, the CSS finds a font, the JS then goes and fetches data. Every step like this costs one full round trip.

Remember: a long TTFB is a server problem. A "staircase" shape is a discovery-order problem. Different symptoms, different fixes.

Sign in to try this knowledge check.

Measuring it in code with the Performance API

The Performance API gives you the exact same numbers the waterfall draws, but as data you can read in code and send to your own monitoring.

tsx
const [nav] = performance.getEntriesByType('navigation') as PerformanceNavigationTiming[];
console.log('TTFB:', nav.responseStart - nav.requestStart);
console.log('Full load:', nav.loadEventEnd - nav.startTime);

const resources = performance.getEntriesByType('resource') as PerformanceResourceTiming[];
const slowest = resources.sort((a, b) => b.duration - a.duration).slice(0, 5);
slowest.forEach(r => console.log(r.name, `${r.duration.toFixed(0)}ms`, r.initiatorType));

performance.mark('data-fetch-start');
await fetchProducts();
performance.mark('data-fetch-end');
performance.measure('data-fetch', 'data-fetch-start', 'data-fetch-end');

The three Core Web Vitals get watched with a PerformanceObserver:

tsx
new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) console.log('LCP:', entry.startTime);
}).observe({ type: 'largest-contentful-paint', buffered: true });

Each of the three measures a different thing. LCP (Largest Contentful Paint) is how fast the page feels like it loaded. INP (Interaction to Next Paint) is how quickly the page responds when you click or type. CLS (Cumulative Layout Shift) is how much content jumps around while loading. They matter to your job for a concrete reason: Google uses all three as a search-ranking signal, and they're the closest thing we have to a number for "did this feel good to use."

Remember: LCP is load speed, INP is responsiveness, CLS is visual stability. Three different questions, three different fixes.

Sign in to try this knowledge check.

The exact thresholds, and why two tools can disagree

Metric Good Needs Improvement Poor
LCP 2.5s or less up to 4.0s over 4.0s
INP 200ms or less up to 500ms over 500ms
CLS 0.1 or less up to 0.25 over 0.25

Field data comes from real visitors' actual devices and networks (via CrUX, PageSpeed Insights, Search Console), and it's what Google actually uses for ranking. Lab data comes from a tool like Lighthouse or WebPageTest, running against one simulated device and network. Lab data is useful for diagnosing a problem, but it's not the real thing, it can't capture how a real mid-range phone on patchy 4G actually experiences your page. That's exactly how a page passes Lighthouse cleanly and still fails its real Core Web Vitals in the field.

Remember: lab data diagnoses. Field data is what actually gets scored.

Sign in to try this knowledge check.

How real apps actually ship this data

Calling PerformanceObserver yourself is what these metrics run on underneath, but production monitoring code uses Google's web-vitals npm package instead of reimplementing each metric's rules by hand, because those rules have real edge cases: LCP's "biggest element so far" can change as content keeps loading in, and CLS groups nearby shifts together into windows.

JavaScript
import { onCLS, onINP, onLCP } from 'web-vitals';

function sendToAnalytics(metric) {
  const body = JSON.stringify({ name: metric.name, value: metric.value, id: metric.id, rating: metric.rating });
  if (navigator.sendBeacon) navigator.sendBeacon('/analytics', body);
  else fetch('/analytics', { body, method: 'POST', keepalive: true });
}
onCLS(sendToAnalytics);
onINP(sendToAnalytics);
onLCP(sendToAnalytics);

Why check sendBeacon first, not fetch? CLS and LCP often only finalize the instant a user navigates away. A normal fetch() call fired during that moment can get killed mid-flight the second the tab closes, silently losing the data. navigator.sendBeacon(url, data) exists specifically for this: the browser promises to send it even if the page is already gone. It's fire-and-forget, always a POST, and capped around 64KB, plenty for a small metrics message. fetch(..., { keepalive: true }) is the backup for browsers without sendBeacon.

Fixing a slow INP in React usually means reaching for patterns you already know: React.memo/useMemo/useCallback to stop unnecessary re-renders, startTransition to let React deprioritize an expensive update so typing and clicking still feel instant, and list virtualization (a later lesson) to avoid mounting hundreds of DOM nodes at once. For one genuinely long, unavoidable synchronous task, parsing a huge payload, sorting a massive array, scheduler.yield() hands control back to the browser between chunks so it can still respond to a click mid-task.

Remember: sendBeacon for data fired on unload, fetch for everything else where you need to read the response.

Sign in to try this knowledge check.

preload versus prefetch

Both tell the browser about a resource before it would normally find it on its own, but they carry different urgency.

html
<!-- preload: fetch it NOW, high priority — this page needs it soon, e.g. a font
     only referenced inside CSS, which the browser can't discover until it parses that CSS -->
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>

<!-- prefetch: fetch it when idle, low priority — the NEXT page will likely need it -->
<link rel="prefetch" href="/dashboard-chunk.js" as="script">

preload competes with this page's own critical resources for bandwidth, which is exactly how candidates accidentally slow a page down by preloading too much of it. prefetch is low-priority and safe to use more freely, though it's wasted bandwidth the moment the guess about the "next page" turns out wrong.

Remember: preload says "I need this now." Prefetch says "I might need this soon, whenever there's time to spare."

Sign in to try this knowledge check.

Images: still the biggest payload on most pages

html
<img
  src="/photo-800.jpg"
  srcset="/photo-400.jpg 400w, /photo-800.jpg 800w, /photo-1200.jpg 1200w"
  sizes="(max-width: 600px) 400px, 800px"
  alt="Product photo"
  loading="lazy"
  decoding="async"
  width="800" height="600"
/>
<picture>
  <source srcset="/photo.avif" type="image/avif" />
  <source srcset="/photo.webp" type="image/webp" />
  <img src="/photo.jpg" alt="Product photo" />
</picture>

loading="lazy" skips downloading offscreen images until they're close to the viewport, natively, with no JavaScript needed. Setting width/height (or aspect-ratio in CSS) lets the browser reserve the right amount of space before the image even loads, which directly fixes the layout-shift bug CLS measures. AVIF and WebP run 25 to 50 percent smaller than JPEG or PNG at the same visual quality. srcset/sizes stop a 2000px image from being sent to a 400px-wide phone screen.

Remember: setting width and height on an image is a CLS fix, not just a layout nicety, it lets the browser reserve the image's space before it's even downloaded.

Sign in to try this knowledge check.
PreviousHTTP and CachingNextCode Splitting and Bundles

Course progress

0%
0 of 177 modules complete

On this page

  • Reading a waterfall
  • Measuring it in code with the Performance API
  • The exact thresholds, and why two tools can disagree
  • How real apps actually ship this data
  • preload versus prefetch
  • Images: still the biggest payload on most pages