in ,

Make Linux Only Swapping MySQL As A Last Resort

MySQL Database

When running MySQL Server on a Linux system, even with a lot of memory and vast buffer pool for InnoDB Engine, Linux may choose to Swap out memory.

Even though it appears all MySQL configurations for utilizing memory percentages are OK, no over-allocate memory, and so no need for swapping.

You can check the swapping memory for each system user using the command smem, it can install using apt install smem, then running # smem -u.

Of course, swapping out memory and transferring to disk could cause significant negative consequences on performance.

The best thing we can do is make the Swapping option a last resort for the Linux system by adjusting the kernel swappiness variable.

swappiness The Linux kernel parameter vm.swappiness controls the swapping process by setting a value between [0 – 100].

When setting it to 0 vm.swappiness = 0 that means Swap is disabled entirely for the later kernel versions, which > 3.5.

When setting it to 1 vm.swappiness = 1 that means Swap only as a last resort.

When setting it to 10 vm.swappiness = 10 that is the recommended value for ensuring performance and smoothing the application running.

When setting it to 100 vm.swappiness = 100 that means the kernel will aggressively swap.

The Linux system kernel default value is 60 vm.swappiness = 60

To check the current swappiness value

# sysctl vm.swappiness
vm.swappiness = 60

And To Set swappiness to 1

# sysctl -w vm.swappiness=1
vm.swappiness = 1

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

      Cloudflar Nginx

      Nginx Redirect Based on Geolocation

      cpu utilization - IP Address

      100 Percent CPU Utilization!? Know How To Simply Catch the Bad Boy’s IP Address