canonical / charm-sysconfig

A subordinate charm to apply system settings like grub configurations or systemd configurations.
Apache License 2.0
0 stars 5 forks source link

High swap usage on nodes even having free physical memory #26

Closed dashmage closed 8 months ago

dashmage commented 8 months ago

In a cloud with a high load, some nodes use swap even though physical memory is available.

Here is an example:

free -h ; vmstat 1

total used free shared buff/cache available Mem: 251G 53G 98G 21G 99G 175G Swap: 8.0G 8.0G 12K procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 8388592 103424320 879856 103802088 0 0 0 15 0 0 5 3 92 0 0 1 0 8388592 103424496 879856 103802128 0 0 0 560 14741 26943 2 1 98 0 0 7 0 8388592 103377280 879856 103802136 0 0 0 316 15868 32061 3 1 95 0 0 4 0 8388592 103376992 879856 103802304 0 0 0 316 32424 101905 8 7 85 0 0 10 0 8388592 103358880 879856 103802112 0 0 0 952 40945 164563 6 4 91 0 0 6 0 8388592 103386784 879856 103801776 0 0 0 1340 32409 115173 4 3 93 0 0 1 0 8388592 103380840 879856 103801904 0 0 0 104 32113 106159 3 5 92 0 0 2 0 8388592 103372448 879856 103801920 0 0 0 360 32173 100395 3 4 93 0 0 3 0 8388592 103370408 879856 103802272 0 0 0 120 30659 103600 6 7 87 0 0 9 0 8388592 103371216 879856 103802032 0 0 0 180 28233 94830 3 3 95 0 0 3 0 8388592 103347240 879856 103802176 0 0 0 416 20911 50278 3 3 94 0 0 2 0 8388592 103381936 879856 103802512 0 0 0 1424 22038 50909 3 3 94 0 0

It could be useful if there is a way to set swappiness = 10 (or 0) instead of the default value of 60.


Imported from Launchpad using lp2gh.

dashmage commented 8 months ago

(by dparv) This could be achieved by setting the charm sysctl value to the appropriate key/value pair to set the configuration you need.

Example would be:

juju config sysconfig sysctl="{ vm.swappiness : 10 }"