Pidoku

Archive

This learning material is in the archive. It is not currently maintained and has not been updated with the latest information, so tool versions, prices and dates may be out of date.

Toil

Module 1 Lesson 1.c 35 min Difficulty 2/5

Prerequisites 1.a

The idea in one minute#

Toil is the operational work that is manual, repetitive, automatable, reactive, has no lasting value, and grows with the size of the service. Restarting a stuck process every week is toil. Writing the fix that stops it getting stuck is not.

Toil is not “work I dislike”. Some toil is unavoidable, and a little is even useful for staying close to production. The problem is that it grows linearly with traffic and services while the team does not, so unchecked it consumes everyone. SRE teams measure it, cap it at about half their time, and spend the other half removing it.

An analogy#

Bailing water out of a boat. Every bucket is useful in the moment, and if you stop, you sink. But if you spend all day bailing, you never patch the hole — and the boat that leaks twice as much next year needs twice as many people bailing.

A picture#

flowchart TB
  W["A piece of operational work"] --> M{"Manual?"}
  M -->|"no"| NT["Not toil"]
  M -->|"yes"| R{"Repetitive?"}
  R -->|"no, one-off"| NT2["Not toil<br/><small>overhead or a project</small>"]
  R -->|"yes"| A{"Automatable?"}
  A -->|"needs human judgement"| NT3["Not toil<br/><small>keep, but make it easier</small>"]
  A -->|"yes"| V{"Lasting value?"}
  V -->|"yes, the system improves"| ENG["Engineering"]
  V -->|"no, back to where we were"| T["TOIL<br/><small>measure, cap, automate</small>"]
  class W neutral
  class M,R,A,V queue
  class NT,NT2,NT3 neutral
  class ENG compute
  class T warn

How it really works#

The six properties#

From the Google SRE book, work is toil when it is:

PropertyExample of toilExample that is not
ManualSSHing in to clear a temp directoryA cron job that does it
RepetitiveEvery week, the same disk fillsA one-time migration
AutomatableSteps are written down and identical each timeDeciding whether to roll back a risky release
Tactical / reactiveDriven by an alert or ticketPlanned design work
No enduring valueThe service is the same afterwardsA config change that removes the cause
Grows with the serviceTwice the customers → twice the quota requestsFixed per-team overhead (meetings, HR)

Overhead (meetings, planning, training) is not toil. Neither is on-call itself — answering a page needs judgement — but the repetitive fix you apply after the third identical page is.

Measuring toil#

You cannot reduce what you do not count. Three practical methods:

  1. Ticket and page tagging. Every ticket and page gets a label (toil:cert-rotation, toil:quota-request). A monthly report sums time by label.
  2. Survey. Each quarter, each engineer estimates their percentage split between toil, on-call, project work and overhead. Crude but surprisingly stable.
  3. Interrupt logs. For one week, everyone writes one line per interruption: what, how long, could a machine have done it.

The output you want is a ranked list: toil source, hours per month, trend, cost to automate.

Deciding what to automate#

Automation has a cost: building it, maintaining it, and the new failure modes it adds. A simple payback rule:

hours saved per month  = frequency × minutes per occurrence ÷ 60
payback (months)       = hours to automate ÷ hours saved per month

Automate when payback is a few months, or when the manual step is error-prone (a typo in a manual failover is an outage), or when it blocks someone else (a developer waiting a day for a quota bump). Do not automate a task that happens twice a year and takes ten minutes — write a good runbook instead.

The automation ladder#

Automation is a ladder, not a switch. Climb one rung at a time:

  1. No automation. Knowledge in someone’s head.
  2. Runbook. Steps are written down; anyone on call can do it.
  3. Script. One command does the steps; a human decides when to run it.
  4. Self-service. The person who needs it (a developer) runs it themselves, with guardrails.
  5. Triggered automation. The system detects the condition and runs the fix, then tells a human.
  6. Autonomous. The condition can no longer happen — the system was redesigned.

The best toil reduction is often rung 6: not a faster way to clear the disk, but logs that rotate themselves.

A worked example#

An SRE team of six measures a month of interrupts:

Toil sourceTimes / monthMinutes eachHours / monthCost to automate (h)
TLS certificate renewal for internal services1245924 (cert-manager + alert)
Manually adding a customer to an allow-list801013.330 (self-service form + API)
Restarting a worker stuck on a poisoned message20206.716 (dead-letter queue)
Quarterly access review spreadsheet0.332401.340
Re-running flaky deploy pipeline40151020 (fix the flaky step)

The program below ranks these by payback. The quarterly access review is real work but not worth automating yet; the allow-list form pays back in about two months and also removes a developer’s wait.

Code#

Go
// toil.go — rank toil sources by payback and project how toil grows with the service.
package main

import (
	"fmt"
	"sort"
)

type source struct {
	name            string
	perMonth        float64 // occurrences
	minutesEach     float64
	hoursToAutomate float64
}

func (s source) hoursPerMonth() float64 { return s.perMonth * s.minutesEach / 60 }
func (s source) paybackMonths() float64 { return s.hoursToAutomate / s.hoursPerMonth() }

func main() {
	toil := []source{
		{"TLS cert renewal", 12, 45, 24},
		{"customer allow-list", 80, 10, 30},
		{"restart stuck worker", 20, 20, 16},
		{"quarterly access review", 1.0 / 3, 240, 40},
		{"re-run flaky deploy", 40, 15, 20},
	}
	sort.Slice(toil, func(i, j int) bool { return toil[i].paybackMonths() < toil[j].paybackMonths() })

	total := 0.0
	fmt.Printf("%-24s %10s %12s  %s\n", "source", "h/month", "payback", "decision")
	for _, s := range toil {
		total += s.hoursPerMonth()
		decision := "automate now"
		if s.paybackMonths() > 6 {
			decision = "runbook; revisit"
		}
		fmt.Printf("%-24s %10.1f %9.1f mo  %s\n", s.name, s.hoursPerMonth(), s.paybackMonths(), decision)
	}

	const team = 6
	const hoursPerEngineer = 140.0 // working hours per month
	fmt.Printf("\ntoil today: %.0f h/month = %.0f%% of a %d-person team\n",
		total, 100*total/(team*hoursPerEngineer), team)

	// Toil grows with the service; the team does not.
	fmt.Println("\nif traffic grows 60% a year and nothing is automated:")
	t := total
	for year := 1; year <= 4; year++ {
		t *= 1.6
		pct := 100 * t / (team * hoursPerEngineer)
		flag := ""
		if pct > 50 {
			flag = "  ← over the 50% cap"
		}
		fmt.Printf("  year %d: %5.0f h/month, %3.0f%% of the team%s\n", year, t, pct, flag)
	}
}

The second half of the output is the reason toil is capped: a manageable 5% today grows quietly, and nobody notices until the team is drowning.

Remember this#

  • Toil: manual, repetitive, automatable, reactive, no lasting value, grows with the service.
  • Measure it by tagging tickets and pages; rank by hours and payback.
  • Cap operational work at about 50%; spend the rest removing it.
  • Climb the automation ladder; the top rung is a redesign that removes the task.

Try it#

  1. Run toil.go. Change the growth to 100% a year. In which year does the team cross the cap?
  2. Keep an interrupt log for two days. Classify each item with the six properties.
  3. Pick your worst toil source and write the rung-6 version: what redesign would make it impossible?

Check yourself#

  1. Is answering a page toil? Is the fix you apply on the fifth identical page?
  2. Why does toil grow while the team stays the same size?
  3. When is a runbook better than automation?
  4. Give one risk that automation adds.

Sources#

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in