Outils pour utilisateurs

Outils du site


tech:memoire_linux

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:memoire_linux [2025/03/25 11:54] Jean-Baptistetech:memoire_linux [2025/11/03 16:45] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 {{tag>Mem SNMP}} {{tag>Mem SNMP}}
  
-Mémoire Linux+Mémoire Linux
  
 Voir : Voir :
Ligne 12: Ligne 13:
 * smem * smem
 * lsmem / chmem * lsmem / chmem
 +* https://linuxfr.org/news/sortie-du-noyau-linux-6-17 damon_stat
  
  
  
-== Fuite mémoire+## Fuite mémoire
  
 Voir :  Voir : 
Ligne 23: Ligne 25:
 * https://www.linuxtricks.fr/wiki/performance-memoire-avec-free-et-vmstat * https://www.linuxtricks.fr/wiki/performance-memoire-avec-free-et-vmstat
 * http://www.ordinateur.cc/syst%C3%A8mes/Linux/205699.html * http://www.ordinateur.cc/syst%C3%A8mes/Linux/205699.html
-* [[https://www.atoptool.nl/download/case_leakage.pdf|Atop - Case study with atop: memory leakage]]+* [Atop - Case study with atop: memory leakage](https://www.atoptool.nl/download/case_leakage.pdf)
 * https://github.com/iovisor/bcc/blob/master/README.md tools/memleak * https://github.com/iovisor/bcc/blob/master/README.md tools/memleak
  
Ligne 30: Ligne 32:
  
  
-== Config+## Config
  
-=== Kernel Linux param+### Kernel Linux param
  
-==== NUMA (Non-Uniform Memory Access)+#### NUMA (Non-Uniform Memory Access)
  
 Voir : Voir :
- * [[https://www.kernel.org/doc/html/v4.19/vm/numa.html|What is NUMA ?]] + * [What is NUMA ?](https://www.kernel.org/doc/html/v4.19/vm/numa.html) 
- * [[https://www.it-connect.fr/chapitres/la-memoire-numactl-lstopo-perf-etc/|La mémoire : numactl, lstopo, perf, etc.]]+ * [La mémoire : numactl, lstopo, perf, etc.](https://www.it-connect.fr/chapitres/la-memoire-numactl-lstopo-perf-etc/
 + * ''numatop''
  
 Disable NUMA (Pour Oracle DB) Disable NUMA (Pour Oracle DB)
 /usr/share/doc/kernel-doc-4.18.0/Documentation/x86/x86_64/boot-options.txt /usr/share/doc/kernel-doc-4.18.0/Documentation/x86/x86_64/boot-options.txt
-<code ini>+~~~ini
 numa=off      Only set up a single NUMA node spanning all memory. numa=off      Only set up a single NUMA node spanning all memory.
-</code>+~~~
  
 Vérif Vérif
Ligne 50: Ligne 53:
 ''numactl'' command can be used to check the status of NUMA ''numactl'' command can be used to check the status of NUMA
  
-<code ->+~~~
 # numactl -H | grep available # numactl -H | grep available
 available: 8 nodes (0-7) available: 8 nodes (0-7)
-</code>+~~~
  
-<code ->+~~~
 # numactl -H | grep available # numactl -H | grep available
 available: 2 nodes (0-1) available: 2 nodes (0-1)
-</code>+~~~
  
 If the number of available nodes is ''2 nodes (0-1)'' or ''8 nodes (0-7)'' then NUMA is enabled If the number of available nodes is ''2 nodes (0-1)'' or ''8 nodes (0-7)'' then NUMA is enabled
Ligne 69: Ligne 72:
  
  
-==== NUMA (Non-Uniform Memory Access) - Useful Commands+#### NUMA (Non-Uniform Memory Access) - Useful Commands
  
 To identify NUMA nodes, socket memory and CPU core allocation To identify NUMA nodes, socket memory and CPU core allocation
-<code bash>+~~~bash
 numactl -H numactl -H
-</code>+~~~
  
 To identify the NUMA node local to an adapter To identify the NUMA node local to an adapter
-<code bash>+~~~bash
 cat /sys/class/net/<interface>/device/numa_node cat /sys/class/net/<interface>/device/numa_node
-</code>+~~~
  
 To identify memory allocation and use on a particular NUMA node: To identify memory allocation and use on a particular NUMA node:
-<code bash>+~~~bash
 cat /sys/devices/system/node/node<N>/numastat cat /sys/devices/system/node/node<N>/numastat
-</code>+~~~
  
 To identify NUMA node mapping to cores, use one of the following To identify NUMA node mapping to cores, use one of the following
-<code bash>+~~~bash
 numactl --hardware numactl --hardware
 cat /sys/devices/system/node/node<N>/cpulist cat /sys/devices/system/node/node<N>/cpulist
-</code>+~~~
  
  
 Driver Loading - NUMA Node Driver Loading - NUMA Node
  
-<code bash>+~~~bash
 numactl --cpunodebind=1 onload_tool reload numactl --cpunodebind=1 onload_tool reload
-</code>+~~~
  
  
  
-=== Memory usage per user+### Memory usage per user
  
-<code bash>+~~~bash
 smem -u smem -u
-</code>+~~~
  
-=== Transparent HugePages (THP)+ 
 +### Transparent HugePages (THP)
  
 Voir Voir
Ligne 114: Ligne 118:
  
  
-==== Désactiver **Transparent HugePages (THP)**+#### Désactiver **Transparent HugePages (THP)**
  
-<code bash>+~~~bash
 cat /sys/kernel/mm/transparent_hugepage/enabled cat /sys/kernel/mm/transparent_hugepage/enabled
-</code>+~~~
  
 The following is a sample output that shows Transparent HugePages are being used as the [always] flag is enabled. The following is a sample output that shows Transparent HugePages are being used as the [always] flag is enabled.
-<code ->+~~~
 [always] never [always] never
-</code>+~~~
  
 Paramètre Kernel Linux Paramètre Kernel Linux
-<code ini>+~~~ini
 transparent_hugepage=never transparent_hugepage=never
-</code>+~~~
  
  
Ligne 137: Ligne 141:
  
  
-== Notes Free / Aviable+## Notes Free / Aviable
  
-<code ->+~~~
 $ ./centreon_plugins.pl --plugin os::linux::snmp::plugin --mode memory --hostname localhost --help $ ./centreon_plugins.pl --plugin os::linux::snmp::plugin --mode memory --hostname localhost --help
 ... ...
Ligne 151: Ligne 155:
             Others versions: used = memTotalReal - memAvailReal - memBuffer             Others versions: used = memTotalReal - memAvailReal - memBuffer
             - memCached // free = total - used             - memCached // free = total - used
-</code>+~~~
  
-== Exemple+## Exemple
  
  
-<code bash>+~~~bash
 free -mt free -mt
 vmstat -SM 45 10 vmstat -SM 45 10
Ligne 165: Ligne 169:
 ps -u $USER -o comm,vsz,pcpu | sort -nrk2 ps -u $USER -o comm,vsz,pcpu | sort -nrk2
 ps -eo comm,pcpu,pmem,rss --sort rss | tail -n 30 | tac ps -eo comm,pcpu,pmem,rss --sort rss | tail -n 30 | tac
-</code>+~~~
  
-<code bash>+~~~bash
 read CommitLimit Committed_AS <<< $(egrep "CommitLimit|Committed_AS" /proc/meminfo |awk '{print $2}') read CommitLimit Committed_AS <<< $(egrep "CommitLimit|Committed_AS" /proc/meminfo |awk '{print $2}')
 echo $(( Committed_AS * 100 / CommitLimit)) echo $(( Committed_AS * 100 / CommitLimit))
-</code>+~~~
  
-<code bash>+~~~bash
 memused=$(free  |grep "buffers/cache" |awk '{print $3}') memused=$(free  |grep "buffers/cache" |awk '{print $3}')
 memtotal=$(free |grep ^Mem | awk '{print $2}') memtotal=$(free |grep ^Mem | awk '{print $2}')
 echo $(( memused * 100 / memtotal)) echo $(( memused * 100 / memtotal))
-</code>+~~~
  
-<code bash>+~~~bash
 memFree=$(free |grep ^-|awk '{print $3}') memFree=$(free |grep ^-|awk '{print $3}')
 memTot=$(free |grep ^Mem |awk '{print $2}') memTot=$(free |grep ^Mem |awk '{print $2}')
 memUsed=$(echo "scale=2 ; 100 * $memFree / $memTot" |bc) memUsed=$(echo "scale=2 ; 100 * $memFree / $memTot" |bc)
 echo "$memUsed %  Mem used" | grep ^[3-9][0-9] echo "$memUsed %  Mem used" | grep ^[3-9][0-9]
-</code>+~~~
  
  
-<code bash>+~~~bash
 ps -C apache2 -o rss --no-headers |tr "\n" "+" | sed -e 's/+$/\n/' |bc ps -C apache2 -o rss --no-headers |tr "\n" "+" | sed -e 's/+$/\n/' |bc
 read CommitLimit Committed_AS <<< $(egrep "CommitLimit|Committed_AS" /proc/meminfo |awk '{print $2}') read CommitLimit Committed_AS <<< $(egrep "CommitLimit|Committed_AS" /proc/meminfo |awk '{print $2}')
Ligne 194: Ligne 198:
 echo $(( memused * 100 / memtotal)) echo $(( memused * 100 / memtotal))
 ps -e -o pid,user,rss,vsize,cmd --sort rss ps -e -o pid,user,rss,vsize,cmd --sort rss
-</code>+~~~
  
-<code bash>+~~~bash
 smem -u smem -u
 smem -u -t -k smem -u -t -k
 top -b -n 1 -u apache top -b -n 1 -u apache
-</code>+~~~
  
  
 Taille totale de la mémoire physique de la RAM (sans la swap) Taille totale de la mémoire physique de la RAM (sans la swap)
-<code ->+~~~
 # head -1 /proc/meminfo # head -1 /proc/meminfo
 MemTotal:       65391036 kB MemTotal:       65391036 kB
Ligne 210: Ligne 214:
 # awk '/MemTotal/ { print $2 }' /proc/meminfo # awk '/MemTotal/ { print $2 }' /proc/meminfo
 65391036 65391036
-</code>+~~~
    
  
Ligne 218: Ligne 222:
  
  
-== Fonctionnement+## Fonctionnement
  
 Voir : Voir :
Ligne 224: Ligne 228:
 http://www.blog.florian-bogey.fr/empecher-les-depassements-de-memoire-sur-un-serveur-linux.html http://www.blog.florian-bogey.fr/empecher-les-depassements-de-memoire-sur-un-serveur-linux.html
  
-== Autres+## Autres
  
 Clearing KernelCare Cache Clearing KernelCare Cache
Ligne 230: Ligne 234:
 Source : https://www.linuxjournal.com/content/how-install-and-uninstall-kernelcare Source : https://www.linuxjournal.com/content/how-install-and-uninstall-kernelcare
  
-<code bash>+~~~bash
 rm -rf /var/cache/kcare/patches rm -rf /var/cache/kcare/patches
 echo 1 > /proc/sys/vm/compact_memory echo 1 > /proc/sys/vm/compact_memory
 echo 3 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches
 kcarectl –update kcarectl –update
-</code>+~~~
  
  
  
  
tech/memoire_linux.1742900061.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki