Hello! Welcome to your next lesson in the "Scalability and Performance Principles" module.
In our last lesson, we constructed multi-tier caching architectures—a powerful solution for improving performance. But before implementing a solution, a senior engineer must first act like a detective: you need to systematically diagnose where and why a system is underperforming. You can't fix what you can't measure.
Today's lesson focuses on precisely that diagnostic process. Our learning outcome is to describe a systematic approach to identifying performance bottlenecks using key metrics. We'll move beyond random guessing or just running top and hoping for the best. Instead, we'll equip you with structured methodologies used by experts at top companies to quickly and accurately pinpoint performance issues. This is a critical skill to demonstrate in a system design interview, as it shows a mature, logical, and evidence-based approach to problem-solving.
1. The Landscape of Performance Problems
When a user reports "the system is slow," the root cause could be hiding anywhere in the stack. As an experienced backend engineer, you know the list of suspects is long.

Given this complexity, the first step is to adopt a deliberate methodology. Without one, engineers often fall into unproductive patterns.
Linux Performance Tools, Brendan Gregg, part 1 of 2
Let's begin by understanding the importance of a structured methodology. Brendan Gregg, a leading expert in systems performance, gives a great talk on this. In this first clip, he'll introduce the topic and describe some common but inefficient approaches, which he calls 'anti-methods'.
Watch the segment from 03:10 to 04:57, and then from 11:54 to 14:27. Pay attention to his description of the 'streetlight anti-method' (using familiar tools regardless of relevance) and the 'drunk man anti-method' (randomly changing things). You've likely seen these in practice; now you have a name for them.
To avoid these pitfalls, we'll learn three industry-standard methodologies: the USE method, the RED method, and the Four Golden Signals.
2. Methodology 1: The USE Method (Resource-Level)
The USE method, also developed by Brendan Gregg, is a fantastic starting point for any performance investigation. It's simple, comprehensive, and focuses on system resources. The core idea is: For every resource, check Utilization, Saturation, and Errors.
Monitoring Methodologies: RED and USE
This article from The New Stack provides a concise definition of the USE methodology.
Read the section titled 'USE — Utilization, Saturation, Errors'. Focus on the definition of each of the three components.
Let's break those down:
- Utilization: The percentage of time a resource is busy. For example, CPU utilization. A high value (e.g., >80%) is a starting point for investigation.
- Saturation: The degree to which the resource has extra work it can't service, often observed as a queue. For example, the run queue length for a CPU or an I/O queue for a disk. Saturation is a direct indicator of a bottleneck.
- Errors: The count of error events. These are often easy to interpret and can point directly to hardware or configuration faults.
The power of this method lies in its systematic checklist approach. You can create a mental map of your system's hardware (CPUs, memory, disks, network interfaces, interconnects) and apply USE to each one. This ensures you don't miss anything.
Applying the USE Method in Practice
Let's watch Brendan Gregg apply this method to solve a real problem. This is a masterclass in systematic debugging.
Linux Performance Tools, Brendan Gregg, part 1 of 2
In this segment, Gregg is faced with a report of 'high application latency' and uses the USE method to quickly find the culprit.
Watch from 36:18 to 41:25. Follow his thought process as he systematically checks each resource type: CPU: He uses top and sees moderate CPU usage but plenty of idle time. Conclusion: CPU is not saturated. Memory: He notes there's plenty of free memory and no swapping. Conclusion: Memory is not the bottleneck. Disks: He runs iostat and immediately sees high utilization (78%). He forms a strong hypothesis that this is the bottleneck. Network: He quickly checks network I/O and confirms it's idle. Notice how he reaches a confident conclusion in just a few minutes by following this checklist.
This demonstration shows how the USE method provides a clear starting point and, just as importantly, an ending point for the initial investigation. You can confidently report back, "The service metrics are poor, and the USE method points to disk saturation as the likely cause."
3. Methodology 2: RED & The Four Golden Signals (Service-Level)
The USE method is excellent for infrastructure resources. But for modern, service-oriented architectures, we also need to look at performance from the perspective of the service itself. This is where the RED and Four Golden Signals methodologies come in.
The RED Method
The RED method focuses on three key metrics for a request-driven service:
- Rate: The number of requests per second the service is handling.
- Errors: The number of requests that are failing.
- Duration: The time it takes to process a request, often measured in distributions (which we'll cover next).
The Four Golden Signals
This framework, popularized by Google's Site Reliability Engineering (SRE) culture, is even more comprehensive and is considered a standard at many top companies. It includes:
- Latency: The time it takes to service a request. (Same as RED's Duration).
- Traffic: A measure of demand on the system. (Same as RED's Rate).
- Errors: The rate of requests that fail. (Same as RED's Errors).
- Saturation: How "full" your service is. This is the crucial addition. It measures how close the system is to its capacity limits (e.g., memory usage, CPU load). It's a leading indicator of future problems.
What are the Four Golden Signals and Why Do They Matter?
This article from groundcover provides an excellent overview of the Four Golden Signals and compares them to the RED and USE methods.
Read the sections 'What are the Four Golden Signals?', 'How the 4 Golden Signals Impact SRE', 'Why Measure the Golden Signals?', and 'Golden Signals vs RED vs USE Methods'. The comparison table is particularly helpful for understanding how these frameworks relate to each other.
In an interview, starting your analysis with the Four Golden Signals shows that you think top-down, from the user's experience (Latency, Errors) and business logic (Traffic) before diving into low-level resources.
4. Deep Dive: Measuring Latency with Percentiles
When discussing the "Duration" of RED or the "Latency" of the Golden Signals, simply stating the average latency is a rookie mistake. Averages can be heavily skewed by a few extreme outliers and hide the true user experience. Senior engineers talk about latency in percentiles.
- p50 (median): 50% of requests are faster than this value.
- p95: 95% of requests are faster than this value. This is often used to measure the typical user experience.
- p99 / p99.9 (tail latency): 99% / 99.9% of requests are faster than this. This measures the worst-case experience. A high tail latency indicates that a meaningful fraction of your users are having a very slow experience, even if the average is good.
Percentile Tail Latency Explained (95%, 99%) Monitor Backend performance with this metric
Let's watch a short, clear explanation of why percentiles are superior to averages and how they are calculated.
Watch from 00:25 to 05:28. The key takeaway is understanding what 'p95 latency is 30ms' actually means: 95% of your users experienced a response time of 30ms or less.
In an interview, if you're talking about latency, make a point of saying something like, "I would look at the p99 latency to understand the experience of our most impacted users." This immediately signals seniority.
5. A Systematic Interview Narrative
Now, let's combine these concepts into a structured narrative you can use in an interview when asked to diagnose a performance issue.
Interviewer: "Your service is slow. How would you investigate?"
Your Response:
"My approach would be to start from a high level and systematically drill down.
1. First, I'd clarify the problem. As Brendan Gregg suggests in his 'Problem Statement Method,' I'd ask: 'What do you mean by slow? Are we seeing increased request latency, a drop in throughput, or a higher error rate?' Let's assume the issue is high latency.
2. Next, I'd look at the service-level metrics through the lens of the Four Golden Signals. I'd check our monitoring dashboard for:
- Latency: Is the p95 or p99 latency elevated?
- Traffic: Did the latency spike correlate with a change in traffic?
- Errors: Is the error rate also up?
- Saturation: Are any of our service-level saturation metrics, like thread pool usage or queue lengths, abnormally high?
3. Based on those signals, I'd form a hypothesis. For example, if latency and saturation are up but traffic is flat, it suggests a problem within the service or a downstream dependency. If latency, saturation, and traffic are all up, it points towards a scaling bottleneck.
4. With a hypothesis in hand, I would use the USE method to investigate the underlying server resources. For the servers running the service, I'd check:
- CPU:
topormpstatto check for high utilization or a long run queue (saturation).- Memory:
vmstatorfreeto check for memory utilization and swapping (saturation).- Disk I/O:
iostatto check for high disk utilization (%util) or a long I/O queue (avgqu-sz).- Network I/O:
sarto check for network interface utilization or dropped packets (errors).5. Finally, once the bottleneck is isolated to a specific resource, I'd use more granular tools to find the root cause. For instance, if the USE method pointed to high CPU system time, but disks and network are idle, I'd use a tool like
straceto see if the application is stuck in an inefficient system call loop, like reading a file zero bytes at a time."
This structured response demonstrates a clear, logical, and comprehensive thought process that moves from symptom to root cause.
Conclusion
Today you've learned to move from being a reactive debugger to a systematic performance investigator. Armed with these methodologies, you can confidently tackle any "the system is slow" problem, both in your daily work and in high-stakes interviews.
Key Takeaways:
- Avoid "anti-methods": Don't just run familiar tools randomly. Have a plan.
- Start with Service Metrics (Golden Signals/RED): Understand the issue from the service's perspective first (Latency, Traffic, Errors, Saturation).
- Drill Down with Resource Metrics (USE): Systematically check every resource for Utilization, Saturation, and Errors to isolate the bottleneck.
- Speak in Percentiles: When discussing latency, use p95 and p99 to demonstrate a sophisticated understanding of user impact.
- Structure Your Narrative: In an interview, walk the interviewer through your process from high-level signals to low-level resource analysis.
In our next lesson, we will close the loop. Now that you know how to identify bottlenecks, we will focus on how to fix them by mapping common performance bottlenecks to appropriate mitigation patterns.