<commit_before># Maximizing deployment performance

For maximum performance, several hardware, operating system and Snabb
parameters need to be tuned.  We start with some generic
system-oriented tips and move towards application configuration.

## BIOS settings

### Prioritize performance over energy efficiency

Go into your BIOS and verify that you or your hardware vendor have not
enabled aggressive power-saving modes that could downclock your
processors.  A CPU in a power-saving mode typically takes some time to
return to peak performance, and this latency can cause packet loss.
Servers are often shipped configured to prioritize energy efficiency
over performance, which is not the best choice if avoiding packet loss
is a goal.

Note that each vendor offers different BIOS settings to enable or
disable energy efficiency settings or profiles, typically named "Max
performance", "Energy Efficiency" and "Custom".  Select "Max
performance" for latency sensitive Snabb use.

### Disable hyperthreads

Hyperthreads are a way of maximizing resource utilization on a CPU core,
driven by the observation that a CPU is often waiting on memory or some
external event, and might as well be doing something else while it's
waiting.  In such a situation, it can be advantageous to run a second
thread on that CPU.  However for Snabb that's exactly what we don't
want.  We do not want another thread competing for compute and cache
resources on our CPU and increasing our latency.  For best results and
lowest latency, disable hyperthreading via the BIOS settings.

### Consider disabling Turbo Boost

Intel Turbo Boost Technology allows processor cores to run faster than
the rated operating frequency if they're operating below power,
current, and temperature specification limits.  The conservative thing
to do is to turn off Turbo Boost when doing performance tests of Snabb
data planes, because that way you reduce variance due to CPU clock
speed changing.

## System settings

### Adjust CPU frequency governor

To avoid power-saving heuristics causing decreased throughput and higher
latency, set the CPU frequency governor to `performance`:

```bash
for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do<commit_msg>Address feedback bis<commit_after># Maximizing deployment performance

For maximum performance, several hardware, operating system and Snabb
parameters need to be tuned.  We start with some generic
system-oriented tips and move towards application configuration.

## BIOS settings

### Prioritize performance over energy efficiency

Go into your BIOS and verify that you or your hardware vendor have not
enabled aggressive power-saving modes that could downclock your
processors.  A CPU in a power-saving mode typically takes some time to
return to peak performance, and this latency can cause packet loss.
Servers are often shipped configured to prioritize energy efficiency
over performance, which is not the best choice if avoiding packet loss
is a goal.

Note that each vendor offers different BIOS settings to enable or
disable energy efficiency settings or profiles, typically named "Max
performance", "Energy Efficiency" and "Custom".  Select "Max
performance" for latency sensitive Snabb use.

### Disable hyperthreads

Hyperthreads are a way of maximizing resource utilization on a CPU core,
driven by the observation that a CPU is often waiting on memory or some
external event, and might as well be doing something else while it's
waiting.  In such a situation, it can be advantageous to run a second
thread on that CPU.

However for Snabb that's exactly what we don't want.  We do not want
another thread competing for compute and cache resources on our CPU
and increasing our latency.  For best results, lowest latency, and to
avoid a source of packet loss, disable hyperthreading via the BIOS
settings.

### Consider disabling Turbo Boost

Intel Turbo Boost Technology allows processor cores to run faster than
the rated operating frequency if they're operating below power,
current, and temperature specification limits.  The conservative thing
to do is to turn off Turbo Boost when doing performance tests of Snabb
data planes, because that way you reduce variance due to CPU clock
speed changing.

## System settings

### Adjust CPU frequency governor

To avoid power-saving heuristics causing decreased throughput and higher
latency, set the CPU frequency governor to `performance`:

```bash
for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
{'fraction_non_alphanumeric': 0.03538257408226449, 'fraction_numerical': 0.0, 'mean_word_length': 4.935695538057743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5603931', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1008, 'n_words': 658}