## Is there hope for your streaming system?part 3: deriving the model

[This is part 3 of a series.]

It’s finally time to get down to some math! Please don’t be put off by all the “sigmas” in the following. It’s actually pretty simple, and the use of summations prevents a lot of “hand waving” that creeps into other methods of derivation.

Media devices are primarily characterized by raw data throughput and seek times. Raw throughput is how quickly data is read when no seeks are involved. Seek times determine how long it takes to reposition the read head and refocus the laser when data is requested from a different portion of the disc. There is much to be said about these characteristics, but that will be saved for future installments rather than digressing here.

In applications (such as open-world games) which must dynamically read different parts of the media, both reads and seeks are involved, and the effective throughput of the device (when seeks are accounted for) is reduced compared to its raw throughput. The following derives an equation for the effective throughput.

The first thing to note is that reads and seeks occur in pairs. A series of $n$ read/seek pairs proceeds as follows:

$\text{read 1: } b_1 \text{ bytes for } t_1 \text{ seconds}$
$\text{seek 1: } s_1 \text{ seconds}$

$\text{read 2: } b_2 \text{ bytes for } t_2 \text{ seconds}$
$\text{seek 2: } s_2 \text{ seconds}$

$\ldots$

$\text{read } n \text{: } b_n \text{ bytes for } t_n \text{ seconds}$
$\text{seek } n \text{: } s_n \text{ seconds}$

The following definitions are (hopefully) self-explanatory given the preceding:

$n = \text{ number of read/seek pairs}$
$i = 1, 2 \ldots n$
$b_i = \text{ bytes read in block } i$
$t_i = \text{ time taken to read } b_i \text{ bytes}$
$s_i = \text{ time spent seeking following } b_i$

Given the above definitions, the average bytes per read, $b$, is the total bytes read over the number of reads, and results in the equation at right:

$b = \frac{\sum b_i}{n} \quad \Rightarrow \quad \sum b_i = nb \qquad (1)$

The average seek time, $s$, is the total time spent seeking over the number of reads, yielding the equation at right:

$s = \frac{\sum s_i}{n} \quad \Rightarrow \quad \sum s_i = ns \qquad (2)$

Raw throughput, $r$, is the ratio of the total bytes read to the total time spent reading, excluding seek times:

$r = \frac{\sum b_i}{\sum t_i} \quad \Rightarrow \quad \sum t_i = \frac{\sum b_i}{r}$

Substituting $nb$ for $\sum b_i$ from $(1)$ yields:

$\sum t_i = \frac{nb}{r} \qquad (3)$

The effective throughput, $r_\text{eff}$, is the ratio of total bytes read to the total time spent, this time including seeks:

$r_\text{eff} = \frac{\sum b_i}{\sum t_i + \sum s_i}$

Substituting $nb$ for $\sum b_i$ from $(1)$, $\frac{nb}{r}$ for $\sum t_i$ from $(3)$, and $ns$ for $\sum s_i$ from $(2)$ yields:

$r_\text{eff} = \frac{nb}{\frac{nb}{r} + n s}$

Which reduces to the primary result for the effective throughput, $r_\text{eff}$:

$r_\text{eff} = r \frac{b}{b + rs}$

where (to recap):
$r =$ average raw throughput,
$s =$ average seek time
$b =$ average block size

Because the meaning of the above equation may not be entirely intuitive, subsequent posts will discuss the result in more detail, along with graphs which provide better insight into the relationships between the parameters.

[Stay tuned for part 4...]

• [...] [Continue to part 3...] [...]

• Oisín says:

Very strange – the rendered equations don’t appear in (my) Firefox, apparently because of an SSL cert problem, and the images are https URLs:

“s.wordpress.com uses an invalid security certificate.
The certificate is only valid for the following names:
[...]

• John Giors says:

Thanks for the feedback. I tried viewing the post with Firefox and the equations are rendering correctly (for me).

I don’t know exactly why you’re getting the “invalid security certificate” bitmaps, but it appears to be due to your browser attempting to use https instead of http to connect to s.wordpress.com.

Maybe you’re wondering why it’s connecting to s.wordpress.com. In short: the LaTeX plugin is using the s.wordpress.com server to render equations into bitmaps. The html generated by the plugin contains http links to those bitmaps.

However, the links are http, not https (verified by viewing html source in Firefox). The only thing I can think of is that there is a browser setting (or a plugin) which attempts https for some reason.

• Oisín says:

You’re absolutely correct John! Turns out it’s due to the httpsanywhere plugin which indeed tries to use https for WordPress – luckily I can disable the behaviour.

Sorry for the noise, my fault :)

• John Giors says:

Glad to hear you got it working, and no need to apologize. Feedback about site issues is useful. It may help another person as well.