Virtualminを実行しても、まだ約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
答え1
問題を発見したようです。たとえば、Apache 起動ファイルの systemd サービスセクションに TasksMax=2000 を追加してタスクの制限を調整します。
root@vps:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-11-04 12:23:42 AEDT; 51s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 2444581 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 2444589 (apache2)
Tasks: 614 (limit: 614)
Memory: 261.7M
CGroup: /system.slice/apache2.service
├─2444589 /usr/sbin/apache2 -k start
├─2444590 /usr/sbin/apache2 -k start
├─2444591 /usr/sbin/apache2 -k start