WP Admin seems very slow + Visitors complaining that the site is not opening many times

Keywords: WordPress + NGINX + SSL - AWS - Technical issue - Other
bnsupport ID: 7ba54aa6-2851-ecc7-abc9-136649a889df
Description:
Hello,

  1. We are using CLOUDFLARE (Free Plan) and running the t3a.medium instance.
    Still, the WP ADMIN seems to be very very slow. Simple update/edit operation takes 2-3 minutes sometimes.

  2. And also, Many visitors complained that they are unable to enter the site. Either it never opened/kept on loading, Or they got some SERVER DOWN error.
    This is especially between 2 pm to 9 pm, Yesterday, May 23, 2021.

Can somebody please help?

Hello @vgnavada,

There is the following error in your php-fpm logs:

[23-May-2021 03:42:13] WARNING: [pool www] server reached max_children setting (5), consider raising it
[23-May-2021 03:44:31] WARNING: [pool www] server reached max_children setting (5), consider raising it
[23-May-2021 03:46:52] WARNING: [pool www] server reached max_children setting (5), consider raising it
[23-May-2021 03:53:55] WARNING: [pool www] server reached max_children setting (5), consider raising it

That could be because of the high number of users. You can try rising the number of max_children following our Configure PHP-FPM Processes and see if it solves the problem.

Nevertheless, given your instance size and that the issue presents in a specific period, you could be suffering a DDoS attack. Please also check our Deny Connections From Bots/Attackers Using NGINX and verify there is now suspicious behaviour.

Regards,
Francisco de Paz

Hello @fdepaz,

It says we have a self-contained installation: https://prnt.sc/13cek1v

As per the Configure PHP-FPM Processes document, We have to follow:
Approach B (Self-contained Bitnami installations): /opt/bitnami/apps/apps/APPNAME/conf/pfp-fpm/pool.conf

But, We are unable to find this PHP-FPM pool configuration file in the mentioned path: https://prnt.sc/13cepcv

What do we do?

We have a woo-commerce site in this instance. Could you please suggest the ideal/recommended value for max_children for the same?

Awaiting your response…

Hello @vgnavada,

There should be no need to change the pool configuration, you would only need to edit the file at /opt/bitnami/php/etc/common-*.conf. As for a specific configuration, you can check this blog post to calculate the maximum children for your server. Remember to restart php-fpm after applying the changes.

Regards,
Francisco de Paz

Hi, @fdepaz;

  1. Which blog post?
  2. These are the present max_children values: https://prnt.sc/13fjxt7
  3. But still we keep on getting Error 524 A timeout occurred: https://prnt.sc/13fjwvd

Could you please help us to get a permanent solution?

Hello @vgnavada,

My bad, the link got removed: http://myshell.co.uk/blog/2012/07/adjusting-child-processes-for-php-fpm-nginx/

As per that blog, you should be able to increase substantially the number of max_children. I suggest you to check the guidelines regarding the denying of connections I previously shared and check with Cloudflare if there are any suspicious requests.

Regards,
Francisco de Paz

Hi @fdepaz, Thanks for your quick response.

  1. I check the link: http://myshell.co.uk/blog/2012/07/adjusting-child-processes-for-php-fpm-nginx/, The command ps -ylC php-fpm --sort:rss is not returning anything.
    All it get is this:
    image

  2. I also ran checks for the DDoS Attack, I got these IP, Seems legit to me. All IPs are different.
    image

Hi @vgnavada,

Yes, that seems like normal behavior to me. You have no php-fpm children running, please run the following command to generate them and then rerun the memory check command:

sudo /opt/bitnami/ctlscript.sh restart php-fpm
ps -ylC php-fpm --sort:rss

Regards,
Francisco de Paz

Hello @fdepaz, I used the following command as per your directions:

Still the output is same as before:
image

What might be missing here in my case?

Hello @vgnavada,

It seems the children are not been generated. Check the file at /opt/bitnami/php/etc/php-fpm.d/www.conf.default whether you have the pool configured as dynamic or ondemand in case the common.conf file you created is for the incorrect process manager (pm). After that, try creating the .conf with the full name as done in the shared guide and restart php-fpm.

If there are no children still, remove the .conf at /opt/bitnami/php/etc and check again after restarting php-fpm once more.

Regards,
Francisco de Paz

We have checked the file /opt/bitnami/php/etc/php-fpm.d/www.conf.default and pool is configured as dynamic. But we got stuck in further steps. We are not technically strong enough to understand your words. Can you please elaborate the steps in a simplified manner?

Waiting for your reply

Hello @vgnavada,

Knowing that the pool is configured as dynamic, please create the pool configuration file at /opt/bitnami/php/etc/common-dynamic.conf with these initial parameters:

pm=dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

You shouldn’t need to add an include directive in the above file, only needing the shared lines. After that, restart php-fpm as before and check whether there are any children running:

sudo /opt/bitnami/ctlscript.sh restart php-fpm
ps -ylC php-fpm --sort:rss

Regards,
Francisco de Paz

Hello @fdepaz,
Thanks a lot for the detailed explanation.
I have sent the below values for the common-dynamic.conf file:

And then after running:

The result is still like before:
image

I don’t know what is wrong or what is that I’m missing :frowning:
Could you please help?

Hi @vgnavada,

Let’s see whether php-fpm logs have any information. Could you please run the following command:

sudo tail -n 40 /opt/bitnami/php/var/log/php-fpm.log

Regards,
Francisco de Paz

Hi @fdepaz,

This is the response I got:

[01-Jun-2021 10:25:47] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:31:43] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:35:04] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:36:09] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:51:08] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:53:01] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:54:32] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:58:08] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 10:59:03] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:00:40] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:03:48] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:07:30] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:10:06] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:10:30] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:13:34] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:17:42] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:18:55] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:19:58] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:22:11] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:31:31] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:32:39] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:36:00] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:41:19] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:42:15] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:42:57] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:58:13] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 11:58:51] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:06:59] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:19:07] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:23:49] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:24:18] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:24:41] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:33:26] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:37:15] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:38:00] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:49:59] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 12:50:40] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 13:08:44] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 13:14:36] WARNING: [pool www] server reached max_children setting (5), consider raising it

[01-Jun-2021 13:16:08] WARNING: [pool www] server reached max_children setting (5), consider raising it 

What concerns me now is, In the previous step, I clearly remember changing the max_children value to 50. Still, why does it show as 5?

Hello @vgnavada,

That issue could be caused by the configuration being overwritten somewhere. Could you please restart php-fpm once more and then run again our support tool and share its code? That way, we will have an updated snapshot of your instance’s configuration and also give us a bit more information on the php-fpm processes.

Regards,
Francisco de Paz

6a88f3d2-504a-47fe-bae3-d7589737c7fe

Hello @vgnavada,

Looking at your configuration, the behavior of children management looks okay besides the low number of children. I’m seeing several children processes and the logs indicate that they spawn and et removed as necessary.

Regarding the issue with your configuration not being effective, I think I detected the cause. The configuration file you created is not being detected. To fix this, go
to /opt/bitnami/php/etc/php-fpm.d/www.conf and edit the file to comment the present include and add one pointing to your .conf file. As such, the end of www.conf will look like this:

...
; include=/opt/bitnami/php/etc/memory.conf

; Add custom pool configuration
include=/opt/bitnami/php/etc/etc/common-dynamic.conf

As for the contents of your common-dynamic.conf file, it is only required to include de following:

pm.max_children = 50
pm.start_servers = 15
pm.min_spare_servers = 10
pm.max_spare_servers = 35

After that, restart your services and the new configuration should take place:

sudo /op/bitnami/ctlscript.sh restart

Regards,
Francisco de Paz

There is no www.conf in /opt/bitnami/php/etc/php-fpm.d/ location
instead of this we have www.conf.default file. But there no include statement in it.

Hello @vgnavada,

I gave you the directives for the latest WP Bitnami stack version but there have been some configuration changes since the WP you are using. In your instance, the php-fpm configuration is at /opt/bitnami/php/etc/php-fpm.conf. I checked in an instance version 5.4.2-3 and in that file, the pool management is set to ondemand.

Please try changing you pool configuration directly at /opt/bitnami/php/etc/php-fpm.conf. You can change it to dynamic if you want to have a minimum of children always up. You can check php-fpm processes are running by executing:

ps aux | grep php-fpm

Regards,
Francisco de Paz