{"id":1221,"date":"2018-10-07T02:19:11","date_gmt":"2018-10-07T02:19:11","guid":{"rendered":"http:\/\/www.ipcpu.com\/?p=1221"},"modified":"2019-06-07T02:21:38","modified_gmt":"2019-06-07T02:21:38","slug":"pod-cgroup","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2018\/10\/pod-cgroup\/","title":{"rendered":"\u5728\u5bb9\u5668(Pod)\u5185\u90e8\u83b7\u53d6\u5bb9\u5668\u672c\u8eab\u7684\u8d44\u6e90\u9650\u5236"},"content":{"rendered":"

\u5728\u5bb9\u5668(Pod)\u5185\u90e8\u83b7\u53d6\u5bb9\u5668\u672c\u8eab\u7684\u8d44\u6e90\u9650\u5236.md
\n<\/p>\n

\u6982\u8ff0<\/h2>\n

\u5bb9\u5668\u8d44\u6e90\u9694\u79bb\u57fa\u7840\u662fLinux\u4e2d\u5404\u79cdnamespace\u5bf9\u8d44\u6e90\u7684\u9694\u79bb\u3002\u4f46\u662fLinux\u4e2d\u5e76\u4e0d\u662f\u6240\u6709\u7684\u8d44\u6e90\u90fd\u53ef\u4ee5\u4f7f\u7528namespace\u6765\u9694\u79bb\uff0c\u6bd4\u5982SELinux\u3001time\u3001syslog\u3002namespace\u7684\u9694\u79bb\u4e5f\u662f\u4e0d\u5168\u9762\u7684\uff0c\u6bd4\u5982\/proc \u3001\/sys \u3001\/dev\/sd*\u6ca1\u6709\u5b8c\u5168\u9694\u79bb\u3002<\/p>\n

\u4e5f\u5c31\u662f\u8bf4\u5728\u5bb9\u5668\u4e2d\u6267\u884c\u4e00\u4e9b\u6293\u53d6\u4e0a\u9762\u6ca1\u6709\u5b8c\u5168\u9694\u79bb\u7684\u76ee\u5f55\u65f6\uff0c\u83b7\u53d6\u7684\u662f\u5bbf\u4e3b\u673a\u4e0a\u7684\u4fe1\u606f\u3002\u6bd4\u5982\u547d\u4ee4free\uff0cfree\u4e3b\u8981\u8bfb\u53d6\/proc\u6216\/sys\u76ee\u5f55<\/p>\n

Docker\u7684\u8bbe\u8ba1\u8005\u4e5f\u610f\u8bc6\u5230\u8fd9\u6837\u786e\u5b9e\u5b58\u5728\u5f88\u5927\u4e0d\u4fbf\uff0c\u4e8e\u662f\u4eceDocker\u57281.8\u7248\u672c\u4ee5\u540e\u5c06\u5206\u914d\u7ed9\u5bb9\u5668\u7684cgroup\u8d44\u6e90\u6302\u8f7d\u5230\u5bb9\u5668\u5185\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u5bb9\u5668\u5185\u90e8\u67e5\u770b\u5230cgroup\u8d44\u6e90\u9694\u79bb\u60c5\u51b5\u3002<\/p>\n

\u5728\u5bb9\u5668\u5185\u8bfb\u53d6cgroup\u8d44\u6e90\u9650\u5236<\/h2>\n
\n
#\u67e5\u770b\u5bb9\u5668\u6838\u6570\uff0c\u9664100000\ncat \/sys\/fs\/cgroup\/cpu\/cpu.cfs_quota_us \n\n#\u83b7\u53d6\u5185\u5b58\u4f7f\u7528\ncat \/sys\/fs\/cgroup\/memory\/memory.usage_in_bytes \ncat \/sys\/fs\/cgroup\/memory\/memory.limit_in_bytes \n#\u6ce8\u610f\u8fd9\u91cc\u5df2\u7ecf\u4f7f\u7528\u7684\u5185\u5b58usage_in_bytes\u662f\u5305\u542bcache\u7684\uff0c\u8be6\u7ec6\u7684\u60c5\u51b5\u53ef\u4ee5\u4ece\/sys\/fs\/cgroup\/memory\/memory.stat\u4e2d\u83b7\u53d6\n\n#\u67e5\u770b\u5bb9\u5668\u662f\u5426\u8bbe\u7f6eoom\uff0coom_kill_disable\u9ed8\u8ba4\u4e3a0\u8868\u793a\u5f00\u542f\ncat \/sys\/fs\/cgroup\/memory\/memory.oom_control \n\n#\u83b7\u53d6\u78c1\u76d8io\ncat \/sys\/fs\/cgroup\/blkio\/blkio.throttle.io_service_bytes\n\n#\u83b7\u53d6\u7f51\u5361\u51fa\u5165\u6d41\u91cf\ncat \/sys\/class\/net\/eth0\/statistics\/rx_bytes \ncat \/sys\/class\/net\/eth0\/statistics\/tx_bytes<\/code><\/pre>\n<\/div>\n

\u53c2\u8003\u8d44\u6599<\/h2>\n

https:\/\/www.li-rui.top\/2018\/12\/25\/docker\/docker%E4%B8%ADjdk%E4%BC%98%E5%8C%96\/<\/a>
\n
https:\/\/royvanrijn.com\/blog\/2018\/05\/java-and-docker-memory-limits\/<\/a><\/p>\n

https:\/\/docs.docker.com\/release-notes\/docker-engine\/#180-2015-08-11<\/a><\/p>\n

<\/p>\n

<\/div>\n
<\/div>\n
\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n<\/div>\n
\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n
<\/div>\n<\/div>\n

<\/wiz_tmp_tag><\/p>\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » \u5728\u5bb9\u5668(Pod)\u5185\u90e8\u83b7\u53d6\u5bb9\u5668\u672c\u8eab\u7684\u8d44\u6e90\u9650\u5236<\/a><\/p>","protected":false},"excerpt":{"rendered":"

\u5728\u5bb9\u5668(Pod)\u5185\u90e8\u83b7\u53d6\u5bb9\u5668\u672c\u8eab\u7684\u8d44\u6e90\u9650\u5236.md \u6982\u8ff0 \u5bb9\u5668\u8d44\u6e90\u9694\u79bb\u57fa\u7840\u662fLinux\u4e2d\u5404\u79cdnamespace\u5bf9\u8d44\u6e90\u7684\u9694\u79bb\u3002\u4f46\u662fLinux\u4e2d\u5e76\u4e0d\u662f\u6240\u6709\u7684\u8d44\u6e90\u90fd\u53ef\u4ee5\u4f7f\u7528namespace\u6765\u9694\u79bb\uff0c\u6bd4\u5982SELinux\u3001time\u3001syslog\u3002namespace\u7684\u9694\u79bb\u4e5f\u662f\u4e0d\u5168\u9762\u7684\uff0c\u6bd4\u5982\/proc \u3001\/sys \u3001\/dev\/sd*\u6ca1\u6709\u5b8c\u5168\u9694\u79bb\u3002 \u4e5f\u5c31\u662f\u8bf4\u5728\u5bb9\u5668\u4e2d\u6267\u884c\u4e00\u4e9b\u6293\u53d6\u4e0a\u9762\u6ca1\u6709\u5b8c\u5168\u9694\u79bb\u7684\u76ee\u5f55\u65f6\uff0c\u83b7\u53d6\u7684\u662f\u5bbf\u4e3b\u673a\u4e0a\u7684\u4fe1\u606f\u3002\u6bd4\u5982\u547d\u4ee4free\uff0cfree\u4e3b\u8981\u8bfb\u53d6\/proc\u6216\/sys\u76ee\u5f55 Docker\u7684\u8bbe\u8ba1\u8005\u4e5f\u610f\u8bc6\u5230\u8fd9\u6837\u786e\u5b9e\u5b58\u5728\u5f88\u5927\u4e0d\u4fbf\uff0c\u4e8e\u662f\u4eceDocker\u57281.8\u7248\u672c\u4ee5\u540e\u5c06\u5206\u914d\u7ed9\u5bb9\u5668\u7684cgroup\u8d44\u6e90\u6302\u8f7d\u5230\u5bb9\u5668\u5185\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u5bb9\u5668\u5185\u90e8\u67e5\u770b\u5230cgroup\u8d44\u6e90\u9694\u79bb\u60c5\u51b5\u3002 \u5728\u5bb9\u5668\u5185\u8bfb\u53d6cgroup\u8d44\u6e90\u9650\u5236 #\u67e5\u770b\u5bb9\u5668\u6838\u6570\uff0c\u9664100000 cat \/sys\/fs\/cgroup\/cpu\/cpu.cfs_quota_us #\u83b7\u53d6\u5185\u5b58\u4f7f\u7528 cat \/sys\/fs\/cgroup\/memory\/memory.usage_in_bytes cat \/sys\/fs\/cgroup\/memory\/memory.limit_in_bytes #\u6ce8\u610f\u8fd9\u91cc\u5df2\u7ecf\u4f7f\u7528\u7684\u5185\u5b58usage_in_bytes\u662f\u5305\u542bcache\u7684\uff0c\u8be6\u7ec6\u7684\u60c5\u51b5\u53ef\u4ee5\u4ece\/sys\/fs\/cgroup\/memory\/memory.stat\u4e2d\u83b7\u53d6 #\u67e5\u770b\u5bb9\u5668\u662f\u5426\u8bbe\u7f6eoom\uff0coom_kill_disable\u9ed8\u8ba4\u4e3a0\u8868\u793a\u5f00\u542f cat \/sys\/fs\/cgroup\/memory\/memory.oom_control #\u83b7\u53d6\u78c1\u76d8io cat \/sys\/fs\/cgroup\/blkio\/blkio.throttle.io_service_bytes #\u83b7\u53d6\u7f51\u5361\u51fa\u5165\u6d41\u91cf cat \/sys\/class\/net\/eth0\/statistics\/rx_bytes cat \/sys\/class\/net\/eth0\/statistics\/tx_bytes \u53c2\u8003\u8d44\u6599 https:\/\/www.li-rui.top\/2018\/12\/25\/docker\/docker%E4%B8%ADjdk%E4%BC%98%E5%8C%96\/ https:\/\/royvanrijn.com\/blog\/2018\/05\/java-and-docker-memory-limits\/ https:\/\/docs.docker.com\/release-notes\/docker-engine\/#180-2015-08-11 \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def » \u5728\u5bb9\u5668(Pod)\u5185\u90e8\u83b7\u53d6\u5bb9\u5668\u672c\u8eab\u7684\u8d44\u6e90\u9650\u5236<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[195,68,129],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1221"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=1221"}],"version-history":[{"count":1,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1221\/revisions"}],"predecessor-version":[{"id":1222,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1221\/revisions\/1222"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=1221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=1221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=1221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}