Systems and complexity
Stocks and flows
A stock is what has accumulated; flows are the rates that change it. The stock moves only as fast as inflow minus outflow.
Jay Forrester's system dynamics; Donella Meadows, Thinking in Systems (2008); tested on students by Linda Booth Sweeney and John Sterman (2000).
Picture a bathtub. The water level is the stock; the tap and the drain are flows. The level rises when the inflow exceeds the outflow, falls when the outflow exceeds the inflow, and holds still when they match, however large each flow is. Meadows wrote that if you understand the dynamics of stocks and flows you understand a good deal about the behaviour of complex systems. Stocks are a system's memory: they change slowly, they lag their flows, and they buffer shocks, which is why a system keeps moving after you have changed the thing that was driving it.
The idea earns its place because people reason about stocks as if they were flows. Cutting emissions by 10% does not cut the carbon dioxide in the air; it slows the rise. A loan balance falls only while payments exceed interest plus new borrowing. A queue's depth is a stock and its arrival and service rates are flows: if arrivals exceed service, the depth grows without bound no matter how fast the service is in absolute terms. Most delays in a system are stocks that have to drain, and most overshoot comes from trying to make a stock jump.
The failure is not confined to novices. Sweeney and Sterman found it in graduate students at one of the world's best engineering schools, and most of their subjects had engineering or science degrees. The usual mistake is to draw a stock as a copy of its own inflow and call that a forecast, which they named spreadsheet thinking: treating change as something that happens in discrete jumps at reporting dates instead of continuously. Check which quantity is the accumulation, which are the rates, and whether the rate you are changing is large enough to flip the sign of the net flow. If it is not, the stock will keep moving the way it was, and the only thing you have changed is the speed.
Example
In a study published in 2000, Linda Booth Sweeney and John Sterman gave students in the introductory system dynamics course at MIT's Sloan School a graph of water flowing into and out of a bathtub and asked them to sketch the water level. With a square-wave inflow, 143 students scored an average of 77% on the coding criteria; with a sawtooth inflow, 150 students averaged 48%, and only 37% correctly related the net flow over an interval to the change in the stock. More than half had undergraduate degrees in engineering, mathematics, computer science or the sciences, and the authors reported that performance did not vary with prior education, age or national origin.
Where it applies
Consumer lag on a Kafka topic is a stock: it falls only while the processing rate exceeds the arrival rate, and adding consumers helps only if it moves that difference. Backlog, technical debt and the training data behind a model all accumulate the same way.
Think about it
Pick a number you want to lower this quarter: is it a stock or a flow, and which flows actually move it?
Applied it to something real? Log it.
Test yourselfInflow to a tank drops from 10 litres a minute to 6 while the outflow stays at 5. What happens to the level?
It keeps rising, just more slowly. A stock falls only when outflow exceeds inflow; cutting the inflow does not drain it.
Related models
- Feedback loopsA system's output feeds back into its input: balancing loops hold a level steady, reinforcing loops make change grow on itself.
- Bottlenecks and the theory of constraintsA system's throughput is set by one constraint; improving anything else is wasted effort until that constraint is fixed.
- Second-order thinkingKeep asking "and then what?" until you have looked at the consequences of the consequences.
- Little's lawIn any stable system the average number of items inside equals the arrival rate times the average time each spends inside: L = λW.