最終仔細(xì)排查發(fā)現(xiàn),問題出在 opcache.memory_consumption 和 opcache.interned_strings_buffer 這2個(gè)參數(shù)配置問題,太小了不夠用,分別調(diào)大一倍,并將 interned_strings_buffer 設(shè)為前者的一半后,問題解決。
最終配置
opcache.memory_consumption = 256
opcache.interned_strings_buffer=128
最近一周,幾乎每天出現(xiàn)一次這類錯(cuò)誤
無論是執(zhí)行 php -v
還是 php start.php reload
php start.php restart
等任何有關(guān)php操作,都會(huì)報(bào)錯(cuò) Fatal Error Insufficient shared memory!
只好 ps aux 然后 kill -9 所有workerman 進(jìn)程,再啟動(dòng)。
服務(wù)器 4核,開啟8個(gè)進(jìn)程,壓力主要集中在4個(gè)進(jìn)程上。當(dāng)kill -9 掉這4個(gè)進(jìn)程后,再php相關(guān)操作就不再報(bào)錯(cuò)了.php 內(nèi)存限制 1280M,報(bào)錯(cuò)時(shí)為止,服務(wù)器內(nèi)存 尚余 10% 空閑。
php -v
php start.php start
php start.php restart
php start.php reload
Fatal Error Insufficient shared memory
Linux iZbp151opoxzdhdzlc7ufyZ 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.8.2003 (Core)
Release: 7.8.2003
Codename: Core
PHP 8.1.9 (cli) (built: Aug 9 2022 10:39:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.9, Copyright (c) Zend Technologies
with Zend OPcache v8.1.9, Copyright (c), by Zend Technologies
Webman-framework v1.3.14