Adjusting Swappiness on Linux

1 minute read

For Java-based machines (CloudBees Flow server, repository server, and agent), you should adjust the swappiness kernel parameter to favor applications over disk cache.

To favor applications 100% over disk cache:

  • Enter the following command:

    sysctl -w vm.swappiness=0

    The default of 60 can result in significant delays during garbage collection if any I/O-intensive process runs on the machine.

  • Add the following line to the /etc/sysctl.conf file:

    vm.swappiness=0

    This preserves the swappiness setting when the machine reboots.

For more details about vm.swappines see https://help.ubuntu.com or documentation from your chosen Linux distribution.