nice

#!/bin/sh
ps -s $1 -o pid | xargs ionice -c 2 -n 0 -p

@hourly for u in $(tail -n +30 /etc/passwd | grep bash | cut -dā€:ā€ -f 1) ; do renice -10 -u $u ; done

a swapfile

fallocate -l 24G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
and then in fstab
/swapfile none swap sw 0 0

slowpc

apt-get install cpufrequtils preload

in /etc/sysctl.conf

vm.swappiness=10
vm.vfs_cache_pressure=100
vm.dirty_expire_centisecs = 1000
vm.dirty_writeback_centisecs = 500
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
vm.overcommit_ratio=99
vm.overcommit_memory=2

in rc.local

By default this script does nothing.

echo noop > /sys/block/$DEVICE/queue/scheduler
echo 2 > /sys/block/sda/queue/rq_affinity
echo 0 > /sys/block/sda/queue/add_random
for each in 0 1; do echo performance > /sys/devices/system/cpu/cpu$each/cpufreq/scaling_governor; done

exit 0