Project

General

Profile

Demande #4716

Améliorer la gestion du swap (suite)

Added by Christian P. Momon over 3 years ago. Updated about 3 years ago.

Status:
Fermé
Priority:
Normale
Assignee:
Christian P. Momon
Category:
-
Start date:
08/17/2020
Due date:
% Done:

0%

Estimated time:

Description

Easte-Eggs revient vers nous suite au ticket #4450 :

De : Emmanuel Lacour via RT <support@easter-eggs.com>
Sujet : [Easter-eggs #73359] Re: Question de swappiness pour le SI April 

Salut à tous,

petite mise à jour sur cette demande avant de la clore:

on a constaté qu'à priori en Debian buster, vm.swappiness=1 ne suffisait pas
car les services sont démarés en cgroups v1 qui met un swappiness par défaut de 60,
quelle que soit la valeur de vm.swappiness. Vu surtout sur des serveurs avec MySQL
ou InfluxDB qui semblaient swapper sans réelle raison.

On a trouvé ça:

https://github.com/systemd/systemd/issues/9276

cf. par exemple: cat /sys/fs/cgroup/memory/system.slice/memory.swappiness

Du coup la solution semble être d'ajouter une action post à systemd-sysctl:

cat /etc/systemd/system/systemd-sysctl.service.d/swappiness.conf 

[Service]
ExecStartPost=/bin/find /sys/fs/cgroup -mindepth 2 -maxdepth 2 -name memory.swappiness -exec /bin/sh -c 'sysctl -n vm.swappiness > "{}"' \;
ExecStartPost=/bin/find /sys/fs/cgroup -mindepth 3 -maxdepth 3 -name memory.swappiness -exec /bin/sh -c 'sysctl -n vm.swappiness > "{}"' \;
ExecStartPost=/bin/find /sys/fs/cgroup -mindepth 4 -maxdepth 4 -name memory.swappiness -exec /bin/sh -c 'sysctl -n vm.swappiness > "{}"' \;
ExecStartPost=/bin/find /sys/fs/cgroup -mindepth 5 -maxdepth 5 -name memory.swappiness -exec /bin/sh -c 'sysctl -n vm.swappiness > "{}"' \;
ExecStartPost=/bin/find /sys/fs/cgroup -name memory.swappiness -exec /bin/sh -c 'sysctl -n vm.swappiness > "{}"' \;

puis:

systemctl daemon-reload
systemctl restart systemd-sysctl.service

testé sur plusieurs VMs chez nous avec succès 

Demande :
  • appliquer la solution proposée sur le SI Chapril ?
  • des précautions à prendre ?

Related issues

Copied from Admins - Demande #4664: Améliorer la gestion du swap (suite)Fermé08/17/2020

Actions

History

#1

Updated by Christian P. Momon over 3 years ago

  • Copied from Demande #4664: Améliorer la gestion du swap (suite) added
#2

Updated by Christian P. Momon over 3 years ago

  • Status changed from Nouveau to Résolu
Actions :
  • solution intégrée dans sexy-chapril 1.17 ;
  • déploiement du paquet ;
  • commandes manuelles pour activer la nouvelle configuration (./do.sh "systemctl daemon-reload ; systemctl restart systemd-sysctl.service") ;
  • vidage des swap (./do.sh "/sbin/swapoff -a && /sbin/swapon -a").

Situation :

cpm@ocmstar (19:26:40) ~/Dossiers/April/Chapril/Adminsys/scripts 9 > ./swapshow.sh 
                         Swap       Swap               RAM
                         Total      Used              Total
                          (Mo)      (Mo)      %        (Mo)
bastion                   1019         0      0 %       987
admin                     1019         1      0 %       987
dns                       1019         0      0 %       987
mail                      1019         0      0 %      1995
pouet                     1019         0      0 %      4239
sympa                     1019         0      0 %      1995
lamp                      1019         0      0 %       987
pad                       1019         0      0 %       987
libreoffice               1019         0      0 %       987
valise                    1019         0      0 %       987
xmpp                      1019         0      0 %       987
drop                      1019         0      0 %       987
allo                      1019         0      0 %      3442
ludo                      1019         0      0 %       987

                        ======    ======
               Total     14266 Mo      1 Mo   0 %

À voir dans le temps comment ça se comporte.

#3

Updated by Christian P. Momon over 3 years ago

#4

Updated by Christian P. Momon about 3 years ago

  • Status changed from Résolu to Fermé
#5

Updated by Christian P. Momon about 3 years ago

  • Target version changed from Backlog to Sprint 2020 septembre

Also available in: Atom PDF