# Profiles

A profile is the load: which protocols, how the load is applied, what each session does, the file sizes, how long, the targets, the caps and the guards. **Profiles** lists the built-in ones (templates) and yours. To change a built-in profile, open it and save: saving a template makes a copy under a name of your own.

![Profiles: the built-in ones and yours](Profiles/profiles.png)

Runs with the same profile are comparable: CrushTest keeps a fingerprint of every field that shapes the load (not the name, description, targets or guards), and Compare and Trend use it ([How it works](How-It-Works.md#how-runs-are-compared)).

Click a profile to open it. A built-in one opens as **Template … (saving makes a copy)**.

![The Mixed day template in the profile editor](Profiles/profile-editor.png)

## Built-in profiles

| Profile | What it does |
|---|---|
| **Small files** | 20 SFTP sessions upload, download (checked byte for byte) and delete 4-64 KB files |
| **Logins** | 20 new SFTP sessions a second log in, look at the folder, log out: a login storm |
| **Large files** | 1 GB uploads and downloads on 2 sessions for 5 minutes; MB/s is the headline |
| **Big folder listing** | 10 sessions list a folder of 10,000 entries over and over |
| **Mixed day** | SFTP, FTPES and HTTPS (50/20/30) doing small and large transfers, listings and re-logins for 10 minutes |
| **Integrity** | upload and read back every file at a low rate, SFTP and HTTPS: after an upgrade, does every byte come back? |
| **Capacity** | raise the rate step by step until p99 passes 1 s or errors pass 1%: the highest rate this setup holds |

## Model

| Model | The load |
|---|---|
| **closed** | N sessions, each doing its steps back to back (with the pause between iterations) |
| **ops** | R iterations a second over a pool of N sessions |
| **arrivals** | R new sessions a second, each logging in, doing its steps and logging out: login storms |
| **capacity** | starts at R a second and raises it by the step (25% every 60 s by default, at most 12 steps) until the p99 or error target breaks |

For ops, arrivals and capacity CrushTest measures the response time from when an operation was due, not from when it started, so a slow server cannot hide its queue.

## Protocols and weights

`sftp:50, ftpes:20, https:30`: each new session picks a protocol by weight.

## Steps

What each session does per iteration, in order: `upload, download, delete` for example.

| Step | What it does |
|---|---|
| `upload` | uploads a file of the next size |
| `upload_verify` | uploads, then downloads it and compares every byte |
| `download` | downloads the last upload and compares every byte |
| `resume` | uploads, breaks off at a random offset, resumes from what the server kept, then downloads and compares |
| `list` | lists the upload folder (or the listing fixture, and checks no entry is missing) |
| `stat` | asks for the last upload's (or the folder's) size and date |
| `rename` | renames the last upload |
| `delete` | deletes the last upload |
| `mkdir`, `rmdir` | makes and removes a folder |
| `noop` | looks at the upload folder; with arrivals, a login-only load |
| `relogin` | logs out and in again on the same session |
| `think` | waits the think time |

A **mix** (JSON: `[{name, weight, steps}]`) gives sessions different step lists by weight instead, as the Mixed day profile does. An iteration that uploaded and did not delete removes its file at its end, so nothing piles up.

## File sizes

`4KB, 64KB, 1MB` and so on; **cycle** takes them in turn, **random** at random. The data is generated, never read from your disks, and every download is compared with what was sent.

**Listing fixture:** a folder of N files CrushTest makes before the run and removes after it, for listing tests.

## HTTP client

For HTTP and HTTPS:

- **keep-alive** (the default): each session keeps its connection open between requests, as a browser does.
- **CrushTunnel client:** a new connection for every request, as CrushFTP's own clients make them. One machine runs out of local ports above a few hundred requests a second this way.

Both send the same requests (CrushFTP's own login, upload, download, listing and file commands), so the server runs the same code.

## Times

**Ramp-up** (sessions start spread over it), **warm-up** (load runs, not measured), **measured** (the window the results come from). Defaults: 10 s, 30 s, 120 s.

## Targets, caps and guards

![Targets, the capacity search, caps and guards](Profiles/targets-caps-guards.png)

- **Targets** (p99 ms, errors %): what the capacity search holds to.
- **Caps** (per load machine): sessions (50 by default), new connections a second (8 by default, below CrushFTP's default ban of 100 connections in 10 seconds), operations a second, MB a second. A load machine never goes past them.
- **Guards**: a run stops by itself when errors pass 5%, when p99 passes 10 times its warm-up value (and 10 s), or when the server's CPU stays above 95% for a minute. See [Safety on production](Safety.md).
