← Math
Math

Units, dimensions, and conversions

Can 60 MiB cross an 8 Mbit/s link in 60 seconds?

Use units to check a transfer estimate before trusting its window decision.

Outcome

Reproduce a unit-aware calculation, vary its assumptions and justify the resulting decision.

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?

Size labels used in this lesson
LabelMeaningBytes
Bbyte1
kB / MB / GBDecimal prefixes1,000 / 1,000,000 / 1,000,000,000
KiB / MiB / GiBBinary prefixes1,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.

At an ideal useful rate of 8 Mbit/s, can 60 MiB finish within 60 seconds?

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.

main.ts
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
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?

main.ts
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
const setupMilliseconds = 500;
const seconds = setupMilliseconds / 1000;

console.log(seconds);
What numeric value does this program print?

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.

Two stages, one payload
StageStated rateSame rate in Mbit/s
Storage1 MiB/s8.388608
Link8 Mbit/s8
Which stage limits the transfer, and how long does 1 MiB take?

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.

Identify the quantity before choosing the bottleneck
StageSupplied rateWhat it countsUseful rate
Storage8 MiB/s = 67.108864 Mbit/sAlready-useful payload67.108864 Mbit/s
Link80 Mbit/sRaw wire; useful share 0.540 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.

The batch contains 1 MB and 2 MiB, with one 500 ms setup. Using the table, does a 1,100 ms window fit?

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.

Same printed seconds, different window decisions
Window in msExact comparison
333.3333exceeds
333.3334within

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.

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.

Estimate.tsx
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
"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
A dashboard changes a rate label from MB/s to Mbit/s but keeps the same numeric value. Is the represented rate unchanged?
Sources

The transfer model and worked values are derived here. They are not measured network results.

Report a problem in this lesson

For typos, mistakes and things that don’t work. We read every report and fix what’s wrong, but we don’t reply here, so a question won’t get an answer.