System Tuning
LogZilla documentation for System Tuning
CPU frequency governors
Recent Intel CPUs provide energy-saving and boost capabilities (SpeedStep and TurboBoost). These features adjust core frequencies based on load, which may not be desirable for servers focused on consistent performance.
Checking current processor speed
bashcat /proc/cpuinfo | grep MHz
Example output:
textcpu MHz : 1400.000 cpu MHz : 1400.000 cpu MHz : 1400.000 cpu MHz : 1400.000 cpu MHz : 1400.000 cpu MHz : 1400.000 cpu MHz : 3500.000 cpu MHz : 3500.000
Only some cores may run at top speed with default settings, which can be undesirable for throughput-focused workloads.
Set governor temporarily (root)
Add this helper function in a root shell or in .bash_aliases
:
bashfunction setgov ()
{
# usage:
# setgov ondemand
# setgov performance
echo "Current setting: $(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | sort -u)"
echo "Current CPU Speeds:"
cat /proc/cpuinfo | grep 'cpu MHz'
[[ -z $1 ]] && { echo "Missing argument (ondemand|performance)"; return 1; }
echo "$1" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
echo "New CPU Speeds:"
cat /proc/cpuinfo | grep 'cpu MHz'
}
Load it with source ~/.bash_aliases
, then run setgov performance
.
Permanent change (root)
bashapt-get install -y cpufrequtils
echo 'GOVERNOR="performance"' >/etc/default/cpufrequtils
service cpufrequtils reload
Alternative methods (if available)
If the following tools are installed on the distribution, they can be used to set performance profiles:
bash# Using cpupower (part of kernel tools)
cpupower frequency-set -g performance
# Using tuned (RHEL/Rocky/Alma families)
tuned-adm profile throughput-performance
Notes:
- TurboBoost only runs when other cores are throttled due to TDP. With the
performance
governor, cores run at nominal frequency. - TurboBoost depends on SpeedStep; disabling SpeedStep in BIOS disables boosting and throttling.
Filesystem performance
These recommendations affect disk layout and virtual memory. Verify target disk names and understand that some commands are destructive.
Warning: Commands like
parted
,mkfs
, andlvcreate
can destroy data if run against the wrong device. Ensure device names are correct before proceeding.
Disk format (LVM recommended)
OS disks should use Logical Volume Manager (LVM). Align sectors properly.
Identify the target disk and existing layout before partitioning:
bashlsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT
Format disk using parted
(example uses /dev/sda
). The following commands
are run inside the parted prompt:
bashdisk=/dev/sda
parted -a optimal ${disk}
mklabel gpt
unit s
mkpart primary 2048s 100%
align-check opt 1
set 1 lvm on
print
Create the physical volume:
bashpvcreate -M 2 --dataalignment 4k ${disk}${partition}
Check alignment (first PE should be 1.00m
):
bashpvs -o +pe_start
Create the volume group (if not already present):
bashvolumeName="vg0"
partition=1 # partition created above with parted
vgcreate ${volumeName} ${disk}${partition}
Create a logical volume using remaining free space (named data
):
bashlvcreate -n data -l 100%FREE ${volumeName}
Create a filesystem on the new logical volume:
bash# CAUTION: The next command will destroy data on the target device.
mkfs.ext4 /dev/${volumeName}/data
Create an fstab entry (replace the mount point as appropriate):
text/dev/${volumeName}/data /mnt/data ext4 defaults 0 2
During a new OS install, installers typically configure LVM automatically. LVM allows adding disks and resizing volumes online.
Swap
For server deployments, avoid swap unless required for a temporary mitigation. If swap must be enabled, tune the settings as follows.
View current swappiness:
bashcat /proc/sys/vm/swappiness
Set swappiness temporarily (example: 10):
bashsysctl vm.swappiness=10
Persist swappiness across reboots by adding to /etc/sysctl.conf
and
reloading:
bashecho 'vm.swappiness=10' >> /etc/sysctl.conf
sysctl -p
Alternatively, create a drop-in file and reload all settings:
bashcat >/etc/sysctl.d/99-logzilla-vm.conf <<'EOF'
vm.swappiness=10
EOF
sysctl --system
vfs_cache_pressure
This controls how aggressively the kernel reclaims cached inode and dentry information.
View the current value:
bashcat /proc/sys/vm/vfs_cache_pressure
Set a more conservative value (example: 50):
bashsysctl vm.vfs_cache_pressure=50
Make it persistent:
bashecho 'vm.vfs_cache_pressure=50' >> /etc/sysctl.conf
sysctl -p
Alternatively, persist with a drop-in file (can reuse the same file as above):
bashecho 'vm.vfs_cache_pressure=50' >> /etc/sysctl.d/99-logzilla-vm.conf
sysctl --system