Skip to content
Marvex

Developer productivity

Code Review Is a Queueing Problem

A pull request waiting three days for its first comment is not a motivation problem. It is a queue, and queues behave in ways that are mathematically predictable and completely unintuitive.

An analysis of code review as a queueing system — arrivals, servers and utilisation — explaining why review latency grows non-linearly as reviewers get busier and which structural changes actually reduce the wait.

Developer ProductivityMarvex EngineeringEngineering Intelligence, Shiprocket12 min read
A developer reading code on a monitor in a quiet office

The system you actually have

Model code review the way you would model any service. Pull requests are arrivals. Reviewers are servers. Review effort is service time. The waiting room is the set of open, unreviewed pull requests. Once you draw it this way, several things that look like behavioural problems turn out to be properties of the configuration.

Three parameters determine almost everything. Arrival rate: how many pull requests appear per day, which is set by team size and how finely work is split. Service time: how long a review takes, which is driven overwhelmingly by change size. Server count: how many people can actually review a given change — not how many are nominally on the team, but how many have the context and permission to approve this particular diff.

That third parameter is where most teams are quietly broken. A team of eight might have effective server counts of one for the payments service, two for the API, and eight for the front end. The averages look fine. The payments queue is a single-server system, and single-server systems with any meaningful load are miserable.

Two more properties of real review queues matter. Arrivals are bursty rather than smooth — sprint rhythms and end-of-day pushes cluster them. And reviewers are not dedicated servers; review competes with their own delivery work, so their availability fluctuates with their own commitments. Both make the queue behave worse than a naive capacity calculation suggests.

  • Pull requests are arrivals, reviewers are servers, review time is service time
  • The server count that matters is per-area, not per-team
  • One qualified reviewer for a critical service is a single-server queue
  • Bursty arrivals and part-time servers make real queues worse than the average implies

Why the wait explodes rather than rising gently

Queueing theory’s most useful result for engineering managers is that waiting time does not grow linearly with utilisation. As utilisation — the fraction of available capacity being consumed — approaches one, expected queue time rises steeply and then vertically. Kingman’s approximation for a general single-server queue makes this explicit: the utilisation term takes the form rho over one minus rho, which is well behaved at 50 percent and catastrophic at 95 percent.

The practical consequence is that the last increment of busy-ness is far more expensive than any earlier one. Moving reviewers from 70 percent to 80 percent utilised does not cost 10 percent more waiting; it can double it. This is why a team can seem fine for months and then, after one modest increase in load or the loss of one reviewer, appear to fall apart overnight. Nothing broke. The system crossed the knee of the curve.

Kingman also shows that variability multiplies the effect. The wait scales with the variability in arrivals and in service times, so a team with wildly varying pull request sizes suffers more queueing than a team with the same average size and less spread. That is a direct argument for consistent, small changes that has nothing to do with reviewability: predictable service times make the queue itself cheaper.

Little’s law supplies the other half of the picture. In a stable system, average work in progress equals average arrival rate multiplied by average time in system. Rearranged, average wait equals work in progress divided by throughput. If open unreviewed pull requests double and review throughput does not, average wait doubles — regardless of how hard anyone tries.

  • Wait time follows rho over one minus rho — fine at 70 percent, brutal at 95
  • The last slice of utilisation costs far more than the first
  • Variability in size and arrival timing multiplies the wait
  • Little’s law: wait equals work in progress divided by throughput

The interventions, in order of leverage

Reduce service time first, because it helps every other term. Service time is dominated by change size, and the relationship is worse than linear: a reviewer holding a large diff has to keep more context in their head simultaneously, and beyond some threshold they stop reasoning about the change as a whole and start pattern-matching. Halving pull request size roughly halves service time and improves review quality at the same time — the only intervention here that improves both speed and depth.

Add servers next, meaning qualified reviewers per area rather than headcount. Find the areas with an effective server count of one and fix them deliberately: pair a second person through a few changes, rotate ownership, write the missing architecture note, or lower the approval requirement for low-risk paths in that area. Going from one server to two produces a much larger improvement in expected wait than going from four to five, which is a direct consequence of the shape of the curve.

Reduce arrival variability third. Encourage a steady flow rather than a Thursday afternoon flood of everything the team has been holding. Work-in-progress limits help here indirectly, by stopping people from batching up four half-finished branches and releasing them together.

Then attack utilisation directly, which is the uncomfortable one: it means deliberately leaving slack. A team planned to 100 percent of capacity has no reviewer availability, by construction. Slack is not idleness — it is the resource that makes the queue behave, and it is the first thing cut and the last thing anyone credits.

Finally, add scheduling discipline. Two short review windows a day beat continuous interrupt-driven review: they bound the wait without shredding maker time. A norm of first response before starting new work of your own converts an unbounded wait into a bounded one at almost no cost. Marvex can surface the state of the queue where the team already is — Velo answers delivery questions in Slack and WhatsApp as well as the web — so waiting changes are visible without anyone policing a dashboard.

  • Smaller changes cut service time and improve depth simultaneously
  • Fix single-reviewer areas: one server to two is the biggest available win
  • Smooth the arrival pattern; avoid end-of-sprint floods
  • Plan below 100 percent capacity — slack is what makes queues behave
  • Bounded review windows beat continuous interruption

What not to do, and why it fails

Do not add mandatory reviewers to raise quality. Requiring two approvals halves your effective server count for every change and moves the queue further up the steep part of the curve. If a specific class of change genuinely needs two sets of eyes — a schema migration, an auth path, a payment flow — scope the requirement to that class rather than applying it to typographical fixes in a README.

Do not solve review latency with a service-level agreement alone. A rule that says all reviews within 24 hours does not change arrival rate, service time or server count, so it cannot change the physics; it only moves the failure from a visible wait to a hidden compromise, usually a shallower review. An SLA is useful as a detector — persistent breaches tell you the configuration is wrong — not as a fix.

Do not fix a queue by asking people to try harder. Reviewer effort is the one term in the model that is already close to its maximum in most teams, and exhortation adds guilt without adding capacity.

And do not treat review as pure overhead to be minimised. Review is where defects are caught, where context spreads, and where new joiners learn the system. The goal is a short wait with the depth intact — which is exactly why speed measures should always be read next to a depth signal such as comments per change or the spread of reviewers across the team. Marvex reports review depth alongside pickup and review time for this reason.

  • Mandatory second approvals halve server count — scope them to real risk
  • An SLA detects a bad configuration; it cannot change the physics
  • Effort is already maxed out; exhortation adds guilt, not capacity
  • Optimise for short waits with depth intact, not for minimal review

Measuring the queue

Track four things. Time to first response, by percentile — this is the queue wait, and the tail matters more than the median because that is where the single-server areas hide. Effective reviewer count per area, which almost nobody measures and which explains more variance than anything else. Open unreviewed pull request count over time, which is your work in progress. And review depth, so you can tell improvement from erosion.

Segment by repository or service before you draw conclusions. An organisation-wide review latency number is an average over several queues with completely different configurations, and it will be dominated by whichever one has the most volume rather than whichever one is most broken.

Watch the tail specifically for context-starved areas. A distribution with a fine median and a long right tail almost always means a small number of areas where only one person can review, and those are exactly the areas where the concentration of knowledge is also a business risk.

When you intervene, predict the direction first. Adding a second qualified reviewer to a single-server area should compress the tail more than it moves the median; if the median moves and the tail does not, your model of the problem was wrong and it is worth finding out why before the next change.

  • Measure time to first response by percentile, not by mean
  • Measure effective reviewers per area — the most predictive and least tracked number
  • Segment by service; a global average hides the broken queue
  • Predict which part of the distribution should move before you intervene
code reviewqueueing theoryflowcycle timeWIP

Frequently asked questions

Why does code review get dramatically slower when the team gets slightly busier?

Because waiting time in a queue does not grow linearly with utilisation. Kingman’s approximation for a general single-server queue contains a utilisation term of the form rho over one minus rho, which is well behaved at 50 or 70 percent utilisation and rises very steeply as it approaches 100 percent. Moving reviewers from 70 to 80 percent utilised can double the average wait rather than adding 10 percent. This is why a team can appear healthy for months and then seem to collapse after one modest increase in load or the departure of one reviewer: nothing broke, the system simply crossed the knee of the curve.

What is the single most effective way to speed up code review?

Make pull requests smaller. Review service time is dominated by change size, and the relationship is worse than linear because a reviewer holding a large diff must keep more interacting context in mind at once. Smaller changes are picked up sooner, because a reviewer can fit them into a gap that already exists rather than waiting for a clear block of time; they receive more precise comments; and they generate less rework. It is the only common intervention that improves both review latency and review quality at the same time, which is why it belongs before adding reviewers or setting response targets.

Does requiring two approvals improve code quality?

Requiring two approvals on every pull request improves scrutiny on the change itself but halves the effective number of reviewers available for every change, which pushes the review queue further up the steep part of the utilisation curve and increases waiting time for everything. The usual result is longer waits and, under time pressure, shallower approvals — so quality gains are partly given back. A better configuration scopes the two-approval rule to classes of change where the risk justifies it, such as schema migrations, authentication paths or payment flows, and leaves routine changes on a single approval.

What is Little’s law and how does it apply to pull requests?

Little’s law states that in a stable system, average work in progress equals the average arrival rate multiplied by the average time an item spends in the system. Rearranged for code review, average waiting time equals the number of open unreviewed pull requests divided by review throughput. The practical implication is that if open unreviewed pull requests double while review throughput stays flat, average waiting time doubles as a matter of arithmetic, no matter how conscientious the team is. It is the formal reason that limiting work in progress reduces latency without anyone working faster.

Will a code review SLA fix slow reviews?

Not by itself. A service-level agreement such as "all reviews within 24 hours" changes none of the three parameters that determine queue behaviour: arrival rate, service time and the number of qualified reviewers. Under an unchanged configuration the target is met by reviewing more shallowly, which converts a visible delay into an invisible quality cost. An SLA is genuinely useful as a detector — persistent breaches localise which area of the codebase has a broken reviewer configuration — but the fix is still structural: smaller changes, more qualified reviewers in the starved areas, and planning below full capacity.

How do I find the review bottleneck in my organisation?

Segment by repository or service and look at time to first response by percentile rather than by mean. An organisation-wide review latency figure averages several queues with entirely different configurations and is dominated by whichever has the most volume, not whichever is most broken. Then count the effective reviewers per area — the people who actually have the context and permission to approve a given change, which is usually far fewer than team headcount. Areas with an effective count of one produce the long right tail, and they are also where knowledge concentration is a business risk.

Is slack capacity necessary for fast code review?

Yes, and it is a structural requirement rather than a nicety. Review competes with a reviewer’s own delivery work, so a team planned to 100 percent of its capacity has no review capacity by construction. Because expected queue time rises steeply as utilisation approaches full, the last few percent of planned load is disproportionately expensive in waiting time across every change the team makes. Deliberate slack is the resource that keeps the queue in the flat part of the curve; it is typically the first thing cut under pressure and the last thing credited when latency improves.

Marvex

See it on your own delivery data

Connect GitHub, GitLab or Jira and Marvex builds your DORA, cycle-time and sprint views from the history you already have.