运行 Virualmin,仍然有大约 1GB 的可用内存,apache 日志充满了:
[mpm_prefork:error] [pid 119747] (11)Resource temporarily unavailable: AH00159: fork: Unable to fork new process
<IfModule mpm_prefork_module>
StartServers 20
MinSpareServers 50
MaxSpareServers 100
MaxRequestWorkers 1000
Serverlimit 2000
MaxConnectionsPerChild 10000
</IfModule>
如果这有帮助:
user@vps:~$ ulimit -a
real-time non-blocking time (microseconds, -R) unlimited
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 1541537
max locked memory (kbytes, -l) 524288
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 62987
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
我也在运行 PHP-FPM,所以这是它的设置,我尝试将 60 更改为 100 但没有区别:
[154754643814302]
user = user
group = user
listen.owner = user
listen.group = user
listen.mode = 0660
listen = /var/php-fpm/154754643814302.sock
pm = dynamic
pm.max_children = 100
pm.start_servers = 8
pm.min_spare_servers = 1
pm.max_spare_servers = 30
php_value[upload_tmp_dir] = /home/user/tmp
php_value[session.save_path] = /home/user/tmp
php_value[error_log] = /home/user/logs/php_log
php_value[log_errors] = On
我想我已经找到了问题:在 apache 启动文件的 systemd 服务部分添加例如 TasksMax=2000 调整任务限制