🌍 NextJS · flashcards
NextJS Deployment and Scaling Flashcards
51 question-and-answer cards covering Deployment and Scaling as it is examined in NextJS. 24 of them are printed below, taken from across the deck — no signup, no paywall on the preview.
24 sample cards from the Deployment and Scaling deck
Sampled from the end of the deck, so these are different cards from the ones shown on the syllabus page.
What application property is required to make horizontal scaling effective, and why?
Statelessness. Each instance must not store session/user state locally so any request can be served by any instance. Shared state must live in external stores (database, Redis, etc.), enabling instances to be added/removed freely.
Why are Next.js serverless deployments (e.g. on Vercel) naturally horizontally scalable?
Each request is handled by a stateless serverless function instance that the platform spins up on demand and runs many copies of in parallel across regions, so scaling out to handle load is automatic and requires no manual instance management.
When self-hosting a custom Next.js server for horizontal scaling, what tool is commonly used to run multiple Node processes on one machine?
A process manager like PM2 (in cluster mode) or Node's built-in `cluster` module, which forks one worker per CPU core to utilize all cores, often combined with multiple machines behind a load balancer.
What is a load balancer?
A load balancer is a component (hardware or software) that sits in front of multiple server instances and distributes incoming network traffic across them to optimize resource use, maximize throughput, minimize latency, and provide fault tolerance.
Name common load balancing algorithms and briefly describe each.
Round Robin (requests cycled sequentially across servers); Least Connections (route to the server with fewest active connections); IP Hash (client IP hashed to a consistent server); Weighted Round Robin (servers get traffic proportional to assigned weights based on capacity).
What is sticky session (session affinity) in a load balancer, and when is it needed?
Sticky sessions bind a client to the same backend instance for the duration of its session (usually via a cookie or IP hash). It is needed when servers store per-user state locally, but it is best avoided by making the app stateless.
What is a health check in the context of a load balancer?
A health check is a periodic probe (e.g. an HTTP request to `/health`) the load balancer sends to each backend instance. Instances that fail are marked unhealthy and removed from rotation until they pass again, preventing traffic to broken nodes.
At which OSI layers do load balancers typically operate, and what's the difference?
Layer 4 (transport) load balancers route based on IP address and TCP/UDP ports without inspecting content. Layer 7 (application) load balancers inspect HTTP data (URL path, headers, cookies) enabling content-based routing, SSL termination, and more intelligent distribution.
What is SSL/TLS termination at a load balancer?
SSL/TLS termination is when the load balancer decrypts incoming HTTPS traffic and forwards plain HTTP to backend instances, offloading encryption work from the app servers and centralizing certificate management.
How does a CDN complement horizontal scaling for a Next.js app?
A CDN caches static assets and pre-rendered/ISR pages at edge locations close to users, serving them without hitting origin servers. This reduces origin load and latency, letting backend instances handle only dynamic requests.
What is monitoring in application operations?
Monitoring is the continuous collection, aggregation, and analysis of metrics (response time, error rate, CPU, memory, throughput) about a system's health and performance to detect problems and trigger alerts.
What is logging, and how does it differ from monitoring?
Logging records discrete, timestamped event records (requests, errors, custom messages) for detailed inspection and debugging. Monitoring aggregates numeric metrics over time for health/trend analysis and alerting. Logs answer 'what happened'; metrics answer 'how is it performing'.
What are the three pillars of observability?
Metrics (numeric measurements over time), Logs (discrete timestamped event records), and Traces (end-to-end request paths across services/functions). Together they enable understanding a system's internal state from its outputs.
What built-in tools does Vercel provide for monitoring a Next.js deployment?
Vercel provides runtime Logs (function/build logs), Analytics (traffic and audience insights), Speed Insights (real-user Core Web Vitals), and Observability/Monitoring dashboards for metrics like function invocations, errors, and latency.
What are Core Web Vitals, and which three metrics do they include?
Core Web Vitals are Google's user-experience performance metrics: LCP (Largest Contentful Paint, loading), INP (Interaction to Next Paint, responsiveness — replaced FID), and CLS (Cumulative Layout Shift, visual stability).
What are the 'good' target thresholds for LCP, INP, and CLS?
LCP $\leq 2.5$ s, INP $\leq 200$ ms, and CLS $\leq 0.1$. These are the thresholds Google considers a good user experience (measured at the 75th percentile of page loads).
How is Cumulative Layout Shift (CLS) conceptually calculated?
CLS is the sum of individual layout shift scores, where each shift score is the product of the impact fraction and the distance fraction: $$\text{layout shift score} = \text{impact fraction} \times \text{distance fraction}$$ Lower is better; good is $\leq 0.1$.
Give the formula for a service's availability in terms of MTBF and MTTR.
$$\text{Availability} = \frac{\text{MTBF}}{\text{MTBF} + \text{MTTR}}$$ where MTBF is mean time between failures and MTTR is mean time to repair. Often expressed as a percentage (e.g. 99.9% uptime).
How is error rate typically defined as a monitoring metric?
$$\text{Error Rate} = \frac{\text{number of failed requests}}{\text{total number of requests}} \times 100\%$$ commonly the fraction of responses with 5xx (or 4xx+5xx) status codes over a time window.
What does '99.9% availability' (three nines) allow as approximate downtime per year?
About 8.77 hours per year. Downtime $= (1 - 0.999) \times 365 \times 24 \approx 8.76$ hours/year (roughly 43.8 minutes per month).
What are the RED metrics used for monitoring request-driven services?
Rate (requests per second), Errors (number/percentage of failed requests), and Duration (latency distribution of requests). RED gives a concise view of service health from the request perspective.
What is structured logging and why is it preferred in production?
Structured logging emits logs in a machine-parseable format (typically JSON) with consistent fields (timestamp, level, message, metadata). It is preferred because log aggregation tools can index, filter, search, and alert on the fields efficiently, unlike free-form text.
Why is the 95th or 99th percentile (p95/p99) latency more useful than average latency for monitoring?
Averages hide outliers and can mask a poor experience for a subset of users. p95/p99 reveal the tail latency — the slowest 5% or 1% of requests — reflecting the worst-case experience that averages obscure.
Name common third-party monitoring/logging tools you might integrate with a self-hosted Next.js app.
Sentry (error tracking), Datadog / New Relic (APM and metrics), Prometheus + Grafana (metrics collection and dashboards), the ELK/Elastic stack or Logtail/Better Stack (log aggregation), and OpenTelemetry for standardized traces/metrics/logs.
What this deck covers
The Deployment and Scaling deck follows the NextJS Deployment and Scaling syllabus — 3 chapters and 9 topics — so questions land on material that is genuinely examinable rather than trivia around it. That works out to roughly 17.0 cards per chapter.
Answers are written to be recallable, not just readable — averaging about 227 characters, which is long enough to carry the reasoning and short enough to say out loud.
A deck like this earns its keep on the second and third pass. Read the syllabus first so you know the shape of the subject, then use the cards to find the specific facts that have not stuck.
Deployment and Scaling flashcards FAQ
How many Deployment and Scaling flashcards are in this NextJS deck?
51 cards. This page previews 24 of them, sampled evenly across the deck so you can judge the difficulty before installing anything.
Are these NextJS flashcards free?
Yes. The preview here is free to read with no signup, and the full 51-card deck is free inside the Examius app.
What do the Deployment and Scaling cards cover?
They follow the NextJS Deployment and Scaling syllabus — 3 chapters and 9 topics — so the questions track what is actually examinable.
How should I use these flashcards?
Read the syllabus first so you know the shape of the subject, then drill the deck. Examius schedules each card with spaced repetition, so cards you keep missing come back sooner and ones you know drift further apart.