{"id":691,"date":"2021-09-28T16:05:41","date_gmt":"2021-09-28T07:05:41","guid":{"rendered":"https:\/\/webclass.jp\/blog\/?p=691"},"modified":"2021-09-28T16:05:41","modified_gmt":"2021-09-28T07:05:41","slug":"apache-mpm_prefork-%e3%81%a8-php-fpm-%e3%81%ae%e5%8a%b9%e7%8e%87%e3%81%ae%e9%81%95%e3%81%84","status":"publish","type":"post","link":"https:\/\/webclass.jp\/blog\/2021\/09\/28\/apache-mpm_prefork-%e3%81%a8-php-fpm-%e3%81%ae%e5%8a%b9%e7%8e%87%e3%81%ae%e9%81%95%e3%81%84\/","title":{"rendered":"Apache mpm_prefork \u3068 PHP-FPM \u306e\u52b9\u7387\u306e\u9055\u3044"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u798f\u5ca1\u3067\u3059\u3002<\/p>\n<p>Apache mpm_prefork + mod_php \u3068 mpm_event + PHP-FPM \u3092\u4f7f\u3063\u305f\u3068\u304d\u306e\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u304c\u5897\u3048\u305f\u3068\u304d\u306e\u52b9\u7387\u3092\u8abf\u67fb\u3057\u307e\u3057\u305f\u306e\u3067\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>WebClass \u306fWeb\u30b5\u30fc\u30d0\u306bApache\u3068\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u306b PHP \u3092\u7528\u3044\u3066\u3044\u307e\u3059\u3002\u540c\u6642\u591a\u6570\u306e\u30a2\u30af\u30bb\u30b9\u3092\u6271\u3046\u305f\u3081\u306e\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306f\u5e38\u306b\u554f\u984c\u3067\u3059\u3002\u540c\u6642\u591a\u6570\u306e\u30a2\u30af\u30bb\u30b9\u306b\u7acb\u3061\u5411\u304b\u3046\u305f\u3081\u3001Apache \u306f\u4eca\u3067\u306f mpm_event \u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u3068\u3057\u3066\u3044\u307e\u3059\u3057\u3001PHP \u3082 PHP-FPM \u3092\u4f7f\u3046\u3053\u3068\u3067 mpm_event \u3068\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002PHP-FPM \u3082\u6b63\u5f0f\u6a5f\u80fd\u306b\u306a\u3063\u306610\u5e74\u7d4c\u3064\u306e\u3067\u3001\u3059\u3067\u306b\u5229\u7528\u3055\u308c\u3066\u3044\u308b\u74b0\u5883\u3082\u304b\u306a\u308a\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30cd\u30c3\u30c8\u306e\u8a18\u4e8b\u306a\u3069\u3092\u8aad\u3093\u3067 MPM_Event\u3068PHP-FPM \u304c\u4ed5\u7d44\u307f\u3068\u3057\u3066 mpm_prefork \u3088\u308a\u52b9\u7387\u304c\u826f\u3055\u305d\u3046\u3060\u3068\u3044\u3046\u306e\u306f\u308f\u304b\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u5b9a\u91cf\u7684\u306b\u3069\u3053\u304c\u3069\u308c\u304f\u3089\u3044\u826f\u3044\u306e\u304b\u3001\u3044\u307e\u3044\u3061\u3057\u3063\u304f\u308a\u304f\u308b\u8aac\u660e\u3092\u898b\u305f\u3053\u3068\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u306a\u306e\u3067\u3001\u4eca\u66f4\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u6e2c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3053\u3067\u306f\u5177\u4f53\u7684\u306b\u3001\u4ee5\u4e0b\u306b\u3064\u3044\u3066\u8abf\u67fb\u3057\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li>\u540c\u3058\u540c\u6642\u30a2\u30af\u30bb\u30b9\u3092\u53d7\u3051\u305f\u6642\u3001mpm_prefork \u3068\u304f\u3089\u3079\u3066\u3001PHP-FPM \u306f\u3069\u308c\u304f\u3089\u3044\u52b9\u7387\u7684\u306b\u3001\u3082\u3057\u304f\u306f\u5b89\u5b9a\u3057\u3066\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3067\u304d\u308b\u304b<\/li>\n<li>\u30d7\u30ed\u30bb\u30b9\u306e\u7acb\u3061\u4e0a\u3052\u901f\u5ea6\u306b\u5dee\u306f\u3042\u308b\u304b<\/li>\n<\/ul>\n<p>\u7d50\u679c\u306f\u4ee5\u4e0b\u3067\u3057\u305f\u3002<\/p>\n<ul>\n<li>\u7528\u610f\u3057\u305fPHP\u306e\u30d7\u30ed\u30bb\u30b9\u6570\u3088\u308a\u3082\u591a\u304f\u306e\u540c\u6642\u30a2\u30af\u30bb\u30b9\u3092\u53d7\u3051\u3066\u3044\u308b\u6642\u306b\u306f PHP-FPM \u306e\u307b\u3046\u304c\u30ec\u30b9\u30dd\u30f3\u30b9\u30bf\u30a4\u30e0\u30921\/2\u500d\u306b\u3059\u308b\u304f\u3089\u3044\u52b9\u7387\u304c\u826f\u3044\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002<\/li>\n<li>\u30d7\u30ed\u30bb\u30b9\u3092\u7acb\u3061\u4e0a\u3052\u308b\u901f\u5ea6\u306f Kernel \u3084 CPU \u7b49\u306e\u5f71\u97ff\u304c\u5927\u304d\u304f\u5dee\u304c\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u4e00\u6c17\u306b\u540c\u6642\u30a2\u30af\u30bb\u30b9\u3092\u53d7\u3051\u3066\u304b\u3089\u30d7\u30ed\u30bb\u30b9\u3092\u7acb\u3061\u4e0a\u3052\u59cb\u3081\u308b\u521d\u52d5\u3067\u306f PHP-FPM \u306e\u307b\u3046\u304c\u826f\u3044\u52d5\u304d\u3067\u3057\u305f\u3002<\/li>\n<\/ul>\n<h2>\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u306b\u4f7f\u3046 PHP \u30d7\u30ed\u30b0\u30e9\u30e0<\/h2>\n<p>\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u5358\u4e00URL\u306b ab \u30b3\u30de\u30f3\u30c9\u3067\u540c\u6642\u30a2\u30af\u30bb\u30b9\u3092\u304b\u3051\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u6642\u9593\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"language-shell\">ab -c 300 -n 1000 http:\/\/10.0.0.104\/webclass\/wait1.php<\/code><\/pre>\n<p>\u30a2\u30af\u30bb\u30b9\u5148PHP\u30d7\u30ed\u30b0\u30e9\u30e0 wait1.php \u306f\u3001\uff11\u00b10.25 [s] \u3060\u3051\u5f85\u3063\u3066 'OK' \u306e\u6587\u5b57\u3092\u8fd4\u3057\u307e\u3059\u3002\u60f3\u5b9a\u3068\u3057\u3066\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u30d5\u30a1\u30a4\u30eb\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u30e1\u30e2\u30ea\u4e0a\u306b\u4e57\u3063\u3066\u3044\u3066IO\u8ca0\u8377\u304c\u6b86\u3069\u304b\u304b\u3089\u306a\u3044\u3001PHP\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3068\u3057\u3066\u3082\u51e6\u7406\u306fDB\u30b5\u30fc\u30d0\u304b\u3089\u306e\u7d50\u679c\u3092\u5f85\u3064\u3060\u3051\u3067\u307b\u3068\u3093\u3069\u3084\u308b\u3053\u3068\u304c\u306a\u3044\u72b6\u6cc1\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">&lt;?php\nfunction msleep($milliseconds) {\n    return usleep($milliseconds * 1000); \n}\n$interval = 1000;\n$var = 500; \nmsleep(1000 + (rand(0, $var)-$var\/2));\n\necho &#039;OK&#039;;<\/code><\/pre>\n<p>\u3057\u305f\u304c\u3063\u3066\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u51e6\u7406\u6642\u9593\u306fCPU\u306e\u8ca0\u8377\u72b6\u6cc1\u306b\u5f71\u97ff\u3092\u53d7\u3051\u306b\u304f\u304f\u3001CPU\u304c\u7a7a\u3044\u3066\u3044\u3066\u30821\u79d2\u3088\u308a\u65e9\u304f\u5fdc\u7b54\u306f\u8fd4\u3055\u306a\u3044\u3057\u3001CPU\u306b\u591a\u5c11\u8ca0\u8377\u304c\u304b\u304b\u3063\u3066\u3044\u3066\u3082\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u51e6\u7406\u81ea\u4f53\u306f\u3042\u307e\u308a\u6642\u9593\u304c\u5ef6\u3073\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5bfe\u3059\u308b\u30a2\u30af\u30bb\u30b9\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u6642\u9593\u3092\u8a08\u6e2c\u3057\u3001\u3069\u308c\u3060\u3051\uff11\uff53\u304b\u3089\u96e2\u308c\u308b\u304b\u3092\u6bd4\u8f03\u3059\u308b\u3053\u3068\u3067\u3001Apache \u3068 PHP-FPM \u306e\u52b9\u7387\u3060\u3051\u3092\u6bd4\u8f03\u30fb\u8a55\u4fa1\u3067\u304d\u308b\u3068\u8003\u3048\u307e\u3057\u305f\u3002<\/p>\n<h2>\u8a08\u6e2c\u74b0\u5883<\/h2>\n<p>AWS EC2 \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9(m4.large) \u3067Debian 10 + WebClass 11.11.3 \u3092\u69cb\u7bc9\u3057\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li>CPU Intel\u00ae Xeon CPU E5-2686 v4 @ 2.30GHz x2<\/li>\n<li>Mem 8G + Swap File 3G<\/li>\n<li>Debian 10.9\n<ul>\n<li>Apache 2.4.38 (Debian)<\/li>\n<li>PHP 7.3.29-1~deb10u1<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u540c\u4e00VPC\u5185\u306b m4.large \u306eDebian10\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u69cb\u7bc9\u3057\u3001http \u30d7\u30ed\u30c8\u30b3\u30eb\u3067 ab \u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u30d9\u30f3\u30c1\u30de\u30fc\u30af\u3092\u8a08\u6e2c\u3057\u307e\u3057\u305f\u3002<\/p>\n<ul>\n<li>CPU Intel\u00ae Xeon CPU E5-2686 v4 @ 2.30GHz x2<\/li>\n<li>Mem 8G<\/li>\n<li>Debian 10.9<\/li>\n<li>Ab 2.3 Rev.1843412<\/li>\n<\/ul>\n<p>\u8a08\u6e2c\u4e2d\u306b\u306f\u3069\u3061\u3089\u306e\u30b5\u30fc\u30d0\u3067\u3082 Swap \u3068 Hardware Interrupt(Steal)\u304c\u767a\u751f\u3057\u306a\u3044\u306e\u3092\u78ba\u8a8d\u3057\u3066\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2>\u8a08\u6e2c\u74b0\u5883\u30c1\u30a7\u30c3\u30af<\/h2>\n<p>wait1.php \u306f\u307b\u307c\u5f85\u3064\u3060\u3051\u306a\u306e\u3067\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u304c\u591a\u6570\u767a\u751f\u3057\u3066\u3082CPU\u306f\u3042\u307e\u308a\u6d88\u8cbb\u305b\u305a\u3001Apache\u3068PHP\u306e\u540c\u6642\u30a2\u30af\u30bb\u30b9\u30fb\u8907\u6570\u30d7\u30ed\u30bb\u30b9\u306e\u30de\u30cd\u30b8\u30e1\u30f3\u30c8\u306e\u52b9\u7387\u304c\u826f\u3044\u307b\u3069\u5fdc\u7b54\u6642\u9593\u306f\uff11\uff53\u306b\u8fd1\u3065\u304f\u306f\u305a\u3001\u3068\u3044\u3046\u524d\u63d0\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u524d\u63d0\u6761\u4ef6\u306e\u78ba\u8a8d\u306e\u305f\u3081\u3001mpm_prefork \u3068php7.3-fpm \u306e\u305d\u308c\u305e\u308c\u306b\u3064\u3044\u3066\u3001300 \u30d7\u30ed\u30bb\u30b9\u7528\u610f\u3057\u305f\u72b6\u614b\u3067100\u540c\u6642\u30a2\u30af\u30bb\u30b9\u3092\u304b\u3051\u3066\u5fdc\u7b54\u6642\u9593\u304c\uff11\uff53\u7a0b\u5ea6\u306b\u306a\u308b\u3053\u3068\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304a\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"language-shell\">ab -c 100 -n  10000 http:\/\/10.0.0.104\/webclass\/wait1.php<\/code><\/pre>\n<h3>MPM_Prefork + Mod_php 7.3 (MaxRequestWorkers=300 ) \u306e\u7d50\u679c<\/h3>\n<p>Mpm_prefork \u306e\u30b1\u30fc\u30b9\u3067\u306f\u3001Apache \u306eMPM\u8a2d\u5b9a\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre><code>StartServers   300\nMinSpareServers 300\nMaxSpareServers 300\nMaxRequestWorkers 300\nServerLimit    300<\/code><\/pre>\n<p>ab\u30b3\u30de\u30f3\u30c9\u306e\u7d50\u679c\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<pre><code>Concurrency Level:      100\nTime taken for tests:   101.782 seconds\nComplete requests:      10000\nFailed requests:        0\nTotal transferred:      2260000 bytes\nHTML transferred:       20000 bytes\nRequests per second:    98.25 [#\/sec] (mean)\nTime per request:       1017.816 [ms] (mean)\nTime per request:       10.178 [ms] (mean, across all concurrent requests)\nTransfer rate:          21.68 [Kbytes\/sec] received<\/code><\/pre>\n<p>\u5fdc\u7b54\u6642\u9593\u304c\uff11\uff53\u3067\u3001CPU\u8ca0\u8377\u3082\u307b\u3068\u3093\u3069\u304b\u304b\u3089\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u554f\u984c\u306a\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<h3>MPM_event + php7.3-fpm (max_children=300 ) \u306e\u7d50\u679c<\/h3>\n<p>Mpm_event \u306e\u30b1\u30fc\u30b9\u3067\u306f\u3001Apache \u306eMPM\u8a2d\u5b9a\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002\u30b9\u30ec\u30c3\u30c9\u3092100\u305a\u3064\u5897\u3084\u3057\u3066\u3044\u304d\u3001\u4e0a\u9650\u30822000\u306b\u3057\u3066\u3042\u308b\u306e\u3067\u3001\u30d7\u30ed\u30bb\u30b9\u306e\u8d77\u52d5\u3068\u30b9\u30ec\u30c3\u30c9\u4e0a\u9650\u304c\u3042\u307e\u308a\u5f71\u97ff\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code>StartServers      2\nMinSpareServers 100\nMaxSpareServers 100\nThreadLimit        300\nThreadsPerChild  100\nMaxRequestWorkers 2000<\/code><\/pre>\n<p>PHP-FPM \u306e\u30d7\u30ed\u30bb\u30b9\u30e2\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<pre><code>pm = dynamic\npm.max_children = 300\npm.start_servers = 50\npm.min_spare_servers = 20\npm.max_spare_serves = 50<\/code><\/pre>\n<p>\u306a\u304a\u3001\u3053\u306e\u8a2d\u5b9a\u306f Prefork \u306b\u63c3\u3048\u308b\u306b\u306f static \u306b\u3059\u308c\u3070\u3088\u304b\u3063\u305f\u3068\u5f8c\u3067\u6c17\u3065\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>ab\u30b3\u30de\u30f3\u30c9\u306e\u7d50\u679c\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<pre><code>Concurrency Level:      100\nTime taken for tests:   103.935 seconds\nComplete requests:      10000\nFailed requests:        0\nTotal transferred:      2300000 bytes\nHTML transferred:       20000 bytes\nRequests per second:    96.21 [#\/sec] (mean)\nTime per request:       1039.351 [ms] (mean)\nTime per request:       10.394 [ms] (mean, across all concurrent requests)\nTransfer rate:          21.61 [Kbytes\/sec] received<\/code><\/pre>\n<p>dynamic\/static \u306e\u70b9\u306f\u6c17\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u4e00\u5fdc\u306f\u5fdc\u7b54\u6642\u9593\u304c\uff11\uff53\u3067\u3001CPU\u8ca0\u8377\u3082\u307b\u3068\u3093\u3069\u304b\u304b\u3089\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u554f\u984c\u306a\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<h2>\u30ec\u30b9\u30dd\u30f3\u30b9\u6642\u9593\u306e\u8a08\u6e2c\u7d50\u679c<\/h2>\n<p>Prefork \u3068 PHP-FPM \u306e\u30ef\u30fc\u30ab\u6570\u4e0a\u9650\u3068\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u3092\u5909\u3048\u306a\u304c\u3089 ab \u30b3\u30de\u30f3\u30c9\u3067\u30ec\u30b9\u30dd\u30f3\u30b9\u6642\u9593\u3092\u30d7\u30ed\u30c3\u30c8\u3057\u305f\u306e\u304c\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/webclass.jp\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-28-at-15.28.43.png\" alt=\"\" \/><\/p>\n<p>\u30b0\u30e9\u30d5\u306e\u51e1\u4f8b\u306e\u540d\u524d\u300cPrefork\u300d\u3082\u3057\u304f\u306f\u300cPHP-FPM\u300d\u306e\u6a2a\u306b\u66f8\u3044\u305f\u6570\u5b57\u304c\u3001\u305d\u308c\u305e\u308c\u306b\u8a2d\u5b9a\u3057\u305f\u30ef\u30fc\u30ab\u30fc\u306e\u4e0a\u9650\u3067\u3059\u3002<\/p>\n<p>\uff57ait1.php \u306f1\u00b10.25s \u5f85\u3064\u3060\u3051\u306a\u306e\u3067\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u304c\u591a\u6570\u767a\u751f\u3057\u3066\u3082 CPU \u306b\u639b\u304b\u308b\u8ca0\u8377\u306f\u308f\u305a\u304b\u3067\u3057\u305f\u3002\u3067\u3059\u306e\u3067\u3001MPM \u3068 PHP-FPM \u306e\u52b9\u7387\u304c\u30ec\u30b9\u30dd\u30f3\u30b9\u30bf\u30a4\u30e0\uff11\uff53\u3088\u308a\u3069\u308c\u304f\u3089\u3044\u4e0a\u306b\u96e2\u308c\u3066\u304f\u304b\u3001\u306b\u53cd\u6620\u3055\u308c\u308b\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002\uff11\uff53\u3067\u30d5\u30e9\u30c3\u30c8\u306a\u30b0\u30e9\u30d5\u306b\u306a\u308b\u307b\u3069\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u304c\u5897\u3048\u3066\u3082\u52b9\u7387\u304c\u843d\u3061\u306a\u3044\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/p>\n<p>MPM_Prefork \u306f\u3001\u7528\u610f\u3057\u305f\u30d7\u30ed\u30bb\u30b9\u672a\u6e80\u306e\u540c\u6642\u30a2\u30af\u30bb\u30b9\u306b\u5bfe\u3057\u3066\u306f\u975e\u5e38\u306b\u52b9\u7387\u304c\u826f\u3044\u3067\u3059\u3002\u3057\u304b\u3057\u3001\u30d7\u30ed\u30bb\u30b9\u6570\u3092\u8d85\u3048\u308b\u540c\u6642\u30a2\u30af\u30bb\u30b9\u306b\u5bfe\u3057\u3066\u306f\u3001\u8457\u3057\u304f\u52b9\u7387\u304c\u60aa\u5316\u3057\u3001ab \u306f\u30a8\u30e9\u30fc\u3092\u8a08\u4e0a\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3057\u305f\u3002MaxRequestWorkers 900 \u3067\u540c\u6642\u30a2\u30af\u30bb\u30b91500\u306e\u30b1\u30fc\u30b9\u3067\u3082CPU\u306e\u5229\u7528\u6642\u9593\u306f\u5927\u3057\u3066\u5897\u3048\u307e\u305b\u3093\u304c\u3001Load Average \u306f 9.3 \u307b\u3069\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u30a8\u30e9\u30fc\u3092\u8a08\u4e0a\u3057\u305f\u3068\u3053\u308d\u3088\u308a\u4e0a\u306e\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u306f\u30c7\u30fc\u30bf\u3092\u53d6\u3063\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>PHP-FPM \u306f\u30d7\u30ed\u30bb\u30b9\u6570\u672a\u6e80\u306e\u540c\u6642\u30a2\u30af\u30bb\u30b9\u306b\u5bfe\u3057\u3066\u52b9\u7387\u304c\u826f\u3044\u306e\u306fMPM_Prefork\u3068\u5909\u308f\u308a\u307e\u305b\u3093\u3002\u4e00\u65b9\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u304c\u30d7\u30ed\u30bb\u30b9\u6570\u3088\u308a\u3082\u5897\u3048\u305f\u6642\u306f\u3001MPM_Prefork \u3088\u308a\u3082\u30ec\u30b9\u30dd\u30f3\u30b9\u6642\u9593\u30921\/2 \u7a0b\u5ea6\u306b\u4fdd\u3066\u307e\u3057\u305f\u3002Load Average\u306f\uff11\u3044\u304f\u304b\u884c\u304b\u306a\u3044\u304b\u7a0b\u5ea6\u3067\u3001CPU\u4f7f\u7528\u7387\u306f\u4f4e\u3044\u307e\u307e\u3067\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30bb\u30b9\u6570\u304c\u8db3\u308a\u306a\u3044\u65b9\u306b\u5bc4\u3063\u305f\u8a08\u6e2c\u3092\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u3069\u3061\u3089\u306e\u65b9\u5f0f\u3067\u3082\u30d7\u30ed\u30bb\u30b9\u6570\u3092\u5897\u3084\u3059\u3053\u3068\u306b\u3088\u308b\u52b9\u7387\u306e\u60aa\u5316\u306e\u69d8\u5b50\u306f\u89b3\u5bdf\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u305f\u3060\u3057\u3001\u5b9f\u969b\u306e\u904b\u7528\u3067\u306f\u30d7\u30ed\u30bb\u30b9\u6570\u304c\u5897\u3048\u308b\u3068\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3088\u308bCPU\u5229\u7528\u91cf\u3082\u5897\u3048\u308b\u305f\u3081\u3001\u30d7\u30ed\u30bb\u30b9\u7ba1\u7406\u306e\u52b9\u7387\u306e\u554f\u984c\u4ee5\u524d\u306bCPU\u304c\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306b\u306a\u308b\u3053\u3068\u3082\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<h2>\u30d7\u30ed\u30bb\u30b9\u306e\u7acb\u3061\u4e0a\u304c\u308a\u901f\u5ea6\u306e\u8a08\u6e2c<\/h2>\n<p>MPM_Prefork \u3082 PHP-FPM \u3082\u30ef\u30fc\u30ab\u3068\u3057\u3066\u30d7\u30ed\u30bb\u30b9\u3092\u7acb\u3061\u4e0a\u3052\u307e\u3059\u3002\u4e00\u822c\u306b\u30d7\u30ed\u30bb\u30b9\u306e\u30d5\u30a9\u30fc\u30af\u306f\u91cd\u3044\u51e6\u7406\u306b\u306a\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u5f85\u6a5f\u3057\u3066\u3044\u308b\u30ef\u30fc\u30ab\u6570\u3088\u308a\u3082\u591a\u304f\u306e\u540c\u6642\u30a2\u30af\u30bb\u30b9\u304c\u30ef\u30c3\u3068\u6765\u305f\u6642\u306e\u53cd\u5fdc\u306b\u3082\u5f71\u97ff\u3057\u307e\u3059\u3002WebClass\u3067\u3059\u3068\u300110\u6642\u534a\u304b\u30892\u9650\u3067\u306f\u8a66\u9a13\u3092\u3057\u307e\u3059\uff01\u3068\u3044\u3046\u3068\u304d\u3001\u6388\u696d\u306e\u958b\u59cb\u6642\u523b\u3067\u4e00\u6589\u306b\u5b66\u751f\u304c\u64cd\u4f5c\u3057\u59cb\u3081\u308b\u306e\u3067\u4fae\u308c\u306a\u3044\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\uff12\u3064\u306e\u74b0\u5883\u306e\u305d\u308c\u305e\u308c\u306b\u3001\u30ef\u30fc\u30ab\u306e\u6700\u5927\u5024\u3092\uff15\uff10\uff10\u306b\u3001\u521d\u671f\u5f85\u6a5f\u30ef\u30fc\u30ab\u6570\u3092\uff15\uff10\u306b\u3057\u305f\u72b6\u614b\u3067\u5f85\u6a5f\u3055\u305b\u3001ab \u30b3\u30de\u30f3\u30c9\u3067\u540c\u6642\uff15\uff10\uff10\u30a2\u30af\u30bb\u30b9\u3092\u304b\u3051\u307e\u3057\u305f\u3002\u305d\u3053\u304b\u3089\u30d7\u30ed\u30bb\u30b9\u6570\u3092\uff11\u79d2\u5358\u4f4d\u3067\u6570\u3048\u3066\u3044\u3063\u3066\u3001\uff15\uff10\uff10\u306b\u9054\u3057\u305f\u3068\u3053\u308d\u307e\u3067\u3092\u30b0\u30e9\u30d5\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/webclass.jp\/blog\/wp-content\/uploads\/2021\/09\/Screen-Shot-2021-09-28-at-15.40.35.png\" alt=\"\" \/><\/p>\n<p>\u30b0\u30e9\u30d5\u306e\u51e1\u4f8b\u306e\u540d\u524d\u300cPHP-FPM\u300d\u306e\u6a2a\u306b\u66f8\u3044\u305f\u6570\u5b57\u306f min_spaire_servers \u306e\u5024\u3067\u3059\u3002\u6700\u521d\u306f\uff11\uff10\u306b\u3057\u3066\u8a08\u6e2c\u3057\u305f\u3068\u3053\u308d\u8457\u3057\u304f\u30d7\u30ed\u30bb\u30b9\u8d77\u52d5\u304c\u9045\u304b\u3063\u305f\u306e\u3067\u3001\uff15\uff10\u306e\u7d50\u679c\u3092\u52a0\u3048\u3066Prefork\u3068\u6bd4\u3079\u3089\u308c\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u306a\u304a\u3001\u3053\u308c\u4ee5\u4e0a\u5024\u3092\u5897\u3084\u3057\u3066\u3082\u3001\u3082\u3057\u304f\u306f\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u3092\u5897\u3084\u3057\u3066\u3082\u3001\u901f\u5ea6\u306f\u5909\u308f\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u30d7\u30ed\u30bb\u30b9\u306e\u7acb\u3061\u4e0a\u3052\u901f\u5ea6\uff08\u30b0\u30e9\u30d5\u306e\u50be\u304d\uff09\u306f MPM_Prefork\u3068PHP-FPM50\u3067\u5dee\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u3053\u308c\u306f Kernel \u3084 CPU \u306a\u3069\u306e\u3082\u3063\u3068\u4e0b\u306e\u30ec\u30a4\u30e4\u30fc\u306e\u6027\u80fd\u306b\u3088\u308b\u3082\u306e\u3068\u601d\u3044\u307e\u3059\u3002\u3067\u3059\u304c\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u304c\u6025\u306b\u304d\u3066\u304b\u3089\u30d7\u30ed\u30bb\u30b9\u3092\u5897\u3084\u3057\u59cb\u3081\u308b\u53cd\u5fdc\u306fPHP\u2212FPM\u306e\u307b\u3046\u304c\u826f\u304f\u3001\uff15\uff10\uff10\u30d7\u30ed\u30bb\u30b9\u63c3\u3046\u307e\u3067\u306e\u6642\u9593\u306b\uff13\uff53\u306e\u5dee\u304c\u51fa\u307e\u3057\u305f\u3002\u305d\u306e\u7d50\u679c\u3001\u5e73\u5747\u5fdc\u7b54\u6642\u9593\u306f\u521d\u52d5\u306e\u901f\u3044PHP-FPM \u306e\u307b\u3046\u304c\u77ed\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>CPU\u3078\u306e\u8ca0\u8377\u3092\u898b\u308b\u3068\u3001MPM_Prefork \u306f\u30d7\u30ed\u30bb\u30b9\u4e0a\u9650\u306b\u81f3\u308b\u307e\u3067\u306f CPU \u3082 Load Average\u3082\u4f4e\u3044\u307e\u307e\u3067\u3059\u304c\u3001PHP-FPM \u306e\u307b\u3046\u306fCPU\u4f7f\u7528\u7387\u3068 Load Average \u304c Prefork \u3088\u308a\u3082\u9ad8\u304f\u306a\u308a\u307e\u3057\u305f\u3002\u3082\u3057PHP\u306b\u305d\u308c\u306a\u308a\u306e\u51e6\u7406\u304c\u6709\u308b\u6642\u3001PHP-FPM\u306e\u30d7\u30ed\u30bb\u30b9\u306e\u7acb\u3061\u4e0a\u3052\u306b\u3069\u308c\u304f\u3089\u3044\u5f71\u97ff\u3059\u308b\u304b\u3061\u3087\u3063\u3068\u6c17\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u307e\u305a\u306f\u57fa\u672c\u7684\u306a\u3068\u3053\u308d\u306e\u9055\u3044\u3092\u77e5\u308a\u305f\u3044\u3068\u601d\u3063\u3066\u3001\u3067\u304d\u308b\u3060\u3051\u30d7\u30ed\u30bb\u30b9\u7ba1\u7406\u52b9\u7387\u306b\u7684\u3092\u7d5e\u3063\u305f\u8a08\u6e2c\u3092\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>MPM_Event \u306b\u3064\u3044\u3066\u306f\u3001PHP-FPM\u306e\u8a08\u6e2c\u3067\u307b\u307c\u7121\u8996\u3067\u304d\u308b\u307b\u3069\u30b5\u30af\u30b5\u30af\u3068\uff11\uff15\uff10\uff10\u540c\u6642\u30ea\u30af\u30a8\u30b9\u30c8\u306a\u3069\u3092\u62b1\u3048\u3066\u304f\u308c\u3066\u3044\u3066\u3001\u6570\u5b57\u3067\u306f\u793a\u305b\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u6d41\u77f3\u3060\u306a\u3068\u601d\u3044\u307e\u3057\u305f\u3002\u305d\u306e\u304a\u304b\u3052\u3067\u3001PHP-FPM \u306f\u30ef\u30fc\u30ab\u6570\u3092\u7d5e\u3063\u3066\u3044\u3066\u3082\u52b9\u7387\u7684\u306b\u51e6\u7406\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002PHP\u306e\u30d7\u30ed\u30bb\u30b9\u6570\u3092\u7d5e\u308b\u3053\u3068\u304c\u3067\u304d\u308c\u3070\u3001\u63a5\u7d9a\u5148\u306eDB\u306e\u30ef\u30fc\u30ab\u6570\u3082\u6e1b\u3089\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30b3\u30a2\u6570\u3068\u30e1\u30e2\u30ea\u304c\u9650\u3089\u308c\u308b\u74b0\u5883\u3067\u306e\u5b89\u5b9a\u6027\u306b\u7e4b\u304c\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u3053\u306e\u5b89\u5b9a\u6027\u3092\u4fdd\u3063\u305f\u307e\u307e\u3001CPU \u3068\u30e1\u30e2\u30ea\u3092\u5897\u3084\u3057\u305f\u5206\u3060\u3051\u30ef\u30fc\u30ab\u6570\u3092\u5897\u3084\u3057\u3066\u3044\u3051\u308c\u3070\u3001\uff11\u53f0\u306e\u30d7\u30ed\u30bb\u30c3\u30b5\u3067\u30ab\u30d0\u30fc\u3067\u304d\u308b\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u3082\u5897\u3084\u3057\u3084\u3059\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3053\u306e\u3042\u305f\u308a\u3001\u4eca\u5f8c\u8a70\u3081\u3066\u3044\u304d\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u798f\u5ca1\u3067\u3059\u3002 Apache mpm_prefork + mod_php \u3068 mpm_event + PHP-FPM \u3092\u4f7f\u3063\u305f\u3068\u304d\u306e\u3001\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u304c\u5897\u3048\u305f\u3068\u304d\u306e\u52b9\u7387\u3092\u8abf\u67fb\u3057\u307e\u3057\u305f\u306e\u3067\u7d39\u4ecb\u3057\u307e\u3059\u3002 WebClas [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[],"class_list":["post-691","post","type-post","status-publish","format-standard","hentry","category-57"],"_links":{"self":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts\/691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/comments?post=691"}],"version-history":[{"count":3,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts\/691\/revisions"}],"predecessor-version":[{"id":696,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/posts\/691\/revisions\/696"}],"wp:attachment":[{"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/media?parent=691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/categories?post=691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webclass.jp\/blog\/wp-json\/wp\/v2\/tags?post=691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}