summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2023-11-03 23:53:44 +0100
committerAndreas Fankhauser hiddenalpha.ch2023-11-03 23:53:44 +0100
commit6cc7599ce03355d0be787b88262a48034a3901d7 (patch)
treef737e76ba37dbacf1f0e6cefc28909e9e22946a1
parenta709bdd16b363fcb704961a26e54e11d5d103241 (diff)
parentda4b60cd0e7711f17055d8896f1fb5e820787c24 (diff)
downloadUnspecifiedGarbage-6cc7599ce03355d0be787b88262a48034a3901d7.zip
UnspecifiedGarbage-6cc7599ce03355d0be787b88262a48034a3901d7.tar.gz
Merge remote-tracking branch 'gh-hiddenalpha/master'
-rw-r--r--doc/note/openshift/dbg-mem-issues.txt49
1 files changed, 49 insertions, 0 deletions
diff --git a/doc/note/openshift/dbg-mem-issues.txt b/doc/note/openshift/dbg-mem-issues.txt
new file mode 100644
index 0000000..c7359fd
--- /dev/null
+++ b/doc/note/openshift/dbg-mem-issues.txt
@@ -0,0 +1,49 @@
+
+How to hunt memory issues in production
+=======================================
+
+true \
+ && SVCNAME=foo-prod \
+ && PID=9 \
+ && OC="oc -n foo" \
+ && MemLeakTry1="lua -W MemLeakTry1.lua" \
+ && true
+
+
+${OC:?} exec -ti "$(${OC:?} get pods|egrep ston-1|cut -f1 -d' ')" -- pmap 9 > "${SVCNAME:?}"-pmap-$(date -u +%Y%m%d-%H%M%S).txt
+
+${OC:?} exec -ti "$(${OC:?} get pods|egrep ston-1|cut -f1 -d' ')" -- sh -c 'true \
+ && printf '\''%s\n'\'' "$(sed '\''s;^(.*)$;FOO;'\'' /proc/'${PID:?}'/smaps)" \
+ '
+
+true \
+ && ${OC:?} exec -ti "$(${OC:?} get pods|grep ston-[1-9]|cut -f1 -d' ')" -- sh -c 'true \
+ && printf '\''h;PageSize;%s\n'\'' $(getconf PAGESIZE) \
+ && printf '\''c;%-24s;%8s;%8s;%8s;%5s;%4s;%3s;%8s;%3s;%7s\n'\'' When nThrds size RSS SHR text lib data dt nFds \
+ && while true; do true \
+ && printf '\''r;%s;%8s;%8d;%8d;%5d;%4d;%3d;%8d;%3d;%7d\n'\'' \
+ "$(date -Is)" \
+ $(cat /proc/'${PID:?}'/stat|cut -d" " -f20) \
+ $(cat /proc/'${PID:?}'/statm) \
+ $(ls -1 /proc/9/fd | wc -l) \
+ && sleep $(expr 60 - \( $(date +%s) % 60 \)) || break; done' \
+ | tee "${SVCNAME:?}"-mem-$(date +%Y%m%d-%H%M%S%z).csv
+
+true \
+ && ONE="houston-prod-pmap-20231102-163425.txt" \
+ && TWO="houston-prod-pmap-20231103-074301.txt" \
+ && diff -U0 "${ONE:?}" "${TWO:?}" | egrep '^\+' | sed -r 's_\+([^ ]+) .*$_\1_'|sort|uniq \
+ && true
+
+(true \
+ && for F in $(ls *pmap*.txt); do true \
+ && printf "$F\n" \
+ && DATE="$(date +%s -d "$(echo $F|sed -r 's_.*([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})([0-9]{2})([0-9]{2}).*_\1-\2-\3T\4:\5:\6Z_')")" \
+ && <"$F" ${MemLeakTry1:?} --date "${DATE:?}" > "${F%.*}.csv" \
+ ;done)
+
+true \
+ && cat houston-prod-pmap-*.csv > houston-prod-pmapAll.csv \
+ && true
+
+