为什么docker工看到容器正在达到rss限制?

我试图理解为什么限制决定了一个任务需要被杀死,以及它如何进行会计。 当我的GCE Docker容器杀死一个进程时,它显示如下所示:

Task in /404daacfcf6b9e55f71b3d7cac358f0dc921a2d580eed460c2826aea8e43f05e killed as a result of limit of /404daacfcf6b9e55f71b3d7cac358f0dc921a2d580eed460c2826aea8e43f05e memory: usage 2097152kB, limit 2097152kB, failcnt 74571 memory+swap: usage 0kB, limit 18014398509481983kB, failcnt 0 kmem: usage 0kB, limit 18014398509481983kB, failcnt 0 Memory cgroup stats for /404daacfcf6b9e55f71b3d7cac358f0dc921a2d580eed460c2826aea8e43f05e: cache:368KB rss:2096784KB rss_huge:0KB mapped_file:0KB writeback:0KB inactive_anon:16KB active_anon:2097040KB inactive_file:60KB active_file:36KB unevictable:0KB [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name [ 4343] 0 4343 5440 65 15 0 0 bash [ 4421] 0 4421 265895 6702 77 0 0 npm [ 4422] 0 4422 12446 2988 28 0 0 gunicorn [ 4557] 0 4557 739241 346035 1048 0 0 gunicorn [ 4560] 0 4560 1086 24 8 0 0 sh [ 4561] 0 4561 5466 103 15 0 0 bash [14594] 0 14594 387558 168790 672 0 0 node Memory cgroup out of memory: Kill process 4557 (gunicorn) score 662 or sacrifice child Killed process 4557 (gunicorn) total-vm:2956964kB, anon-rss:1384140kB, file-rss:0kB 

据说内存达到了2GB的使用限制,有些东西需要死掉。 根据cgroup统计,我似乎在active_anonrss有2GB的用法。

当我查看进程统计表时,我没有看到2GB的位置:

对于rss ,我看到两个主要的进程346035 + 168790 = 514MB ? 对于total_vm ,我看到三个主要进程265895 + 739241 + 387558 = 1.4GB

但是当它决定杀死gunicorn进程时,它说它有3GB的Total VM和1.4GB的Anon RSS。 我根本看不出上述数字如何…

对于它的大部分生活来说,炮弹轰炸过程似乎在555m RES2131m VIRT以及22% MEM * 2.5GB box = 550MB的内存使用率下嗡嗡555m RES 。 (我还没有能够正确的时间偷看在它死亡时的top价值…)

  • 有人能帮我理解吗?
  • 在什么会计,这些和2GB的使用? (虚拟?rss?别的?)
  • 除了top / ps之外还有别的东西,我应该用它来追踪一个进程为了docker的杀死目的而使用了多less内存?