Terminology (5)Terms used in this lesson
Term on the front, definition on the back. Paste with tabs between fields and a new line between cards, or import the download in Anki as Basic.
- Dimension
- The kind of quantity, such as duration or data amount. Seconds and milliseconds measure the same dimension.
- Unit
- A specified scale for a quantity. The number and unit together describe its magnitude.
- Conversion factor
- A ratio of equal quantities in different units, used to change representation without changing the quantity.
- Useful throughput
- The rate at which the payload of interest is transferred, excluding overhead counted in a raw transfer rate.
- Useful share
- The fraction of a raw transfer rate available to the payload in the stated model.
Why this matters
Staff use the upload estimate while closing the shop. Reading a byte amount as bits can make the dashboard offer a window that the link cannot meet. Even the smaller difference between MB and MiB matters when the proposed window is close to the calculated duration.
We will build the estimate from labeled sizes, supplied rates and a connection setup duration. Sizes are nonnegative and rates are positive. The rates stay constant in this model; the calculation does not measure the shop’s network or predict its congestion.
What units contribute to a calculation
A dimension is the kind of quantity being measured, such as data amount or duration. A unit specifies its scale: seconds and milliseconds measure the same dimension. A conversion factor is a ratio of equal quantities, so multiplying by it changes the representation while preserving the amount.
To divide a data amount by a data rate, express both in a common data unit. Those units cancel and leave time. Bits and bytes differ by a factor of eight; decimal MB and binary MiB use different scales. Keeping the labels through the arithmetic makes both differences visible.
01Check the size
Carry the backup size into the link’s units
At closing time, a shop uploads a 60 MiB backup from its point-of-sale server to cloud storage. The scheduler proposes a 60-second window over the shop’s 8 Mbit/s uplink. You maintain the estimator: can that plan fit, and what can the staff dashboard honestly report?
| Label | Meaning | Bytes |
|---|---|---|
| B | byte | 1 |
| kB / MB / GB | Decimal prefixes | 1,000 / 1,000,000 / 1,000,000,000 |
| KiB / MiB / GiB | Binary prefixes | 1,024 / 1,048,576 / 1,073,741,824 |
Here Mbit/s means 1,000,000 bits per second. One second is 1,000 milliseconds. These labels are explicit: if a tool writes an ambiguous “MB” while meaning MiB, resolve that convention before calculating. NIST’s binary-prefix table gives the byte and binary-prefix definitions; BIPM lists the decimal prefixes.
Each conversion factor is a ratio of equal quantities. Its value is one; its orientation cancels the old unit. Dividing the rate by eight to obtain bytes per second gives the same duration.
const mebibytes = 1.5;
const megabitsPerSecond = 12;
const bytes = mebibytes * 2 ** 20;
const seconds = (bytes * 8) / (megabitsPerSecond * 10 ** 6);
console.log(seconds.toFixed(6));
console.log(((seconds * megabitsPerSecond * 10 ** 6) / 8).toFixed(0));
The helper prints 1.048576, then checks the inverse calculation: duration ×
rate returns 1572864 bytes. The inverse check catches an inverted conversion factor;
it does not validate whether the supplied rate is realistic.
02Include setup
Preserve the connection setup time
The estimator also receives a 500 ms connection setup duration, charged before the backup starts streaming. The total will be in seconds. Inspect this small setup helper before adding its result to the transfer estimate: what value will reach that addition?
const setupMilliseconds = 500;
const seconds = setupMilliseconds / 1000;
console.log(seconds);
03Compare the stages
Can storage keep the uplink supplied?
So far, the estimate assumes storage can keep the uplink supplied. The shop’s uploader reads backup data while sending earlier bytes. We model those stages as overlapping, with constant useful-payload rates and startup counted separately. Sustained transfer is limited by the slower stage; neither stage waits for the whole file before starting.
| Stage | Stated rate | Same rate in Mbit/s |
|---|---|---|
| Storage | 1 MiB/s | 8.388608 |
| Link | 8 Mbit/s | 8 |
Compare quantities expressed in one unit. Keep that unit attached when passing the selected rate to the next calculation: “8” alone does not say whether it means bits, bytes or millions of either per second.
If the storage rate doubled, this link would still limit transfer. Doubling the file size instead would double the transfer portion of the duration. This sensitivity check helps identify which input can change the decision. For the original 60 MiB backup, improving storage alone cannot make the 60-second window fit while the link stays at 8 Mbit/s.
04Interpret the rate
How much of the link carries backup data?
Now consider an upgrade: storage supplies 8 MiB/s and the proposed link is labeled 80 Mbit/s. The link figure counts all wire bits, while storage’s figure already counts useful backup data. Putting both in Mbit/s does not resolve that difference in meaning. The upgrade estimate also needs the link’s supplied useful share.
| Stage | Supplied rate | What it counts | Useful rate |
|---|---|---|---|
| Storage | 8 MiB/s = 67.108864 Mbit/s | Already-useful payload | 67.108864 Mbit/s |
| Link | 80 Mbit/s | Raw wire; useful share 0.5 | 40 Mbit/s |
Multiplying a raw rate by a useful share gives a useful rate. Applying that share again to an already-useful rate would count the same overhead twice. The link’s nominal rate is larger than storage’s, yet its useful rate is smaller.
The useful share is supplied for this planning model. We have not derived it from packet structure or measured it at the shop. An optimistic share would make the resulting duration optimistic too.
The uploader sends a batch over one connection, so its estimate must include every file and one setup duration. Check that composition with two small files before using the upgraded rates for the shop’s full backup.
05Make the decision
Compare the estimate before formatting it
The staff dashboard needs readable seconds, and the scheduler needs a window decision.
Keep the exact modeled duration for that decision and format a copy for display. A small
boundary test makes the difference visible: one byte at 3 bytes per second takes one third
of a second. Both of the following reports display 0.333333 seconds.
| Window in ms | Exact comparison |
|---|---|
| 333.3333 | exceeds |
| 333.3334 | within |
Rounding the duration first erases the distinction. The model accepts equality: 0.2 seconds plus 0.1 seconds fits exactly in 300 ms. Binary floating arithmetic can put that sum just above 0.3, so the lab preserves its bounded decimal quantities and compares exact integer ratios. The supplied helpers handle representation and display; you still convert labels, apply each stage's meaning and useful share, choose the bottleneck and add setup once.
Input decimals have at most four fractional digits. Display uses six places, rounded to nearest with ties to even: 1 byte at 1,024 bit/s takes exactly 0.0078125 seconds and prints 0.007812. That last-place display choice does not change a window decision. Real measured rates still carry uncertainty beyond this constant-rate model.
06Build the estimator
Make the backup-window decision reproducible
Implement the estimator the scheduler and dashboard will use. First preserve the size labels, then account for storage and link rates, then handle a batch with setup and different throughput meanings. Each level supplies the earlier working helpers. The complete program, input types and reader are visible, so the work stays on the calculation.
A store’s end-of-day upload
Convert sizes, compare rates, then interpret a batch estimate.
In the frontend Transfer estimates in Next.js and Svelte Optional
A manual-upload screen can estimate a selected backup file’s transfer time. Its file picker exposes the size in bytes. Label a rate input explicitly and keep the computed estimate separate from its rounded text. Changing the unit selector must change the conversion, not just the suffix.
In a Next.js client component, derive the estimate from the selected file and rate state before formatting the displayed value. In Svelte, a derived value can do the same calculation from those inputs. In either UI, label it as an estimate under the supplied rate; a progress bar needs actual transfer progress.
The frameworks change how updates reach the view. They do not change the quantity the number represents. The size property is specified in bytes.
"use client";
type Props = { file: File; megabitsPerSecond: number };
export function Estimate({ file, megabitsPerSecond }: Props) {
const seconds = (file.size * 8) / (megabitsPerSecond * 1_000_000);
return <output>Estimate: {seconds.toFixed(2)} s</output>;
}
These static excerpts receive a selected file and a positive useful rate in Mbit/s. Next.js rerenders the client component when those props change; Svelte tracks the derived value. They show the transfer-only calculation; the full batch estimate also accounts for setup and the limiting pipeline stage. Neither excerpt measures throughput. See Next.js client components and Svelte derived values.
Check this idea later
Sources
The transfer model and worked values are derived here. They are not measured network results.
Sign in to keep your read marks on every device. Sign in
Was this helpful?