aboutsummaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJulien Dessaux2021-10-05 19:54:19 +0200
committerJulien Dessaux2021-10-05 19:54:19 +0200
commitbdad32ce8737ca2ff054b6c83fcbe1e2aa2b1724 (patch)
tree9735e660dbb9235b94d19de17e806b9a310dfc59 /content
parentAdded miniflux installation doc (diff)
downloadwww-bdad32ce8737ca2ff054b6c83fcbe1e2aa2b1724.tar.gz
www-bdad32ce8737ca2ff054b6c83fcbe1e2aa2b1724.tar.bz2
www-bdad32ce8737ca2ff054b6c83fcbe1e2aa2b1724.zip
Added oom blog article
Diffstat (limited to 'content')
-rw-r--r--content/blog/miscellaneous/investigating-oom.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/content/blog/miscellaneous/investigating-oom.md b/content/blog/miscellaneous/investigating-oom.md
new file mode 100644
index 0000000..3e1223d
--- /dev/null
+++ b/content/blog/miscellaneous/investigating-oom.md
@@ -0,0 +1,35 @@
+---
+title: How to list oom killer score of running linux processus
+description: a shell command that could be a one liner
+date: 2021-10-05
+tags:
+- linux
+- toolbox
+---
+
+## Introduction
+
+There seems to be a missing piece for investigating what the oom killer will do when a linux kernel will run out of memory. Since oom_scores can be adjusted, looking at memory consumption is not enough to get a clear picture.
+
+## The command
+
+The base of the command came from a colleague, I refined it with the sort and tail :
+```sh
+while read -r pid comm; do
+ printf '%d\t%d\t%s\n' "$pid" "$(cat /proc/$pid/oom_score)" "$comm"
+done < <(ps -e -o pid= -o comm=)|sort -n -k2|tail
+```
+
+On a busy server, the output will look like :
+```
+306 2 systemd-journal
+673 2 haproxy
+616 6 puppet
+8370 7 mcollectived
+1728 8 varnishncsa
+14652 9 php-fpm7.2
+14668 10 php-fpm7.2
+14653 13 php-fpm7.2
+1415 186 cache-main
+29124 313 mysqld
+```