{"id":781,"date":"2021-02-14T12:58:44","date_gmt":"2021-02-14T03:58:44","guid":{"rendered":"https:\/\/medicalfields.jp\/blog\/?p=781"},"modified":"2021-02-14T12:58:45","modified_gmt":"2021-02-14T03:58:45","slug":"%e3%83%a1%e3%83%a2%e3%83%aa%e3%81%a8cpu%e3%81%ab%e4%bd%99%e8%a3%95%e3%81%8c%e3%81%82%e3%82%8b%e3%81%ae%e3%81%abnginx%e3%81%a7503%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%8c%e5%87%ba%e3%81%a6%e3%80%81php-fpm","status":"publish","type":"post","link":"https:\/\/medicalfields.jp\/blog\/centos\/%e3%83%a1%e3%83%a2%e3%83%aa%e3%81%a8cpu%e3%81%ab%e4%bd%99%e8%a3%95%e3%81%8c%e3%81%82%e3%82%8b%e3%81%ae%e3%81%abnginx%e3%81%a7503%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%8c%e5%87%ba%e3%81%a6%e3%80%81php-fpm\/","title":{"rendered":"\u30e1\u30e2\u30ea\u3068CPU\u306b\u4f59\u88d5\u304c\u3042\u308b\u306e\u306bnginx\u3067503\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3001php-fpm\u304c\u6b62\u307e\u3063\u305f"},"content":{"rendered":"\n<p>\u7279\u306b\u524d\u5146\u306f\u306a\u304f\uff08\u5b9f\u306f\u3042\u3063\u305f\u3093\u3060\u3051\u3069\uff09\u30b5\u30fc\u30d0\u30fc\u304c\u6b7b\u3093\u3060\u3002<\/p>\n<p>\u6700\u8fd1\u306f\u30a2\u30af\u30c6\u30a3\u30d6\u30e6\u30fc\u30b6\u30fc\u304c\u5897\u3048\u3066\u304f\u308c\u3066\u3001POST\u30671\u65e5200\u4e07\u30ea\u30af\u30a8\u30b9\u30c8\uff08\u8ee2\u9001\u91cf20GB\uff09\u3092\u3053\u3048\u305f\u308a\u3057\u3066\u305f\u3093\u3060\u3051\u3069\u3001\u7a81\u7136503\u30a8\u30e9\u30fc\u3067\u5b8c\u5168\u306b\u5fdc\u7b54\u3057\u306a\u304f\u306a\u3063\u305f\u3002\uff08\u30a2\u30d7\u30ea\u3067\u306f\u901a\u4fe1\u30a8\u30e9\u30fc\u3068\u51fa\u308b\uff09<\/p>\n<p>\u69cb\u6210\u3068\u3057\u3066Conoha\u306e \u30e1\u30e2\u30ea 4GB\/CPU 4Core\u00d72\u53f0<\/p>\n<p>\u3053\u308c\u3092\u30ed\u30fc\u30c9\u30d0\u30e9\u30f3\u30b5\u30fc\u3067\u3064\u306a\u3044\u3067\u3044\u308b\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u307e\u3041htop\u3067\u30ed\u30fc\u30c9\u30a2\u30d9\u30ec\u30fc\u30b8\u3082\u4e21\u30b5\u30fc\u30d0\u30fc0.6\u3068\u304b\u3067\u3001\u3053\u308c\u3060\u3063\u305f\u3089\u4f59\u88d5\u3060\u308d\uff5e\u3063\u3066\u773a\u3081\u3066\u305f\u3089\u6b7b\u3093\u3060\u3002<\/p>\n<p>\u3066\u304b\u5b9f\u969b\u306b\u843d\u3061\u305f\u3068\u304d\u306bhtop\u3067\u78ba\u8a8d\u3057\u305f\u3051\u3069\u30ed\u30fc\u30c9\u30a2\u30d9\u30ec\u30fc\u30b8\u304c1\u3092\u8d85\u3048\u3066\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>\u306a\u3093\u3067\uff1f\uff1f\u3068\u3044\u3046\u601d\u3044\u304c\u5f37\u304b\u3063\u305f\u3051\u3069\u3001TCP\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u4f7f\u3044\u5207\u3063\u305f\u3068\u304a\u3082\u3063\u3066\u3001\u3068\u308a\u3042\u3048\u305a\u30b5\u30fc\u30d0\u30fc\u30ea\u30d6\u30fc\u30c8\u3067\u554f\u984c\u306a\u304f\u6cbb\u3063\u305f\u3002<\/p>\n<p>\u3053\u308c\u306f\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u306e\u53ef\u80fd\u6027\u304c\u3042\u308b\u306a\u3068\u601d\u3063\u3066\uff08\u30b5\u30fc\u30d0\u30fc\u81ea\u4f53\u306f\u534a\u5e74\u4ee5\u4e0a\u518d\u8d77\u52d5\u3068\u304b\u3057\u3066\u306a\u3044\uff09<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u69d8\u5b50\u898b\u3057\u305f\u3089\u4e00\u65e5\u554f\u984c\u306a\u304f\u52d5\u3044\u305f\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u5b9f\u306f\u8a2d\u5b9a\u60aa\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\uff01<\/p>\n<p>\u00a0<\/p>\n<p>nginx_error.log<\/p>\n<p>connect() to unix:\/var\/run\/php-fpm\/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client:<\/p>\n<p>\u00a0<\/p>\n<p>php-fpm-error.log<\/p>\n<p>[21-Jan-2021 10:50:43] WARNING: [pool www] server reached pm.max_children setting (100), consider raising it<br \/>[21-Jan-2021 11:01:23] NOTICE: Terminating &#8230;<br \/>[21-Jan-2021 11:01:23] NOTICE: exiting, bye-bye!<br \/>[21-Jan-2021 11:01:43] NOTICE: fpm is running, pid 1009<br \/>[21-Jan-2021 11:01:43] NOTICE: ready to handle connections<br \/>[21-Jan-2021 11:01:43] NOTICE: systemd monitor interval set to 10000ms<br \/>[21-Jan-2021 11:01:52] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 8 children, there are 0 idle, and 17 total children<br \/>[21-Jan-2021 11:01:53] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 16 children, there are 0 idle, and 25 total children<br \/>[21-Jan-2021 11:01:54] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 32 children, there are 0 idle, and 35 total children<br \/>[21-Jan-2021 11:01:55] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 32 children, there are 0 idle, and 45 total children<br \/>[21-Jan-2021 11:01:56] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 32 children, there are 0 idle, and 55 total children<br \/>[21-Jan-2021 11:01:57] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 32 children, there are 0 idle, and 65 total children<br \/>[21-Jan-2021 11:01:58] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 32 children, there are 9 idle, and 75 total children<br \/>[21-Jan-2021 11:01:59] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 32 children, there are 9 idle, and 76 total children<br \/>[21-Jan-2021 11:02:21] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 8 children, there are 8 idle, and 84 total children<br \/>[21-Jan-2021 11:02:22] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 16 children, there are 9 idle, and 86 total children<br \/>[21-Jan-2021 11:02:45] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min\/max_spare_servers), spawning 8 children, there are 8 idle, and 98 total children<br \/>[21-Jan-2021 11:02:49] WARNING: [pool www] server reached pm.max_children setting (100), consider raising it<\/p>\n<p>\u00a0<\/p>\n<p>\u307e\u305aworker_processes \u3092\u78ba\u8a8d\uff01<\/p>\n<p>worker_processes auto;\u2190\u3053\u308c\u304c\u826f\u3044<\/p>\n<p>\u3053\u308c\u304cworker_processes\u00a0 1\uff08\uff01\uff1f\uff09\u306b\u306a\u3063\u3066\u305f<\/p>\n<p>CPU\u30b3\u30a24\u306a\u306e\u306b\u3001\u3053\u308c\u3058\u3083\u30421\u500b\u3057\u304b\u4f7f\u308f\u306a\u3044<\/p>\n<p>\u3042\u3068\u30b3\u30cd\u30af\u30b7\u30e7\u30f3\u306e\u4e0a\u9650\u3082\u5ff5\u306e\u70ba\u3042\u3052\u3068\u304f<br \/>worker_rlimit_nofile 16384;<\/p>\n<p>events {<br \/>worker_connections 4096;<br \/>}<\/p>\n<p>\u203bworker_rlimit_nofile\u306f\u8a2d\u5b9a\u3057\u306a\u3044\u30681024\u3068\u304b\u306b\u5236\u9650\u3055\u308c\u3061\u3083\u3046\u304b\u3089\u5fc5\u8981<\/p>\n<p>\u00a0<\/p>\n<p>\u524d\u63d0\u3068\u3057\u3066dynamic\u3067<\/p>\n<p>\u3042\u3068\u3001php-fpm\u304c\u5e73\u5747\u3057\u3066\u3069\u308c\u3050\u3089\u3044\u30e1\u30e2\u30ea\u4f7f\u3046\u304b\u306b\u3088\u3063\u3066pm.max_children<\/p>\n<p>\u306e\u8a2d\u5b9a\u3082\u5909\u3048\u307e\u3057\u3087\u3046<\/p>\n<p>pm.max_children = 200<\/p>\n<p>\u306b\u3057\u305f<\/p>\n<p>ps -ylC php-fpm &#8211;sort:rss<\/p>\n<p>\u3067\u8abf\u3079\u308c\u308b<\/p>\n<p>RSS\u304c\u30e1\u30e2\u30ea\u4f7f\u7528\u7387\u3067KB\u3067\u8868\u793a\u3055\u308c\u307e\u3059\uff0824116\u3060\u3063\u305f\u308924116KB\uff09<\/p>\n<p>\u3060\u3044\u305f\u3044\u96f0\u56f2\u6c17\u306e\u5e73\u5747\u3092\u3068\u3063\u3066\u300120MB\u3050\u3089\u3044\u3060\u306a\uff5e\u3068\u304a\u3082\u3063\u3066<\/p>\n<p>\u30e1\u30e2\u30ea\uff14GB\u3060\u3063\u305f\u3089<\/p>\n<p>4000MB\/20MB\u306e200<\/p>\n<p>\u3053\u306e200\u3092pm.max_children\u306b\u3057\u305f\uff08\u672c\u5f53\u306f\u3082\u3063\u3068\u5b89\u5168\u3092\u3068\u3063\u3066\u4f4e\u3044\u307b\u3046\u304c\u3044\u3044\u304b\u3082\uff09<\/p>\n<p>\u53c2\u8003\u2192https:\/\/myshell.co.uk\/blog\/2012\/07\/adjusting-child-processes-for-php-fpm-nginx\/<\/p>\n<p>\u00a0<\/p>\n<p>\u3042\u3068pm.max_requests\u304c\u81ea\u5206\u7684\u306b\u306f\u3061\u3087\u3063\u3068\u5927\u4e8b\uff01<\/p>\n<p>\u4eca\u307e\u3067\u306fpm.max_requests\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e0\u306b\u3057\u3066\u3044\u305f<\/p>\n<p>\u3067\u3082\u591a\u5206\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u306e\u53ef\u80fd\u6027\u304c\u3042\u3063\u3066\u3001\u30e1\u30e2\u30ea\u4f7f\u3044\u5207\u3063\u3066\u4e0d\u5b89\u5b9a\u306b\u306a\u3063\u305f\u53ef\u80fd\u6027\u304c\u3042\u308b\u3002\u3053\u306epm.max_requests\u3063\u3066\u3044\u3046\u306e\u306fmax_requests\u306e\u56de\u6570\u306b\u9054\u3057\u305f\u3089\u30d7\u30ed\u30bb\u30b9\u3092\u518d\u8d77\u52d5\u3059\u308b\u8a2d\u5b9a\u306b\u306a\u308b\u304b\u3089\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u304c\u3042\u3063\u3066\u3082\u89e3\u6d88\u3067\u304d\u308b\u3002<\/p>\n<p>\u3064\u307e\u308a\u3053\u308c\u304c\u5b9f\u306f\u5927\u4e8b\u3060\u3063\u305f\u304b\u3082\u3002<\/p>\n<p>\u305f\u3060\u73fe\u5728\u30011\u65e5200\u4e07PV\u306a\u306e\u3067\uff11\u65e5\u3050\u3089\u3044\u3067\u518d\u8d77\u52d5\u3055\u305b\u305f\u3044\u5834\u5408\u3001<\/p>\n<p>1\u65e5\u306e\u30ea\u30af\u30a8\u30b9\u30c8\uff08PV\uff09\u6570\u00a0\u00f7 pm.max_spare_servers\u306b\u306a\u308b\u306e\u3067<\/p>\n<p>\u3060\u3044\u305f\u304450000\u3050\u3089\u3044\uff1f<\/p>\n<p>\u306a\u3093\u304b\u51c4\u304f\u5927\u304d\u306a\u5024\u306b\u306a\u3063\u305f\u3002<\/p>\n<p>\u307e\u30410\u3088\u308a\u306f\u3044\u3044\u3067\u3057\u3087\u3046<\/p>\n<p>\u00a0<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3053\u308c\u3067\u69d8\u5b50\u3092\u307f\u308b\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u8ffd\u8a18\uff1a\u5ff5\u306e\u305f\u3081\u30e1\u30e2\u30ea\u30828GB\u306b\u3057\u305f\u3002<\/p>\n<p>\u3067\u3082\u3053\u308c\u591a\u52062\u53f0\u3067\u3084\u308b\u3001 8GB\u00d78GB\u3088\u308a4GB\u00d74GB\u00d74GB\u3068\u304b\u306e\u307b\u3046\u304c\u826f\u3044\u6c17\u3082\u3059\u308b\u3002<\/p>\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7279\u306b\u524d\u5146\u306f\u306a\u304f\uff08\u5b9f\u306f\u3042\u3063\u305f\u3093\u3060\u3051\u3069\uff09\u30b5\u30fc\u30d0\u30fc\u304c\u6b7b\u3093\u3060\u3002 \u6700\u8fd1\u306f\u30a2\u30af\u30c6\u30a3\u30d6\u30e6\u30fc\u30b6\u30fc\u304c\u5897\u3048\u3066\u304f\u308c\u3066\u3001POST\u30671\u65e5200\u4e07\u30ea\u30af\u30a8\u30b9\u30c8\uff08\u8ee2\u9001\u91cf20GB\uff09\u3092\u3053\u3048\u305f\u308a\u3057\u3066\u305f\u3093\u3060\u3051\u3069\u3001\u7a81\u7136503\u30a8\u30e9\u30fc\u3067\u5b8c\u5168\u306b\u5fdc\u7b54\u3057\u306a\u304f\u306a\u3063\u305f\u3002\uff08\u30a2\u30d7 &hellip; <a href=\"https:\/\/medicalfields.jp\/blog\/centos\/%e3%83%a1%e3%83%a2%e3%83%aa%e3%81%a8cpu%e3%81%ab%e4%bd%99%e8%a3%95%e3%81%8c%e3%81%82%e3%82%8b%e3%81%ae%e3%81%abnginx%e3%81%a7503%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%8c%e5%87%ba%e3%81%a6%e3%80%81php-fpm\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u30e1\u30e2\u30ea\u3068CPU\u306b\u4f59\u88d5\u304c\u3042\u308b\u306e\u306bnginx\u3067503\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3001php-fpm\u304c\u6b62\u307e\u3063\u305f<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[17],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6kJO0-cB","_links":{"self":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts\/781"}],"collection":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/comments?post=781"}],"version-history":[{"count":7,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts\/781\/revisions"}],"predecessor-version":[{"id":789,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/posts\/781\/revisions\/789"}],"wp:attachment":[{"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/media?parent=781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/categories?post=781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/medicalfields.jp\/blog\/wp-json\/wp\/v2\/tags?post=781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}