Continuous delivery asks for small batches: small pull requests, merged and deployed often. Each batch pays a fixed cost, call it : a CI run someone waits on, a review, a release. Smaller batches pay it more often. Finished work waiting in an unshipped batch costs something too: late feedback, drift from main, a larger blast radius. Call that the holding cost , what one unit of work costs for each unit of time it waits. Bigger batches hold more work for longer. The best size balances the two.
This is the Economic Order Quantity, which Ford Harris derived in 1913 for how many parts a factory should make per run [1] and Donald Reinertsen carries into product development [2]. With work arriving at rate , batches of pay the fixed cost times per unit time and hold on average units of waiting work, so the cost per unit time is
In software both costs are mostly time, so is the time a batch size costs a team each week: hours spent waiting on CI, review and release, plus the delay finished work spends unshipped. The batch term falls as grows and the waiting term rises, and their sum is smallest where they are equal: the best batch spends as much on batch overhead as on waiting work. Each term is then , so
Why the minimum is where the two costs are equal
The two terms multiply to , which doesn't depend on . Two positive numbers with a fixed product have their smallest sum when they are equal, since with equality at (the AM–GM inequality). Setting the derivative to zero gives the same point.
So batch size is an output of the costs, not a policy, and forcing it off the optimum costs time. Measure a batch against the optimum, : the batch term scales by and the waiting term by , and since the two split the minimum evenly,
"Make smaller PRs" while CI takes 45 minutes pushes below 1. At a quarter of the optimal size, , the team loses times the minimum, so people resist for a sound reason.
The formula names the lever instead. is how much work arrives and is what waiting costs; neither is the team's to set. is: it's the pipeline. Faster CI and automated deploys lower , and then two things fall as . falls, so smaller PRs become the best choice rather than a sacrifice. falls, so the floor on the hours the team loses each week drops. The square root sets the exchange rate: a pipeline four times cheaper justifies PRs half the size, not a quarter. Toyota made the same move in manufacturing with Shigeo Shingo's single-minute exchange of die, which cut die changes from hours to minutes and made small lots pay.
- slow CI/CD
- CI/CD four times cheaper
The cost curve is also flat at the bottom: missing by a factor of two either way, or , costs times the minimum. Getting the pipeline cheap matters far more than tuning the batch size exactly.
References
How Many Parts to Make at Once [link]
Harris, F. W., 1990. Operations Research, Vol 38(6), pp. 947–950. Institute for Operations Research and the Management Sciences (INFORMS). DOI: 10.1287/opre.38.6.947The Principles of Product Development Flow: Second Generation Lean Product Development
Reinertsen, D. G., 2009. Celeritas Publishing.