当我遇到 OOM(内存不足)问题时,我的交换大小应该为多少,以及我的交换性应该为多少?
我所经历的是彻底减速直至冻结,并且唯一能起作用的是鼠标指针,而且它变得越来越慢,到了这个阶段修复已经太晚了,甚至无法 ssh 进入。
HDD 灯不断闪烁,RAM 指示灯表明我已用完所有内存,甚至连时钟都停止了。
在我重新启动内核日志后告诉我:“内存不足:终止进程 26899 (...) 得分 310 或牺牲孩子”
我在跑步:
- Ubuntu 操作系统 18.04
- 内存:32GB
- velociraptor 150GB 上的 /swap 3GB 分区,其中 /home 为 147GB(仅 2 个)机器用于转码和大量浏览。它是
- 我的日常台式机,它不会进入睡眠状态。
- 而且我在 Firefox 和 Chrome 中打开了许多标签。
我的计算习惯可能是问题所在,但由于我的工作性质,这种习惯不会有太大改变。
Chrome 和 Firefox 都占用了我的内存,但我对此无能为力。希望通过通知来监视它们,或限制它们。其中一个或两个都可能存在大量内存泄漏,最好找出哪个更糟糕。
我发现很难获得准确的可用 RAM 数量,因此我使用 Gnome Top Bar 中的系统监视器。
下面是一些内核日志:
cat /proc/sys/vm/swappiness 返回 0
我应该改变一些东西吗?
我在想也许需要更多的交换?以及更多的交换性?
我不记得为什么我关闭了 swappiness(我确定我关闭了???),所以不确定它会产生什么影响。
即使只是在电量不足时发出通知也可以
如果我需要更多交换空间,我必须缩小/home并增加交换空间,但要增加多少呢?我不需要休眠。
2019-12-13T09:57:33.815819+13:00 myserver kernel: [1155672.843424] Mem-Info:
2019-12-13T09:57:33.815820+13:00 myserver kernel: [1155672.843426] active_anon:6700209 inactive_anon:1113453 isolated_anon:0
2019-12-13T09:57:33.815823+13:00 myserver kernel: [1155672.843426] active_file:792 inactive_file:795 isolated_file:32
2019-12-13T09:57:33.815823+13:00 myserver kernel: [1155672.843426] unevictable:86 dirty:0 writeback:0 unstable:0
2019-12-13T09:57:33.815823+13:00 myserver kernel: [1155672.843426] slab_reclaimable:114513 slab_unreclaimable:51242
2019-12-13T09:57:33.815824+13:00 myserver kernel: [1155672.843426] mapped:427080 shmem:1189601 pagetables:52336 bounce:0
2019-12-13T09:57:33.815824+13:00 myserver kernel: [1155672.843426] free:50692 free_pcp:176 free_cma:0
2019-12-13T09:57:33.815824+13:00 myserver kernel: [1155672.843427] Node 0 active_anon:26800836kB inactive_anon:4453812kB active_file:3168kB inactive_file:3180kB unevictable:344kB isolated(anon):0kB isolated(file):128kB mapped:1708320kB dirty:0kB writeback:0kB shmem:4758404kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 2048kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes
2019-12-13T09:57:33.815825+13:00 myserver kernel: [1155672.843427] Node 0 DMA free:15884kB min:32kB low:44kB high:56kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15988kB managed:15884kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
2019-12-13T09:57:33.815825+13:00 myserver kernel: [1155672.843429] lowmem_reserve[]: 0 1873 31783 31783 31783
2019-12-13T09:57:33.815825+13:00 myserver kernel: [1155672.843430] Node 0 DMA32 free:123472kB min:3980kB low:5896kB high:7812kB active_anon:1394728kB inactive_anon:363056kB active_file:0kB inactive_file:228kB unevictable:24kB writepending:0kB present:2022916kB managed:1957340kB mlocked:24kB kernel_stack:1088kB pagetables:11280kB bounce:0kB free_pcp:340kB local_pcp:0kB free_cma:0kB
2019-12-13T09:57:33.815825+13:00 myserver kernel: [1155672.843432] lowmem_reserve[]: 0 0 29910 29910 29910
2019-12-13T09:57:33.815826+13:00 myserver kernel: [1155672.843434] Node 0 Normal free:63412kB min:63568kB low:94192kB high:124816kB active_anon:25406108kB inactive_anon:4090756kB active_file:2612kB inactive_file:3072kB unevictable:320kB writepending:0kB present:31178752kB managed:30634172kB mlocked:320kB kernel_stack:34576kB pagetables:198064kB bounce:0kB free_pcp:364kB local_pcp:120kB free_cma:0kB
2019-12-13T09:57:33.815826+13:00 myserver kernel: [1155672.843435] lowmem_reserve[]: 0 0 0 0 0
2019-12-13T09:57:33.815828+13:00 myserver kernel: [1155672.843436] Node 0 DMA: 3*4kB (U) 2*8kB (U) 3*16kB (U) 0*32kB 3*64kB (U) 2*128kB (U) 0*256kB 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (M) = 15884kB
2019-12-13T09:57:33.815828+13:00 myserver kernel: [1155672.843441] Node 0 DMA32: 891*4kB (UME) 172*8kB (UME) 667*16kB (UME) 1098*32kB (UME) 548*64kB (UME) 217*128kB (UME) 39*256kB (ME) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 123580kB
2019-12-13T09:57:33.815828+13:00 myserver kernel: [1155672.843445] Node 0 Normal: 342*4kB (UME) 1147*8kB (UME) 1725*16kB (UME) 792*32kB (UME) 5*64kB (M) 1*128kB (M) 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 63936kB
2019-12-13T09:57:33.815828+13:00 myserver kernel: [1155672.843450] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
2019-12-13T09:57:33.815829+13:00 myserver kernel: [1155672.843450] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
2019-12-13T09:57:33.815829+13:00 myserver kernel: [1155672.843451] 1191363 total pagecache pages
2019-12-13T09:57:33.815829+13:00 myserver kernel: [1155672.843452] 0 pages in swap cache
2019-12-13T09:57:33.815830+13:00 myserver kernel: [1155672.843452] Swap cache stats: add 0, delete 0, find 0/0
2019-12-13T09:57:33.815830+13:00 myserver kernel: [1155672.843452] Free swap = 2968572kB
2019-12-13T09:57:33.815830+13:00 myserver kernel: [1155672.843453] Total swap = 2968572kB
2019-12-13T09:57:33.815831+13:00 myserver kernel: [1155672.843453] 8304414 pages RAM
2019-12-13T09:57:33.815831+13:00 myserver kernel: [1155672.843453] 0 pages HighMem/MovableOnly
2019-12-13T09:57:33.815831+13:00 myserver kernel: [1155672.843453] 152565 pages reserved
2019-12-13T09:57:33.815832+13:00 myserver kernel: [1155672.843454] 0 pages cma reserved
2019-12-13T09:57:33.815833+13:00 myserver kernel: [1155672.843454] 0 pages hwpoisoned
2019-12-13T09:57:33.815833+13:00 myserver kernel: [1155672.843454] [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name
2019-12-13T09:57:33.815833+13:00 myserver kernel: [1155672.843460] [ 410] 0 410 11762 576 118784 0 -1000 systemd-udevd
...
2019-12-13T09:57:33.815835+13:00 myserver kernel: [1155672.843464] [ 1248] 106 1248 13180 688 143360 0 -900 dbus-daemon
...
2019-12-13T09:57:33.815871+13:00 myserver kernel: [1155672.843479] [ 1553] 123 1553 356103 41077 692224 0 0 mysqld
...
2019-12-13T09:57:33.815842+13:00 myserver kernel: [1155672.843477] [ 1463] 0 1463 18074 189 180224 0 -1000 sshd
...
2019-12-13T09:57:33.815874+13:00 myserver kernel: [1155672.843484] [ 7772] 0 7772 444853 167204 1888256 0 0 Xorg
...
2019-12-13T09:57:33.815875+13:00 myserver kernel: [1155672.843487] [ 7971] 130 7971 4139617 1641335 14372864 0 0 jsvc
2019-12-13T09:57:33.815876+13:00 myserver kernel: [1155672.843487] [ 8213] 130 8213 360244 10081 786432 0 0 mongod
2019-12-13T09:57:33.815842+13:00 myserver kernel: [1155672.843477] [ 1463] 0 1463 18074 189 180224 0 -1000 sshd
...
2019-12-13T09:57:33.815883+13:00 myserver kernel: [1155672.843502] [ 8762] 1000 8762 1168733 175414 2805760 0 0 gnome-shell
...
2019-12-13T09:57:33.815884+13:00 myserver kernel: [1155672.843503] [ 8809] 1000 8809 927950 3566 630784 0 0 pulseaudio
...
2019-12-13T09:57:33.815897+13:00 myserver kernel: [1155672.843526] [ 9038] 1000 9038 407630 16845 929792 0 0 nautilus-deskto
...
2019-12-13T09:57:33.815929+13:00 myserver kernel: [1155672.843540] [24933] 1000 24933 713935 55265 2007040 0 0 nautilus
...
2019-12-13T09:57:33.815932+13:00 myserver kernel: [1155672.843545] [18151] 1000 18151 3110421 466608 8593408 0 0 firefox
2019-12-13T09:57:33.815932+13:00 myserver kernel: [1155672.843546] [18209] 1000 18209 1527811 632286 13004800 0 0 Web Content
2019-12-13T09:57:33.815934+13:00 myserver kernel: [1155672.843546] [18272] 1000 18272 1148444 344039 7467008 0 0 WebExtensions
2019-12-13T09:57:33.815934+13:00 myserver kernel: [1155672.843547] [18477] 1000 18477 1120696 252293 8085504 0 0 Web Content
...
2019-12-13T09:57:33.815936+13:00 myserver kernel: [1155672.843553] [18131] 1000 18131 1070693 219756 6922240 0 0 Web Content
...
2019-12-13T09:57:33.815938+13:00 myserver kernel: [1155672.843556] [11701] 1000 11701 1117852 248545 6672384 0 0 Web Content
2019-12-13T09:57:33.815938+13:00 myserver kernel: [1155672.843557] [25083] 1000 25083 1115243 283290 7639040 0 0 Web Content
2019-12-13T09:57:33.815939+13:00 myserver kernel: [1155672.843557] [25121] 1000 25121 972894 115746 5341184 0 0 Web Content
2019-12-13T09:57:33.815939+13:00 myserver kernel: [1155672.843558] [26440] 1000 26440 1181471 310589 8720384 0 0 Web Content
...
2019-12-13T09:57:33.815943+13:00 myserver kernel: [1155672.843565] [29162] 1000 29162 1126221 272709 8159232 0 0 Web Content
2019-12-13T09:57:33.815944+13:00 myserver kernel: [1155672.843566] [25397] 0 25397 713116 4125 487424 0 -900 snapd
...
2019-12-13T09:57:33.815949+13:00 myserver kernel: [1155672.843578] [12407] 1000 12407 3330427 163801 2134016 0 0 java
...
2019-12-13T09:57:33.815954+13:00 myserver kernel: [1155672.843584] [26899] 1000 26899 527162 88831 3940352 0 300 QtWebEngineProc
2019-12-13T09:57:33.815969+13:00 myserver kernel: [1155672.843593] [18683] 1000 18683 6068998 41557 5480448 0 0 slack
2019-12-13T09:57:33.815973+13:00 myserver kernel: [1155672.843603] [ 2408] 1000 2408 138910 8547 925696 0 200 chrome
2019-12-13T09:57:33.815974+13:00 myserver kernel: [1155672.843604] [ 2412] 1000 2412 133640 5987 860160 0 200 chrome
2019-12-13T09:57:33.815975+13:00 myserver kernel: [1155672.843604] [ 2498] 1000 2498 182900 4300 1265664 0 300 chrome
2019-12-13T09:57:33.815975+13:00 myserver kernel: [1155672.843605] [ 2511] 1000 2511 182866 4230 1273856 0 300 chrome
2019-12-13T09:57:33.815975+13:00 myserver kernel: [1155672.843606] [ 2600] 1000 2600 185217 5757 1458176 0 300 chrome
2019-12-13T09:57:33.815976+13:00 myserver kernel: [1155672.843606] [ 2636] 1000 2636 182077 4535 1261568 0 300 chrome
2019-12-13T09:57:33.815976+13:00 myserver kernel: [1155672.843607] [ 2653] 1000 2653 182205 4996 1314816 0 300 chrome
2019-12-13T09:57:33.815976+13:00 myserver kernel: [1155672.843608] [ 2938] 1000 2938 187762 7636 1593344 0 300 chrome
2019-12-13T09:57:33.815977+13:00 myserver kernel: [1155672.843609] [ 3222] 1000 3222 207255 12759 2572288 0 300 chrome
2019-12-13T09:57:33.815977+13:00 myserver kernel: [1155672.843610] [ 3610] 1000 3610 176509 3832 1060864 0 300 chrome
2019-12-13T09:57:33.815978+13:00 myserver kernel: [1155672.843611] [ 6970] 1000 6970 111138 2749 548864 0 300 chrome
2019-12-13T09:57:33.815978+13:00 myserver kernel: [1155672.843612] Out of memory: Kill process 26899 (QtWebEngineProc) score 310 or sacrifice child
2019-12-13T09:57:33.815978+13:00 myserver kernel: [1155672.843656] Killed process 26899 (QtWebEngineProc) total-vm:2108648kB, anon-rss:191316kB, file-rss:0kB, shmem-rss:164008kB
2019-12-13T09:57:33.816832+13:00 myserver kernel: [1155672.855879] oom_reaper: reaped process 26899 (QtWebEngineProc), now anon-rss:0kB, file-rss:0kB, shmem-rss:164692kB
2019-12-13T10:03:23.550542+13:00 myserver kernel: [1156021.291628] Purging GPU memory, 0 pages freed, 20709 pages still pinned.
2019-12-13T10:03:26.543167+13:00 myserver kernel: [1156021.291632] 1 and 0 pages still available in the bound and unbound GPU page lists.
2019-12-13T10:03:26.914609+13:00 myserver kernel: [1156021.291908] mongod invoked oom-killer: gfp_mask=0x14200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=0
2019-12-13T10:03:27.235869+13:00 myserver kernel: [1156021.291910] mongod cpuset=/ mems_allowed=0
2019-12-13T10:03:30.067478+13:00 myserver kernel: [1156021.291921] CPU: 5 PID: 2731 Comm: mongod Tainted: G OE 4.15.0-70201911191317-generic #0+mediatree+hauppauge-Ubuntu
2019-12-13T10:03:31.614913+13:00 myserver kernel: [1156021.291924] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z370 Gaming-ITX/ac, BIOS P1.10 09/21/2017
2019-12-13T10:03:32.735347+13:00 myserver kernel: [1156021.291926] Call Trace:
2019-12-13T10:03:33.267410+13:00 myserver kernel: [1156021.291940] dump_stack+0x63/0x8e
2019-12-13T10:03:37.614982+13:00 myserver kernel: [1156021.291947] dump_header+0x71/0x285
2019-12-13T10:03:37.631003+13:00 myserver kernel: [1156021.291954] ? security_capable_noaudit+0x4b/0x70
2019-12-13T10:03:37.631589+13:00 myserver kernel: [1156021.291959] oom_kill_process+0x21f/0x420
2019-12-13T10:03:37.631589+13:00 myserver kernel: [1156021.291964] out_of_memory+0x116/0x4e0
2019-12-13T10:03:37.631590+13:00 myserver kernel: [1156021.291970] __alloc_pages_slowpath+0xa53/0xe00
2019-12-13T10:03:37.631590+13:00 myserver kernel: [1156021.291978] ? alloc_pages_current+0x6a/0xe0
2019-12-13T10:03:37.631590+13:00 myserver kernel: [1156021.291984] __alloc_pages_nodemask+0x29a/0x2c0
2019-12-13T10:03:37.631590+13:00 myserver kernel: [1156021.291990] alloc_pages_current+0x6a/0xe0
2019-12-13T10:03:37.631591+13:00 myserver kernel: [1156021.291997] __page_cache_alloc+0x81/0xa0
2019-12-13T10:03:37.631592+13:00 myserver kernel: [1156021.292001] filemap_fault+0x3ea/0x6f0
2019-12-13T10:03:37.631592+13:00 myserver kernel: [1156021.292006] ? page_add_file_rmap+0x134/0x180
2019-12-13T10:03:37.631592+13:00 myserver kernel: [1156021.292010] ? filemap_map_pages+0x181/0x390
2019-12-13T10:03:37.631592+13:00 myserver kernel: [1156021.292015] ext4_filemap_fault+0x31/0x44
2019-12-13T10:03:37.631592+13:00 myserver kernel: [1156021.292020] __do_fault+0x5b/0x115
2019-12-13T10:03:37.631593+13:00 myserver kernel: [1156021.292026] __handle_mm_fault+0xdef/0x1290
2019-12-13T10:03:37.631593+13:00 myserver kernel: [1156021.292033] handle_mm_fault+0xb1/0x210
2019-12-13T10:03:37.631594+13:00 myserver kernel: [1156021.292040] __do_page_fault+0x281/0x4b0
2019-12-13T10:03:37.631594+13:00 myserver kernel: [1156021.292044] ? SyS_futex+0x13b/0x180
2019-12-13T10:03:37.631594+13:00 myserver kernel: [1156021.292050] do_page_fault+0x2e/0xe0
2019-12-13T10:03:37.631594+13:00 myserver kernel: [1156021.292056] ? page_fault+0x2f/0x50
2019-12-13T10:03:37.631594+13:00 myserver kernel: [1156021.292061] page_fault+0x45/0x50
2019-12-13T10:03:37.631595+13:00 myserver kernel: [1156021.292065] RIP: 0033:0x56528c4b5099
2019-12-13T10:03:37.631595+13:00 myserver kernel: [1156021.292068] RSP: 002b:00007f942f06eb80 EFLAGS: 00010246
2019-12-13T10:03:37.631595+13:00 myserver kernel: [1156021.292072] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f943332c1aa
2019-12-13T10:03:37.631596+13:00 myserver kernel: [1156021.292074] RDX: 0000565290b10588 RSI: 0000000000000000 RDI: 0000565290b10588
2019-12-13T10:03:37.631596+13:00 myserver kernel: [1156021.292075] RBP: 00007f942f06ebf0 R08: 0000000000000000 R09: 0000565290b105b0
2019-12-13T10:03:37.631597+13:00 myserver kernel: [1156021.292077] R10: 00007f942f06e9f0 R11: 0000000000000206 R12: 000056529082d400
2019-12-13T10:03:37.631598+13:00 myserver kernel: [1156021.292079] R13: 0000000000000000 R14: 0000565290b99000 R15: 0000565290b3c000
2019-12-13T10:03:37.631598+13:00 myserver kernel: [1156021.292083] Mem-Info:
2019-12-13T10:03:37.631598+13:00 myserver kernel: [1156021.292094] active_anon:6651747 inactive_anon:1163147 isolated_anon:0
2019-12-13T10:03:37.631598+13:00 myserver kernel: [1156021.292094] active_file:867 inactive_file:723 isolated_file:0
2019-12-13T10:03:37.631599+13:00 myserver kernel: [1156021.292094] unevictable:86 dirty:0 writeback:0 unstable:0
2019-12-13T10:03:37.631599+13:00 myserver kernel: [1156021.292094] slab_reclaimable:114335 slab_unreclaimable:51239
2019-12-13T10:03:37.631599+13:00 myserver kernel: [1156021.292094] mapped:442521 shmem:1239300 pagetables:51808 bounce:0
2019-12-13T10:03:37.631600+13:00 myserver kernel: [1156021.292094] free:50717 free_pcp:0 free_cma:0
2019-12-13T10:03:37.631600+13:00 myserver kernel: [1156021.292101] Node 0 active_anon:26606988kB inactive_anon:4652588kB active_file:3468kB inactive_file:2892kB unevictable:344kB isolated(anon):0kB isolated(file):0kB mapped:1770084kB dirty:0kB writeback:0kB shmem:4957200kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 2048kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes
2019-12-13T10:03:37.631601+13:00 myserver kernel: [1156021.292103] Node 0 DMA free:15884kB min:32kB low:44kB high:56kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15988kB managed:15884kB mlocked:0kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
2019-12-13T10:03:37.631601+13:00 myserver kernel: [1156021.292111] lowmem_reserve[]: 0 1873 31783 31783 31783
2019-12-13T10:03:37.631601+13:00 myserver kernel: [1156021.292119] Node 0 DMA32 free:123524kB min:3980kB low:5896kB high:7812kB active_anon:1381784kB inactive_anon:378740kB active_file:16kB inactive_file:140kB unevictable:24kB writepending:0kB present:2022916kB managed:1957340kB mlocked:24kB kernel_stack:1072kB pagetables:10716kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
2019-12-13T10:03:37.631602+13:00 myserver kernel: [1156021.292128] lowmem_reserve[]: 0 0 29910 29910 29910
2019-12-13T10:03:37.631602+13:00 myserver kernel: [1156021.292135] Node 0 Normal free:63460kB min:63568kB low:94192kB high:124816kB active_anon:25225204kB inactive_anon:4273848kB active_file:3456kB inactive_file:2752kB unevictable:320kB writepending:0kB present:31178752kB managed:30634172kB mlocked:320kB kernel_stack:34320kB pagetables:196516kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
2019-12-13T10:03:37.631603+13:00 myserver kernel: [1156021.292143] lowmem_reserve[]: 0 0 0 0 0
2019-12-13T10:03:37.631603+13:00 myserver kernel: [1156021.292150] Node 0 DMA: 3*4kB (U) 2*8kB (U) 3*16kB (U) 0*32kB 3*64kB (U) 2*128kB (U) 0*256kB 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (M) = 15884kB
2019-12-13T10:03:37.631603+13:00 myserver kernel: [1156021.292175] Node 0 DMA32: 971*4kB (UME) 223*8kB (UME) 694*16kB (UME) 1122*32kB (UME) 527*64kB (UME) 216*128kB (UME) 37*256kB (ME) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 123524kB
2019-12-13T10:03:37.631604+13:00 myserver kernel: [1156021.292200] Node 0 Normal: 705*4kB (UME) 1154*8kB (UME) 1751*16kB (UME) 731*32kB (UME) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 63460kB
2019-12-13T10:03:37.631604+13:00 myserver kernel: [1156021.292223] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
2019-12-13T10:03:37.631604+13:00 myserver kernel: [1156021.292225] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
2019-12-13T10:03:37.631605+13:00 myserver kernel: [1156021.292227] 1240898 total pagecache pages
2019-12-13T10:03:37.631605+13:00 myserver kernel: [1156021.292231] 0 pages in swap cache
2019-12-13T10:03:37.631605+13:00 myserver kernel: [1156021.292233] Swap cache stats: add 0, delete 0, find 0/0
2019-12-13T10:03:37.631605+13:00 myserver kernel: [1156021.292234] Free swap = 2968572kB
2019-12-13T10:03:37.631606+13:00 myserver kernel: [1156021.292236] Total swap = 2968572kB
2019-12-13T10:03:37.631606+13:00 myserver kernel: [1156021.292237] 8304414 pages RAM
2019-12-13T10:03:37.631606+13:00 myserver kernel: [1156021.292239] 0 pages HighMem/MovableOnly
2019-12-13T10:03:37.631607+13:00 myserver kernel: [1156021.292240] 152565 pages reserved
2019-12-13T10:03:37.631607+13:00 myserver kernel: [1156021.292241] 0 pages cma reserved
2019-12-13T10:03:37.631607+13:00 myserver kernel: [1156021.292243] 0 pages hwpoisoned
2019-12-13T10:03:37.631607+13:00 myserver kernel: [1156021.292244] [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name
2019-12-13T10:03:37.631608+13:00 myserver kernel: [1156021.292263] [ 393] 0 393 122557 807 999424 0 0 systemd-journal
答案1
vm.swappiness = 0 # Swap is disabled. In earlier versions, this meant that the kernel would swap only to avoid an out of memory condition, but in later versions this is achieved by setting to 1.
vm.swappiness = 1 # Kernel version 3.5 and over, as well as kernel version 2.6.32-303 and over: Minimum amount of swapping without disabling it entirely.
vm.swappiness = 10 # This value is sometimes recommended to improve performance when sufficient memory exists in a system, this value *10* could be considered for the performance being expected.
vm.swappiness = 60 # The default value.
vm.swappiness = 100 # The kernel will swap aggressively.
@sergly 建议 10,如果 1 没有改善,我将尝试 10。
https://help.ubuntu.com/community/SwapFaq
RAM No hibernation With Hibernation Maximum
32GB 6GB 38GB 64GB
尝试 6GB,提供更多的空间,然后监控其使用情况。