# Performance tests

> From the Guides page of the Rtorrent 16 panel, version 16.29-14U. Polish: https://nasutils.net/rtorrent16/docs/pl/performance.md

The Performance page measures the internet link and the disks of this NAS and proposes settings from what it
measured. A test changes no setting: from a result you apply what you want, or nothing, and the next test can start
either way.

## Run a test

*Figure: The Test card on the Performance page*

1. Under **What to test**, pick **Link** (latency, download, upload), **Disk** (four access patterns on one
   disk) or **Link and disk**.
2. For a disk test, pick a volume under **Disk to test**.
3. For a link test, type the speeds of your internet plan in Mbit/s, or leave the fields empty. The proposals
   use the lower of the plan and the measurement.
4. Leave **Pause torrents during the test** on, so the torrents do not compete with the measurement. They start
   again when the test ends or you stop it.
5. Press **Run test**.

While the test runs, its card comes first on the page with the step it is on, the time so far, a live chart of the
link or the disk, and **Stop test**. During a link test the card also shows the test servers on the world map, the
place being tested lit with its country, and beside the map each place with its download and upload. The link chart
shows all traffic on the interface as **Incoming** and **Outgoing**. The disk charts follow the tested volume under its
QTS name; the list above them offers the other volumes by name. On a phone the row of **Run test** stays at the bottom of
the screen, just above the menu bar, while the Test card is in view, however long the list of disks is.

## Apply what a test proposes

*Figure: A result and its proposed settings*

Turn on **Advanced** at the top of Performance to see detailed measurements and Proposed settings.
The test controls and result summary stay available in the basic view. This browser remembers the same view choice
on Settings and Dashboard; it does not enable Developer mode or auto-tuning.

1. Open the test under **Test results**. A test that has just ended opens by itself.
2. Under **Proposed settings**, tick the rows you want. Each row shows the value now and the value proposed,
   with the reason; the tooltip of a reason names its rule. If the test measured less than half of the upload your
   earlier tests measured, the upload limit is not ticked: run the test again before you apply it.
3. With the slider, set how much of the link stays free for other traffic. Raise it if other traffic stutters
   while the torrents run at full speed.
4. Press **Apply settings**. It saves the ticked rows and passes them to the running rtorrent where rtorrent
   takes them live. A note under the button names a setting that needs a restart.

A result keeps its proposals until you apply them, so you can run another test first. After an Apply, the result's
row in **Test results** shows how many settings you applied and when, and a row you applied leaves the proposals.

## Run a test from the shell

```
/etc/init.d/rtorrent16.sh perf disk --volume /share/CACHEDEV2_DATA   # the disk test on another volume, by its path
/etc/init.d/rtorrent16.sh perf full                                  # link and disk on the download folder
```

The command prints the result as a table, and the page lists it with the others.

## How it works

![How a test becomes proposals: what it measures, the rules that turn the figures into settings, and the Apply that only you start](https://nasutils.net/rtorrent16/docs/img/perf-wizard-en.svg)

A link test measures against public test servers, starting with the place nearest to the address the internet sees
(see [Test servers](#test-servers)): two download and two upload runs, with the latency taken from the download's first
requests, and keeps the median of each.
A disk test
runs fio's sequential writes and reads and its random reads on the chosen volume. The rules then turn the figures,
together with the RAM, the processor and the filesystem of this NAS, into proposed settings, each with its reason.
Auto-tuning (Developer mode) takes the newest link measurement as its own starting point.

## Details

### Test servers

The link test finds where your public address is and measures the nearest place first: in Poland that is Warsaw.
Then it measures three reference points, each with one short run: the European backbone (Frankfurt), France (Paris,
with OVHcloud's Roubaix servers) and the United States (Ashburn). Every row is a different country. When you are in
one of those countries yourself, that row moves to the next place on its list: in Germany the backbone row is
Amsterdam, in France the France row is Brussels, in the US the US row is Montreal. Each place shows its own figures
and ping under **Test servers**, and only the nearest place wears the **Nearest** badge. The proposals use the fastest
download and the fastest upload of all places, shown in bold, because a slow test server says nothing about your link.

Each place has servers from several providers: Vultr, EDIS Global, Leaseweb, Hetzner, OVHcloud, Dediserve, Init7,
Cloudflare and the operators of public LibreSpeed servers. Warsaw has four. The test tries them in a different order
every time and moves to the next one at once when a server refuses, does not answer, stalls or sends almost nothing.
Some servers limit tests from one address: Vultr accepts one request a minute, Cloudflare about one full test an hour.
The test keeps to those limits and puts a server that refused at the end of the list until it accepts tests again, so
tests run one after another still reach a server that answers. Fewer public servers take uploads, so a place may have
only one server for the upload (in Warsaw, Cloudflare).

The **?** beside a place lists what each server answered and which server gave the result. For a server that limits
your address, it also says how long after that test the server accepted no tests from it. A place shows **No server
measured** only when all of its servers failed, and the next nearest place in another country then stands in for it.

When Rtorrent 16 is bound to an interface in Settings (**Bind to interface / IP**, for example a VPN's), the test runs
through that interface, and the result names it: "Measured through tun0, the interface Rtorrent 16 is bound to." When
that interface is not connected, the test does not run, so it never measures another connection by mistake.

### What a volume entry shows

The **Download folder** comes first under **Disk to test**, with the name of its volume beside it, then every other
internal volume of the NAS under the name Storage & Snapshots gives it, such as DataVol1. On QuTS hero every shared
folder is a volume of its own and carries the folder's name.

Each entry under **Disk to test** shows the folder the test writes in (as chips), the filesystem, HDD or SSD, the free
space and the size of the test file. Hold the pointer on that line for the volume's mount and its device. A volume
other than the download folder's is marked **same disks as the downloads** or **other disks**.

For the **Download folder**, the test writes in `.rt16-perf` in the base folder, `/share/Rdownload16`. On another volume
it writes in that volume's `.rt16-perf` folder and removes the folder after the test.

### The test file

The test file is twice the RAM, at least 4 GiB, and at most a tenth of the free space. The test needs twice the
file's size free. A volume with less shows **Too little free space** with both figures, and you cannot pick it. You
cannot pick a filesystem the test cannot measure either: exFAT, NTFS, a network share.

### When Run test is disabled

**Run test** starts a test whatever you did with the last result. It stays disabled while another test runs, while
the measuring service (rt16-perfd) is down (start it on the Dashboard, under Services), while the list of disks
loads, and when the chosen disk cannot take the test.

### Test results

**Test results** lists the last ten tests, newest first: the time to the second, what was tested, on which disk, how
the test ended (an interrupted test is grey), the link figures and the disk's sequential write. A result you open
yourself stays on screen while other tests run.

A result shows how it was measured, the figures, the disk's four access patterns and, when it has them, one sample
per second, then **Proposed settings**. The access patterns have plain names (sequential write, random read while
seeding); the tester's own names, such as SEQ_W, and the device are in the tooltips. **Apply settings** is disabled
while a test runs. A row already equal to its proposal is not proposed.

### A disk test away from the downloads

A disk test on a volume off the downloads' own disks gives figures to compare with. It proposes no disk setting (the
download rate cap from the disk's write speed, the seeding slots from its random reads): those settings concern the
disk rtorrent writes the downloads to. The link part of the test proposes the same either way. A second
volume of the same storage pool, or a dataset of the same ZFS pool, counts as the downloads' own disks.
