我用python写了一个爬虫编码,但是经常导致oomkiller,oomkiller让linux死机,我无法通过ssh连接到os。我还写了一个脚本来保护内存,如果内存
使用超过80% [memusage = (MemTotal - MeMFree - Buffers - Cached)/MeMTotal],重启爬虫。但这似乎行不通。所以我的问题是如何避免 oom Killer,即使 oom Killer 发生,有什么方法可以避免冻结整个操作系统?
当 oom-killer 发生时,屏幕会打印以下信息,谁能向我解释这些信息?
ve:okB present:16256kB Pages_scanned:173280531 all_unreclaimable? yes
[9132.468227] lowmem_reserve[]: 0 829 829 829
[9132.468403]Normal free:3628kB min:3648kB low:4568kB high:5472kB active:614280kB inactive:22508kB present:849376kB pages_scanned:1415839762 all_unreclaimable? yes
[9132.468713] lowmem_reserve[]: 0 0 0 0
[9132.468883]DMA: 0.4kB 1.8kB 1*16kB 1,32kB 0*64kB 0*128kB 1*256kB 0*512kB 1*1024kB 1*2048kB 0*4096kB = 3384kB
[9132.469286]Normal:7.4kB 5*8kB 0*16kB 1*32kB 1*64kB 1*128kB 1*256kB 0*512kB 1*1024kB 1*2048kB 0*4096kB = 3620kB
[9132.469674]Swap cache:add 0, delete 0, find 0/0, race 0+0
[9132.469825]Frees swap = 0kB
[9132.469905]Total swap = 0kB
[9132.469986]Free swap: 0kB
[9132.472289]218112 pages of RAM
[9132.472386]0 pages of HIGHMEM
[9132.472469]44668 reserved pages
[9132.472553]5732 pages shared
[9132.472634]0 pages swap cached
[9132.472760]0 pages dirty
[9132.472837]0 pages writeback
[9132.472919]874 pages mapped
[9132.472999]3343 pages slab
[9132.473082]392 pages pagetables