问题原文
原帖链接 · c0dehunter · CC BY-SA 4.0
I am testing why sometimes my PHP scripts takes long to load over network (>30sec) on my Apache 2.4 Ubuntu server with PHP-FPM 7.4 using mpm_event. The server was working normally in the past few months, this started happening a few days ago and I didn't change anything. I did a reboot, it didn't help.
I've made a simple test.php. Sometimes it loads normally (<100ms), but sometimes it takes 1 minute to load:
<?php echo "test\n"; ?>
- Server's CPU, RAM and IO are all normal (checked with
htop). - Static HTML files are loaded without any delays.
- Running script locally via SSH console is very fast.
- Apache error logs doesn't show anything unusual.
- I checked if there is some DDOS attack by checking the number of connected IPs from same /16 subnet and didn't find anything weird (e.g. >100 connections).
How can I debug this further to see why this is happening?
Some debug output which may help:
sudo service php7.4-fpm status
已采纳解答
原帖链接 · c0dehunter · CC BY-SA 4.0
I think I've found solution, but still if you have any suggestions please let me know or post another answer.
I checked /var/log/php7.4-fpm.log and saw this many entries like this:
[30-Sep-2021 03:36:46] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
So I raised the max_children to 15 and it seems it helps.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
