Cost estimation: from users to a bill
Quantities times prices
Section titled “Quantities times prices”A bill is a list of quantities, each multiplied by a unit price. Three lines cover a simple web system.
- Instances: the number of instances times the price of one for a month.
- Storage: the gigabytes kept times the price of a gigabyte for a month.
- Outbound transfer: the gigabytes sent out times the price of a gigabyte.
The earlier lessons produced the quantities. The prices come from a provider’s price list, and they change. The calculators in this module ship with no prices, and so does this lesson: the prices used here are round numbers for illustration, in no currency, and are nobody’s real prices.
Mental model. A cost estimate is a capacity estimate with a price on each quantity. The estimates give the quantities. The prices are inputs that you look up, and a figure that depends on them is only as good as they are.
The FinOps Foundation calls the practice of relating spend to what it buys unit economics, and gives the cost per transaction as an example. The cost of a million requests is a unit cost of the same kind. It makes two months with different traffic comparable.
The chain
Section titled “The chain”Everything below comes from the shop of the earlier lessons.
| Quantity | Where it comes from | Figure |
|---|---|---|
| Peak requests per second | 1 million users, 40 requests each, a ratio of 4 | 1,852 |
| Instances | The peak ÷ (400 × 60%), rounded up | 8 |
| Data sent out in a month | 463 requests per second on average, 50 kB each, 30 days | 60 TB, which is 60,000 GB |
| Storage kept | 40 million events of 1 kB a day, 3 copies, 30 days | 3.6 TB, which is 3,600 GB |
| Requests in a month | 40 million a day, 30 days | 1,200 million |
Now add prices: 100 per instance per month, 0.1 per gigabyte stored per month, and 0.05 per gigabyte sent out. They are the calculator’s starting prices.
Try it: the shop’s bill
Section titled “Try it: the shop’s bill”The calculator below starts on those quantities and prices. Its fields are Instances, Price of one instance, Storage kept, Price of storage, Outbound transfer, Price of outbound transfer and Requests per month.
Cost calculator
Your numbers
How many servers or instances you run, for the whole month.
Per month, in whatever currency you use. The starting number is a round figure for illustration, not any provider's price.
The data you keep, in gigabytes, for the whole month.
Per gigabyte per month, in the same currency. Take it from the price list of the product you use.
The data sent out to users and to other networks in a month, in gigabytes. The bandwidth calculator gives it.
Per gigabyte, in the same currency. Check which direction your provider charges for: it is often the data that leaves.
Used only to work out the cost of a million requests.
Changing the numbers needs JavaScript. The result is for the starting numbers.
Result
Monthly cost4.16K
That is 3.47 per million requests.
How it is calculated
Each step shows its formula, the numbers that go in, and the figure that comes out.
Instances
C_i = n × a
The number of instances times the price of one instance for a month.
- n instances
- 8
- a price of one instance per month
- 100
C_i cost of the instances800 (share of the monthly cost: 19.2%)
Storage
C_s = G × b, with G in GB
The gigabytes kept times the price of a gigabyte for a month.
- G storage kept
- 3.6 TB
- b price per GB per month
- 0.1
C_s cost of storage360 (share of the monthly cost: 8.65%)
Outbound transfer
C_e = E × e, with E in GB
The gigabytes sent out times the price of a gigabyte.
- E outbound transfer in a month
- 60 TB
- e price per GB transferred
- 0.05
C_e cost of outbound transfer3K (share of the monthly cost: 72.1%)
Monthly cost
C = C_i + C_s + C_e
The three lines added up.
- C_i cost of the instances
- 800
- C_s cost of storage
- 360
- C_e cost of outbound transfer
- 3K
C monthly cost4.16K
Cost per million requests
c = C ÷ (Q ÷ 1 000 000)
The month's cost divided by the number of millions of requests.
- C monthly cost
- 4.16K
- Q requests per month
- 1.2B
c cost per million requests3.47
Model notes
Assumptions
- You enter every price. The starting prices are round numbers for illustration, in no particular currency, and are not the prices of any provider.
- Each price is one flat rate. Real prices can have tiers, discounts for commitment and free allowances, which change the bill.
Simplifications
- Only instances, storage and outbound transfer are priced. Requests, operations, support, people and the other services a real bill includes are not counted.
- The figures are one steady month. Growth, peaks that need extra instances and changes during the month are not modelled.
- In back-of-envelope mode, the counts and sizes you enter are rounded to the nearest power of ten before anything is calculated. The result is an order of magnitude, not a figure to buy against.
Parameter values are illustrative. They are not benchmarks of any real product.
Follow the steps. The instances cost 8 × 100 = 800, which is 19.2% of the bill. Storage costs 3,600 × 0.1 = 360, which is 8.65%. Outbound transfer costs 60,000 × 0.05 = 3,000, which is 72.1%. The total is 4,160, which the calculator shows as 4.16K. Divided by 1,200 million requests it is 3.47 per million requests.
The line to look at is not the one people think of first. The instances are less than a fifth of the bill, and outbound transfer is nearly three quarters of it. That follows from these illustrative prices, and different prices would put another line first. The estimate is worth doing because it tells you where to look, and the price list is the part you must check.
What redundancy adds
Section titled “What redundancy adds”The 8 instances carry the peak at 60% utilisation. A system that must keep serving when instances fail needs spares. The SRE book gives as an example of such a requirement N + 2 redundancy: enough for the demand, and two more.
With N = 8 that is 10 instances, so the instances line is 10 × 100 = 1,000 and the total is 4,360, which is 200 more, 4.8%. The cost per million requests rises from 3.47 to 3.63. What the spare copies buy in availability is in the earlier module on it (Availability). The estimate shows what they cost.
What happens if the retention goes from 30 days to a year?
Section titled “What happens if the retention goes from 30 days to a year?”Change Storage kept to 43,800, which is the storage lesson’s figure of 43.8 TB for a year of logs in three copies.
Storage now costs 43,800 × 0.1 = 4,380. The total is 800 + 4,380 + 3,000 = 8,180, almost double the 4,160. The cost per million requests is 6.82. Storage has become the largest line, with 53.5% of the bill, ahead of outbound transfer with 36.7%. A decision that looked like a detail, how long to keep the logs, now costs more than five times the whole fleet: 4,380 against 800.
Compare it with the other lever. Halving the payload, by compressing responses, halves the outbound transfer to 30,000 GB, which saves 1,500 a month, 36% of the original bill. Returning the retention from a year to 30 days saves 4,020. At these prices the retention rule is the better lever by far, and it takes no engineering. At other prices the answer may differ, and the estimate is what lets you ask.
- A bill is quantities times unit prices. The capacity estimates give the quantities, and the prices are inputs from a price list that changes. The prices here are illustrative, in no currency.
- For the shop, 8 instances at 100, 3,600 GB at 0.1 and 60,000 GB sent out at 0.05 make 800 + 360 + 3,000 = 4,160 a month, and 3.47 per million requests.
- The largest line is not always the obvious one: outbound transfer is 72.1% of this bill, and the instances only 19.2%.
- Redundancy costs instances: N + 2 means 10 instead of 8, which adds 200, or 4.8%.
- Keeping logs a year instead of 30 days makes storage 4,380 and the bill 8,180, almost double, with storage now the largest line at 53.5%. Halving the payload saves only 1,500.
Next: the module recap and quiz, which covers all five lessons.
Your progress
Built by GhaziAlibi.
© ShardCraft. All rights reserved.