Credits that come back
A maximum and a refill. Credits arrive on a clock and stop when the bucket is full, so what you hold is a balance rather than a budget for the month.
A maximum and a refill
Credits arrive in a bucket at a fixed rate: one at a time, on a clock, all day and all night. The bucket has a maximum, and once it is full the credits that keep arriving are simply lost. Work you send takes credits back out.
That is the entire mechanism. Spend some and the refill starts putting them back straight away; stop for a while and you are holding a full bucket again.
Two numbers doing two different jobs
The refill rate sets what you can keep up indefinitely. Send at that rate and the balance never moves — you could hold it for a year and nothing would change.
The maximum sets how far above that rate you can go in one stretch. It is a reserve, built up in every hour you were not working, and spending it is exactly what it is there for. Rate and capacity are separate limits, and a system that publishes only one of them has told you very little about the other.
The idea is older than us, and worth reading about on its own terms. We wrote up the three usual ways to build it in Three variations on the leaky bucket. Ours is the third one, a replenishing budget, with one change described below.
There is no time horizon
This is where a bucket parts company with the things it looks like. An allowance has a period and resets on its boundary. A rolling window has a horizon and measures your recent use against it. A bucket has neither. There is no interval, nothing resets, and there is no moment at which old usage stops counting or new usage starts again.
A window or a rate limit refuses you when you cross it. That is what they are for. A bucket refuses nothing at all — it is an account, not a gate. The balance is a fact about what you hold, and holding none of it is not an error state.
It has no floor either. Send something that costs more than the balance and the bucket goes below zero, then refills from there at exactly the rate it always had. Nothing is forgiven and nothing is written off, which is why the debt is worth taking seriously; but a bucket in debt is not an account that has been suspended, it is an account that owes its own refill some time.
Watch one under real work
Nobody works at a constant rate, and a bucket only becomes interesting when they don't. Set its two numbers, pick a schedule, and watch it drain while you are at it and refill in the gaps.
Two things are worth trying. Change the schedule without touching the intensity: the same amount of work, spread differently, can be comfortably absorbed or run the bucket into debt. Then raise the maximum and watch the line fall at exactly the same angle, just starting higher — a bigger reserve buys you longer, never a higher sustained rate.
The bucket
The shape of the work
Refill
1,400
credits a day
This shape draws
1,200
a day · busiest 8,400
Lowest balance
36,242
never in debt
The refill covers this: 1,200 credits a day drawn against 1,400 refilled, so the reserve only has to absorb the bursts. It does — the balance never falls below 36,242, and it is back at the maximum whenever you stop for long enough.
What a full bucket holds
Every bucket takes about 31 days to fill from empty. That is true of all three: the faster bucket has a proportionally larger maximum, so the time to fill comes out the same. A full bucket is roughly a month of its own refill, saved up and waiting.
Put that in requests and it stops being abstract. A coding turn of the shape priced earlier costs 6.66 credits, so a full Pro P2 bucket holds about 6,600 of them. Its refill alone pays for about 216 turns a day, every day, on top of whatever the reserve is holding.
What the balance is for
None of this is a bill. The price was fixed before you arrived, the buckets came with the Share, and no arithmetic here reaches your card at the end of the month.
What the balance does is decide how your work is treated when other people want the server at the same moment as you. Resolving contention is where that happens.