{"id":11649,"date":"2023-08-08T22:31:28","date_gmt":"2023-08-08T14:31:28","guid":{"rendered":"http:\/\/92it.top\/?p=11649"},"modified":"2023-08-18T09:35:29","modified_gmt":"2023-08-18T01:35:29","slug":"%e4%bd%a0%e5%8f%af%e8%83%bd%e4%b8%8d%e7%9f%a5%e9%81%93%e7%9a%84docker%e8%b5%84%e6%ba%90%e9%99%90%e5%88%b6","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=11649","title":{"rendered":"\u4f60\u53ef\u80fd\u4e0d\u77e5\u9053\u7684Docker\u8d44\u6e90\u9650\u5236"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1a<a href=\"https:\/\/www.cnblogs.com\/edisonchou\/p\/docker_resource_limitation_introduction.html\">https:\/\/www.cnblogs.com\/edisonchou\/p\/docker_resource_limitation_introduction.html<\/a><\/p>\n\n\n\n<p><strong>What is \u8d44\u6e90\u9650\u5236\uff1f<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5bb9\u5668\u662f\u6ca1\u6709\u8d44\u6e90\u9650\u5236\u7684\uff0c\u5b83\u4f1a\u5c3d\u53ef\u80fd\u5730\u4f7f\u7528\u5bbf\u4e3b\u673a\u80fd\u591f\u5206\u914d\u7ed9\u5b83\u7684\u8d44\u6e90\u3002Docker\u63d0\u4f9b\u4e86\u4e00\u79cd\u63a7\u5236\u5206\u914d\u591a\u5c11\u91cf\u7684\u5185\u5b58\u3001CPU\u6216\u963b\u585eI\/O\u7ed9\u4e00\u4e2a\u5bb9\u5668\u7684\u65b9\u5f0f\uff0c\u5373\u901a\u8fc7\u5728docker run\u6216docker create\u547d\u4ee4\u65f6\u8bbe\u7f6e\u8fd0\u884c\u65f6\u914d\u7f6e\u7684\u6807\u5fd7\u3002<\/p>\n\n\n\n<p>\u5176\u4e2d\u8bb8\u591a\u529f\u80fd\u90fd\u8981\u6c42\u60a8\u7684\u5185\u6838\u652f\u6301Linux\u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7docker info\u547d\u4ee4\u6765\u68c0\u67e5\u662f\u5426\u652f\u6301\uff0c\u5982\u679c\u5185\u6838\u4e2d\u7981\u7528\u4e86\u67d0\u9879\u529f\u80fd\uff0c\u90a3\u4f60\u53ef\u80fd\u4f1a\u5728\u4e0b\u8fb9\u6536\u5230\u4e00\u6761Warning\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-1024x474.png\" alt=\"\" class=\"wp-image-11651\" width=\"539\" height=\"249\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-1024x474.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-300x139.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-768x355.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-830x384.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-230x106.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-350x162.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2-480x222.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-2.png 1210w\" sizes=\"(max-width: 539px) 100vw, 539px\" \/><figcaption><em>docker-info<\/em><\/figcaption><\/figure><\/div>\n\n\n\n<p>\u5728Linux\u4e3b\u673a\u4e0a\uff0c\u5982\u679c\u5185\u6838\u68c0\u6d4b\u5230\u6ca1\u6709\u8db3\u591f\u7684\u5185\u5b58\u6765\u6267\u884c\u91cd\u8981\u7684\u7cfb\u7edf\u529f\u80fd\uff0c\u5b83\u4f1a\u629b\u51fa\u4e00\u4e2aOOME\uff08Out Of Memory Exception\uff09\uff0c\u4e00\u65e6\u53d1\u751fOOME\uff0cLinux\u5c31\u4f1a\u5f00\u59cb\u67e5\u6740\u8fdb\u7a0b\u4ee5\u91ca\u653e\u5185\u5b58\u3002\u4efb\u4f55\u8fdb\u7a0b\u90fd\u6709\u53ef\u80fd\u4f1a\u88ab\u6740\u6b7b\uff0c\u5305\u62ecdocker daemon\u548c\u5176\u4ed6\u91cd\u8981\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u5982\u679c\u9519\u8bef\u7684\u8fdb\u7a0b\u88ab\u6740\u6b7b\uff0c\u8fd9\u53ef\u4f1a\u964d\u4f4e\u6574\u4e2a\u7cfb\u7edf\u7684\u4f7f\u7528\u6548\u679c\u3002<\/p>\n\n\n\n<p><strong>\u9650\u5236Docker\u4f7f\u7528\u5185\u5b58<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728Docker\u4e2d\u53ef\u4ee5\u5f3a\u884c\u9650\u5236\u5bb9\u5668\u7684\u8d44\u6e90\u4f7f\u7528\u7684\u9650\u5236\uff0c\u5373\u53ea\u5141\u8bb8\u5bb9\u5668\u4f7f\u7528\u4e0d\u8d85\u8fc7\u7ed9\u5b9a\u6570\u91cf\u7684\u7cfb\u7edf\u5185\u5b58\u6216\u5176\u4ed6\u8f6f\u9650\u5236\u3002\u4e0b\u9762\u4ecb\u7ecd\u51e0\u4e2a\u6700\u5e38\u7528\u7684\u9009\u9879\uff0c\u6211\u4eec\u53ef\u4ee5\u5728docker run\u6216docker create\u521b\u5efa\u5bb9\u5668\u65f6\u6307\u5b9a\uff0c\u7528\u4ee5\u9650\u5236\u5bb9\u5668\u7684\u8d44\u6e90\u4f7f\u7528\u9650\u5236\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-1024x387.png\" alt=\"\" class=\"wp-image-11650\" width=\"519\" height=\"196\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-1024x387.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-300x113.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-768x290.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-830x313.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-230x87.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-350x132.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1-480x181.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-1.png 1372w\" sizes=\"(max-width: 519px) 100vw, 519px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u9650\u5236Docker\u4f7f\u7528CPU<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6bcf\u4e2a\u5bb9\u5668\u5bf9\u4e3b\u673aCPU\u5468\u671f\u7684\u8bbf\u95ee\u6743\u9650\u662f\u4e0d\u53d7\u9650\u5236\u7684\u3002\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\u5404\u79cd\u7ea6\u675f\u6765\u9650\u5236\u7ed9\u5b9a\u5bb9\u5668\u8bbf\u95ee\u4e3b\u673a\u7684CPU\u5468\u671f\u3002\u5927\u591a\u6570\u7528\u6237\u4f7f\u7528\u548c\u914d\u7f6eCFS\u8c03\u5ea6\u7a0b\u5e8f\uff08\u9ed8\u8ba4\uff09\u6216\u5b9e\u65f6\u8c03\u5ea6\u7a0b\u5e8f\u3002\u4e0b\u9762\u4ecb\u7ecd\u51e0\u4e2a\u5e38\u7528\u7684\u9009\u9879\uff0c\u7528\u4e8e\u914d\u7f6e\u9ed8\u8ba4\u7684CFS\u8c03\u5ea6\u7a0b\u5e8f\uff0c\u4ee5\u9650\u5236\u5bb9\u5668\u5bf9\u4e8eCPU\u7684\u4f7f\u7528\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-1024x332.png\" alt=\"\" class=\"wp-image-11652\" width=\"532\" height=\"172\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-1024x332.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-300x97.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-768x249.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-830x269.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-230x75.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-350x113.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3-480x156.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-3.png 1382w\" sizes=\"(max-width: 532px) 100vw, 532px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u9a8c\u8bc1Docker\u8d44\u6e90\u9650\u5236<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\uff081\uff09\u67e5\u770b\u5bbf\u4e3b\u673a\u7684\u8d44\u6e90\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">lscpu<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-1024x606.png\" alt=\"\" class=\"wp-image-11653\" width=\"548\" height=\"324\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-1024x606.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-300x178.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-768x455.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-830x491.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-230x136.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-350x207.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4-480x284.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-4.png 1220w\" sizes=\"(max-width: 548px) 100vw, 548px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">free -h<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-1024x115.png\" alt=\"\" class=\"wp-image-11655\" width=\"559\" height=\"63\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-1024x115.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-300x34.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-768x86.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-830x93.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-230x26.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-350x39.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5-480x54.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-5.png 1212w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/><\/figure><\/div>\n\n\n\n<p>\uff082\uff09\u62c9\u53d6\u7528\u4e8e\u538b\u6d4b\u7684\u955c\u50cf<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker pull lorel\/docker-stress-ng<\/pre>\n\n\n\n<p>\u66f4\u591a\u5173\u4e8edocker-stress-ng\u955c\u50cf\u7684\u8bf4\u660e\u8bf7\u53c2\u8003docker hub\u4e0a\u7684\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/hub.docker.com\/r\/lorel\/docker-stress-ng\/\">https:\/\/hub.docker.com\/r\/lorel\/docker-stress-ng\/<\/a><\/p>\n\n\n\n<p>\uff083\uff09\u5982\u679c\u60f3\u8981\u67e5\u770bdocker-stress-ng\u7684\u7528\u6cd5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u501f\u52a9&#8211;help\u6765\u83b7\u53d6\u9009\u9879\u7684\u542b\u4e49<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run --name stress --rm lorel\/docker-stress-ng:latest stress --help<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"434\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-1024x434.png\" alt=\"\" class=\"wp-image-11656\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-1024x434.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-300x127.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-768x326.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-830x352.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-230x97.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-350x148.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6-480x203.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/\u56fe\u7247-6.png 1208w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728\u5e2e\u52a9\u6587\u6863\u4e2d\uff0c\u7ed9\u51fa\u4e86\u4e00\u4e2aExample\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">stress-ng --cpu 8 --io 4 --vm 2 --vm-bytes 128M --fork 4 --timeout 10s<\/pre>\n\n\n\n<p>\u4e0b\u9762\u662f\u5b83\u7684\u91cd\u8981\u9009\u9879\u7684\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul><li>-c N, &#8211;cpu N \u542f\u52a8 N \u4e2a\u5b50\u8fdb\u7a0b\uff08 cpu \uff09<\/li><li>&#8211;vm N \u542f\u52a8 N \u4e2a\u8fdb\u7a0b\u5bf9\u5185\u5b58\u8fdb\u884c\u538b\u6d4b<\/li><li>&#8211;vm-bytes 128M \u6bcf\u4e2a\u5b50\u8fdb\u7a0b\u4f7f\u7528\u591a\u5c11\u5185\u5b58\uff08\u9ed8\u8ba4 256M&nbsp;\uff09<\/li><\/ul>\n\n\n\n<p>\uff084\uff09\u6d4b\u8bd5\u5185\u5b58\u4f7f\u7528\u9650\u5236<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run --name stress -it --rm -m 256m lorel\/docker-stress-ng:latest stress --vm 2<\/pre>\n\n\n\n<p>\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul><li>\u9650\u5236\u5185\u5b58\u4f7f\u7528\u6700\u591a256M<\/li><li>\u5f00\u542f\u538b\u6d4b\u542f\u52a82\u4e2a\u8fdb\u7a0b\uff0c\u6bcf\u4e2a\u8fdb\u7a0b\u4f7f\u7528256M\uff08\u9ed8\u8ba4\u503c\uff09<\/li><\/ul>\n\n\n\n<p>\u9a8c\u8bc1\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker stats stress<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"75\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-1024x75.gif\" alt=\"\" class=\"wp-image-11657\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-1024x75.gif 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-300x22.gif 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-768x56.gif 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-1536x112.gif 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-830x61.gif 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-230x17.gif 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-350x26.gif 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-memory-480x35.gif 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u65e0\u8bba\u542f\u52a8\u591a\u5c11\u4e2a\u4f7f\u7528256M\u7684\u8fdb\u7a0b\u505a\u538b\u6d4b\uff08\u8fd9\u91cc\u542f\u52a8\u4e862\u4e2a\u8fdb\u7a0b\uff0c\u6309\u7406\u4f1a\u4f7f\u7528512MB\u5185\u5b58\uff09\uff0cstress\u5bb9\u5668\u7684\u6700\u5927\u5185\u5b58\u4f7f\u7528\u91cf\u59cb\u7ec8\u7ef4\u6301\u5728256MB\u3002<\/p>\n\n\n\n<p>\uff085\uff09\u6d4b\u8bd5CPU\u4f7f\u7528\u9650\u5236<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run --name stress --rm --cpus 1 lorel\/docker-stress-ng:latest stress --cpu 4<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u7531\u4e8e\u6211\u7684\u5bbf\u4e3b\u673a\u53ea\u67092\u4e2aCPU\uff0c\u56e0\u6b64\u8fd9\u91cc\u9650\u5236stress\u5bb9\u5668\u53ea\u80fd\u4f7f\u7528\u6700\u591a1\u4e2aCPU\uff0c\u4f46\u662f\u538b\u6d4b\u8fdb\u7a0b\u53ef\u4ee5\u4f7f\u75284\u4e2aCPU\u3002 \u3000\u3000\u9a8c\u8bc1\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker stats stress<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"75\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-1024x75.gif\" alt=\"\" class=\"wp-image-11658\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-1024x75.gif 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-300x22.gif 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-768x56.gif 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-1536x112.gif 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-830x61.gif 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-230x17.gif 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-350x26.gif 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-480x35.gif 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u65e0\u8bba\u538b\u6d4b\u7684\u8fdb\u7a0b\u88ab\u5141\u8bb8\u4f7f\u7528\u591a\u5c11\u4e2aCPU\uff0cstress\u7684CPU\u4f7f\u7528\u91cf\u59cb\u7ec8\u5728100%\u5de6\u53f3\uff08\u5b58\u5728\u4e00\u5b9a\u8bef\u5dee\u662f\u6b63\u5e38\u7684\uff09\u3002 \u90a3\u4e48\uff0c\u5982\u679c\u6211\u4eec\u4e0d\u9650\u5236CPU\u5462\uff1f<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run --name stress --rm lorel\/docker-stress-ng:latest stress --cpu 4<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"75\" src=\"http:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-1024x75.gif\" alt=\"\" class=\"wp-image-11659\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-1024x75.gif 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-300x22.gif 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-768x56.gif 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-1536x112.gif 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-830x61.gif 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-230x17.gif 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-350x26.gif 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/08\/stress-ng-cpu-no-limit-480x35.gif 480w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4ece\u4e0a\u56fe\u53ef\u77e5\uff0cstress\u5bb9\u5668\u4f1a\u5c3d\u53ef\u80fd\u5730\u5403\u6389\u5c3d\u53ef\u80fd\u591a\u7684CPU\u8d44\u6e90\uff0c\u7531\u4e8e\u5bbf\u4e3b\u673a\u53ea\u67092\u4e2aCPU\uff0c\u56e0\u6b64\u539f\u5219\u4e0a\u4e0d\u4f1a\u4f7f\u7528\u8d85\u8fc7200%\u7684CPU\uff08\u5f53\u7136\uff0c\u4e5f\u4f1a\u5b58\u5728\u4e00\u5b9a\u7684\u8bef\u5dee\uff0c\u6b63\u5e38\u7684\uff09<\/p>\n\n\n\n<p><strong>\u5c0f\u7ed3<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u672c\u6587\u63a2\u7d22\u4e86Docker\u7684\u8d44\u6e90\u9650\u5236\u76f8\u5173\u77e5\u8bc6\uff0c\u5728\u65e5\u5e38\u5f00\u53d1\u4e2d\u5e94\u8be5\u7ed9\u5bb9\u5668\u8bbe\u7f6e\u4e00\u4e2a\u5408\u7406\u7684\u8d44\u6e90\u9650\u5236\u503c\uff0c\u4ee5\u9632\u51fa\u73b0OOME\u7684\u60c5\u51b5\u5bfc\u81f4Linux\u6740\u6389\u9519\u8bef\u7684\u8fdb\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1ahttps:\/\/www.cnblogs.com\/edisonchou\/p\/docker_resource [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11649"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11649"}],"version-history":[{"count":4,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11649\/revisions"}],"predecessor-version":[{"id":11937,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/11649\/revisions\/11937"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}