Bandwidth: link speed and monthly transfer
Two questions about a link
Section titled “Two questions about a link”The traffic estimate gives a rate of requests. Bandwidth turns it into bytes, and it answers two different questions.
- How fast must the link be at the peak? L = R × p × 8, where R is the peak requests per second, p is the average payload in bytes, and 8 is the number of bits in a byte.
- How much data does a month move? M = A × p × n × d, where A is the average requests per second, n is the 30 days of a month and d is the 86,400 seconds of a day.
Link speeds are quoted in bits per second and sizes in bytes. A byte is 8 bits, and a megabit per second is 1,000,000 bits per second, so 1 Mbit/s is 0.125 MB per second. Mixing the two up is an error of a factor of 8.
Mental model. A link has to carry the peak, so it is sized in bits per second at the peak. A month’s transfer, and the bill that follows from it, is a total in bytes, so it is built from the average.
Count the bytes in the direction you are sizing. For a shop, the responses leave and the requests are small, so the payload is the average response. The direction matters for the link, and it matters for the bill: the AWS architecture blog says that inbound data transfer is not charged across its services, while data transferred out to the internet is charged per service and region. Other providers have their own price lists.
Try it: the shop’s link
Section titled “Try it: the shop’s link”The shop’s peak is 1,852 requests per second, from the first lesson. Suppose its average response is 50 kB, a round number for illustration that you would replace with a measurement of your own. The calculator starts there, with a ratio of 4. Its fields are Peak requests per second, Payload per request and Peak-to-average ratio.
Bandwidth calculator
Your numbers
The busiest moment, because the link has to carry it. The traffic calculator gives it.
The average number of bytes one request moves in the direction you are sizing: usually the response, for data that leaves.
Used for the monthly transfer: a month moves what the average rate moves, not the peak held for a month.
Changing the numbers needs JavaScript. The result is for the starting numbers.
Result
Link speed needed at the peak741 Mbps
Over a month, the average rate moves 60 TB.
How it is calculated
Each step shows its formula, the numbers that go in, and the figure that comes out.
Link speed at the peak
L = R × p × w
The bytes per second at the peak, times 8 bits per byte. Link speeds are quoted in bits.
- R peak requests per second
- 1.85K
- p payload per request
- 50 kB
- w bits in a byte
- 8
L link speed at the peak741 Mbps
Average requests per second
A = R ÷ f
The peak divided by the peak-to-average ratio.
- R peak requests per second
- 1.85K
- f peak-to-average ratio
- 4
A average requests per second463
Data moved in a month
M = A × p × n × d
The average rate, times the payload, times the seconds in a month: n days of d seconds. In back-of-envelope mode a day is taken as 100 000 seconds.
- A average requests per second
- 463
- p payload per request
- 50 kB
- n days in a month
- 30
- d seconds in a day
- 86.4K
M data moved in a month60 TB
| Payload per request | Link speed at the peak | Moved in a month |
|---|---|---|
| 1 kB | 14.8 Mbps | 1.2 TB |
| 10 kB | 148 Mbps | 12 TB |
| 50 kB · your payload | 741 Mbps | 60 TB |
| 100 kB | 1.48 Gbps | 120 TB |
| 1 MB | 14.8 Gbps | 1.2 PB |
| 10 MB | 148 Gbps | 12 PB |
Model notes
Assumptions
- Every request moves the same average payload, in one direction. Real payloads vary, and the traffic in the other direction is not counted.
- A month moves what the average rate moves: the peak rate divided by the ratio you enter. If the real ratio is different, the monthly figure is off by the same factor.
Simplifications
- Only the payload is counted. Protocol headers and encryption add bytes on the wire, and compression removes some, so the link carries a different amount than this figure.
- Sizes use decimal units and link speeds are in bits: 1 Mbps is 10^6 bits per second, and a byte is 8 bits, so 1 MB per second needs 8 Mbps.
- A day has 86 400 seconds. In back-of-envelope mode it is taken as 10^5 seconds, the nearest power of ten, so the averages come out about 14% lower than the exact ones.
- 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. 1,852 requests of 50,000 bytes are 92,600,000 bytes per second, which is 92.6 MB per second, and × 8 bits makes 741 Mbps. A link of 1 gigabit per second carries 125 MB per second, as the performance module worked out (CPU, memory and I/O), so the shop would use 74% of it at the peak. That leaves little room for a spike, and the performance module showed what happens to latency as a resource fills.
The second figure is the month. The average rate is 1,852 ÷ 4 = 463 requests per second, and 463 × 50 kB × 30 days × 86,400 seconds is 60 TB a month. A month moves what the average rate moves. Using the peak for the whole month would give 1,852 × 50 kB × 2,592,000 seconds = 240 TB, four times too much, because the busiest moment lasts only part of the day, not the whole month. The factor is the peak-to-average ratio itself.
The table under the steps compares payload sizes with your other numbers. Ten times the payload is ten times the link and ten times the transfer: at 1 kB the peak link would be 14.8 Mbps, and at 1 MB it would be 14.8 Gbps.
Bits are not bytes
Section titled “Bits are not bytes”The two conversions to practise are bytes to bits and peak to month. Here are three short questions.
Bandwidth: check your understanding
This quiz needs JavaScript to check your answers.
What happens if the payload grows tenfold?
Section titled “What happens if the payload grows tenfold?”Suppose the shop starts to send larger images, and the average response goes from 50 kB to 500 kB. Change Payload per request to 500.
The peak link becomes 7.41 Gbps. It no longer fits a 1 Gbps link, and it would use 74% of a 10 Gbps one. The month moves 600 TB. The number of requests did not change and the processors may be nearly idle. The link is the limit, as the performance module found for network capacity.
What helps is to send fewer bytes, by compressing or resizing, or to serve them from closer. Suppose an edge cache answers 90% of the requests, which is a hit ratio of 90%, as in CDNs, edge caching and anycast. The origin then sends only the 10% that miss: 0.1 × 7.41 Gbps = 741 Mbps, the same as before the payload grew. The traffic has not vanished. The edge’s network carries the rest. What shrinks is the origin’s link, and the origin’s outbound transfer with it.
- Bandwidth answers two questions: the link speed at the peak, L = R × p × 8, and the data a month moves, M = A × p × n × d.
- A byte is 8 bits. A link of 1 Gbps carries 125 MB per second, and 1 Mbit/s is 0.125 MB per second.
- For the shop, 1,852 requests per second of 50 kB need 741 Mbps, which is 74% of a 1 Gbps link, and a month at the average of 463 per second moves 60 TB.
- Holding the peak for a month would give 240 TB, four times too much: the link uses the peak and the monthly total uses the average.
- A tenfold payload is a tenfold link and a tenfold transfer: 7.41 Gbps and 600 TB. An edge cache with a hit ratio of 90% leaves 10% of it on the origin’s link, 741 Mbps again.
Your progress
Built by GhaziAlibi.
© ShardCraft. All rights reserved.