The Four Golden Signals, RED and USE Explained
You open your shop's monitoring tool for the first time and it offers 2,000 metrics: memory pages, thread counts, network packets, garbage-collection pauses. Which ones matter? Engineers answered that long ago with short lists, and the most famous is the four golden signals. This lesson explains them, plus two related checklists called RED and USE, so you always know which handful of numbers to look at first.
The four golden signals
Google's Site Reliability Engineering book, in its chapter on monitoring distributed systems, says that if you can measure only four things about a service people use, measure these. Each is described below for an online shop.
Latency is how long a request takes to get an answer, such as how long the checkout page takes to respond. Measure failed requests separately: an error that comes back in 5 milliseconds would otherwise make the service look faster than it really is.
Traffic is how much demand the service is handling, usually counted as requests per second. A sudden drop is as interesting as a spike, because it can mean customers cannot reach you at all.
Errors means the rate of requests that fail. Some failures are obvious, like a 500 error code. Others are hidden, like an empty product list sent back with a success code.
Saturation is how full the service is, measured on whatever runs out first: processor time, memory, disk or a fixed pool of database connections. A shop using 95% of its database connections still works, but it is one busy moment away from turning customers away.
RED: for services people call
RED is a simpler checklist for request-driven services: anything that receives requests and sends answers, such as a web page or an API (a service that other programs call). Popularised by Tom Wilkie, it asks for three numbers per service.
- Rate: requests per second.
- Errors: failed requests per second, often shown as a percentage of all requests.
- Duration: how long requests take, usually shown as a percentile. "p95 = 310 ms" means 95 out of every 100 requests finished in 310 milliseconds or less.
These are the first three golden signals under new names: rate is traffic and duration is latency. RED leaves out saturation; you get that from the resources underneath, using USE.
USE: for the machines underneath
Services run on resources: processors (CPUs), memory, disks, network links and queues of waiting work. For every resource, the USE method from performance engineer Brendan Gregg asks three questions.
- Utilization: how busy is it? For example, the database's CPU was busy 71% of the time.
- Saturation: how much extra work is waiting because it is busy? For example, 12 database queries sitting in a queue.
- Errors: is it reporting faults, such as disk read errors or dropped network packets?
Notice that "saturation" means something slightly different here. In the golden signals it means "how full". In USE, "how full" is utilization, and saturation is the queue that forms once the resource cannot keep up.
Which method, when
The rule of thumb is short: RED for the services users call, USE for the machines and queues behind them. A real system needs both, because a slow checkout (RED) is often explained by a busy database disk (USE).
Saturation deserves special attention because it is an early warning. Rate, errors and duration describe what users are experiencing now. A queue that grows every minute describes what they will experience soon, while there is still time to add capacity or reduce the load.
A starter checklist
You do not need 2,000 metrics to begin. For a small shop, start with one RED row for each service users call (rate, error percentage, p95 duration) and one USE row for each key resource (CPU utilization, queue length, error count). Put the service rows on top, because they show what users feel, and the resource rows below, because they explain why.
When a service row turns red, look down at the resource rows beneath it for the cause. When a resource row turns amber while the service rows still look fine, as in this sketch, you have been given time to act before users notice.
Check yourself
Which method would you use for a login API, and which for the disk under its database?
RED for the login API, because users call it, and USE for the disk, because it is a resource the service runs on.
Why measure the latency of failed requests separately?
Fast errors would pull the numbers down and make a failing service look quicker than it really is.
A database is 70% busy, yet 40 queries are waiting in line. Which USE letter is the warning?
Saturation, because the waiting queue shows work is piling up, so users will soon wait longer even though utilization looks acceptable.