aaPanel_Kern
Hi,
Recently, I found that both my website and aaPanel became inaccessible at the same time, while the VPS itself was still accessible normally via SSH.
I ran the commands you recommended:
dmesg | grep -iE "kill|httpd|apache|http|mysql|oom"
grep -i 'killed' /var/log/messages
journalctl | grep -i 'killed'
After checking, I found the following issues:
My server encountered OOM (Out of Memory) issues. After logging into the aapanel, I noticed that PHP was killed by the system.
Here are the related system logs:
[2385679.736402] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/mysqld.service,task=mysqld,pid=673788,uid=1002
[2385679.739086] Out of memory: Killed process 673788 (mysqld) total-vm:3481776kB, anon-rss:1081196kB, file-rss:0kB, shmem-rss:0kB, UID:1002 pgtables:2664kB oom_score_adj:0
[2385681.793562] oom_reaper: reaped process 673788 (mysqld), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
[2397270.571286] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/mysqld.service,task=mysqld,pid=720473,uid=1002
[2397270.573806] Out of memory: Killed process 720473 (mysqld) total-vm:3470512kB, anon-rss:855880kB, file-rss:0kB, shmem-rss:0kB, UID:1002 pgtables:2216kB oom_score_adj:0
[2397309.764953] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/btpanel.service,task=php-fpm,pid=720669,uid=1001
[2397309.767429] Out of memory: Killed process 720669 (php-fpm) total-vm:476064kB, anon-rss:131968kB, file-rss:0kB, shmem-rss:203760kB, UID:1001 pgtables:912kB oom_score_adj:0
May 13 22:20:46 xxx kernel: Out of memory: Killed process 673788 (mysqld) total-vm:3481776kB, anon-rss:1081196kB
May 14 01:33:54 xxx kernel: Out of memory: Killed process 720473 (mysqld) total-vm:3470512kB, anon-rss:855880kB
May 14 01:34:32 xxx kernel: Out of memory: Killed process 720669 (php-fpm) total-vm:476064kB, anon-rss:131968kB, shmem-rss:203760kB
My PHP-FPM config is currently:
pm = dynamic
pm.max_children = 200
pm.start_servers = 15
pm.min_spare_servers = 15
pm.max_spare_servers = 50
PHP settings:
memory_limit = 512M
VPS environment:
16GB RAM
WordPress + WooCommerce
aaPanel
MySQL + PHP 8.4
Question:
Could pm.max_children = 200 be the main reason for the OOM issue? For a 16GB RAM server running WordPress + WooCommerce, what would be a more reasonable PHP-FPM configuration (especially pm.max_children)? Also, should I lower memory_limit from 512M?
Thanks in advance.