Log in

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

drawn/hrpeak 70044,00035,078maximumday 07142128

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 Share carries

That is a bucket. Here are ours: a Pro Share carries two of them, a Lite Share one. The cadence and the maximum are set when you buy and they never move.

ShareBucketRefillsMaximum
ProP11 credit / 5 min8,800
ProP21 credit / 1 min44,000
LiteP21 credit / 5 min8,800

Read the Lite and Pro rows against each other. Lite's bucket runs at the same cadence and the same maximum as Pro's slower one. Pro adds a second bucket that fills five times faster and holds five times as much.

A Pro Share has two buckets: a P1 bucket holding 8,800 credits that refills one credit every five minutes, and a P2 bucket holding 44,000 credits that refills one credit every minute. A Lite Share has no P1 bucket at all, and one P2 bucket holding 8,800 credits that refills one credit every five minutes. The same five-minute clock feeds Pro's P1 bucket and Lite's P2 bucket, which are the same size and the same rate. Pro's P2 bucket is drawn five times longer than the others because it holds five times as much.
One clock feeds Pro's P1 and Lite's P2 — same size, same rate, the same bucket in both Shares.

Both numbers scale with how many Shares you hold. Two Pro Shares carry a P2 bucket of 88,000 credits refilling at two credits a minute; three carry 132,000 at three a minute. The ratio between them never moves, so a larger entitlement still fills from empty in the same time. You get the deeper reserve and the faster refill together, not one at the cost of the other.

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.

A balance, not a countdown

Every Share carries its buckets from the day it starts, and they refill for as long as you hold it. Take a Share on the next server.