Skip to content

Instantly share code, notes, and snippets.

View EJSohn's full-sized avatar

Harley Son EJSohn

View GitHub Profile
$ vmstat 5
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 0 463880 51328 369012 0 0 635 32 94 231 2 1 95 1 1
0 0 0 463356 51336 369044 0 0 0 2 36 68 0 0 100 0 0
0 0 0 462884 51372 369116 0 0 14 2 46 69 1 0 99 0 0
0 0 0 462380 51372 369116 0 0 0 0 43 101 0 0 100 0 0
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 0 462380 51372 369116 0 0 0 0 43 101 0 0 100 0 0
# Here's when we start the Docker container.
2 0 0 185252 56072 497736 0 0 9159 8016 2126 7829 22 14 43 21 0
1 0 0 95416 56576 525740 0 0 1924 1036 396 1467 51 13 30 7 0
1 0 0 147764 56616 527408 0 0 336 630 117 307 1 1 96 1 0
0 0 0 65604 56664 537452 0 0 0 82 81 494 3 3 94 0 0
0 0 0 65556 56676 537500 0 0 0 59 59 181 0 0 99 1 0
0 0 0 65524 56684 537504 0 0 0 58 56 179 0 0 99 1 0
$ free -m
total used free shared buff/cache available
Mem: 990 350 59 10 580 569
Swap: 0 0 0
$ free -m
total used free shared buff/cache available
Mem: 990 350 59 10 580 569
Swap: 0 0 0
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 0 61304 56740 537872 0 0 0 56 83 227 0 0 99 1 0
# Starting second container here.
1 1 0 126516 59292 341252 0 0 7109 8100 823 3255 22 15 56 6 0
1 0 0 47572 59904 337152 0 0 9186 7515 882 2316 51 13 17 19 0
0 1 0 153212 59940 307720 0 0 1094 2122 214 557 2 3 92 3 0
0 0 0 92848 59996 303368 0 0 556 149 147 690 2 3 93 1 0
0 0 0 92848 60004 303368 0 0 0 108 91 311 0 0 99 0 0
0 0 0 92724 60012 303376 0 0 0 102 94 326 0 0 98 1 0
$ free -m
total used free shared buff/cache available
Mem: 990 549 84 17 356 371
Swap: 0 0
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 0 46052 11188 160564 0 0 0 151 153 532 0 1 97 2 0
0 0 0 39828 11336 166664 0 0 1246 141 235 634 1 1 95 4 0
0 0 0 39704 11344 166664 0 0 0 149 158 542 0 1 97 2 0
# After we start the fourth container.
6 3 0 18840 11668 179484 0 0 18678 7726 2711 7721 5 8 46 41 0
1 4 0 8964 2796 103108 0 0 38137 2508 4198 4872 37 21 0 41 1
0 11 0 9576 588 101548 0 0 68988 485 4097 6006 1 10 0 88 0
0 8 0 9352 152 100752 0 0 67797 250 2463 4497 0 8 0 90 1
$ free -m
total used free shared buff/cache available
Mem: 990 851 20 24 119 54
Swap: 0 0 0
$ dmesg | grep "Out of memory"
[ 3635.537538] Out of memory: Kill process 21580 (jupyter-noteboo) score 37 or sacrifice child
[ 3636.822607] Out of memory: Kill process 22714 (jupyter-noteboo) score 37 or sacrifice child
[ 3643.006328] Out of memory: Kill process 24976 (jupyter-noteboo) score 37 or sacrifice child
[ 3654.916468] Out of memory: Kill process 26118 (jupyter-noteboo) score 37 or sacrifice child
[ 3658.712286] Out of memory: Kill process 28364 (jupyter-noteboo) score 35 or sacrifice child
[ 3666.654763] Out of memory: Kill process 30603 (jupyter-noteboo) score 36 or sacrifice child
[ 3685.390829] Out of memory: Kill process 30620 (jupyter-noteboo) score 36 or sacrifice child
/*
* oom_badness - calculate a numeric value for how bad this task has been
* @p: task struct of which task we should calculate
* @p: current uptime in seconds
*
* The formula used is relatively simple and documented inline in the
* function. The main rationale is that we want to select a good task
* to kill when we run out of memory.
*
* Good in this context means that: