PHP really slow for one user

Ieuan

Verified User
Joined
Dec 26, 2015
Messages
21
I have an interesting issue:

One user's WordPress website has become unusably slow. I went in to investigate, and ended up finding out the following facts:

- WordPress on their main website is really slow, it is stuck on TTFB for over 2 minutes
- The same website with no plugins and just the default twentytwentytwo theme is still slow
- A fresh install on a subdomain under the same user is also slow; Installatron took over 7 minutes just to install
- A WordPress install on a different user is as fast as expected; installed in under 10 seconds, loads as fast as you'd expect from an empty WP install
- Their WordPress install on a different machine shows no issues
- Even a PHP file just echoing 1 and then 2 takes well over 5 seconds to load, with 5.13 seconds being TTFB
- An HTML file with the same number of bytes returned loads instantly
- MySQL queries that are being run by WordPress are near-instant

The above rules out the server itself, the domain's routing, the WordPress plugins and/or themes, and MySQL.
It appears that PHP itself is very slow for just this one user, but I am not aware of having done any specific configuration for this user. Their PHP processes don't take up many resources; the full site uses about 40MB of memory, which is not at all unreasonable for WordPress.

I see no differences in htop for their respective PHP pool process vs other users either, nice ratings are all at 0.

What could possibly be causing this? Is there a hidden config value somewhere that I am missing?

Thanks in advance!
 
In such case try to create new account and move all data to it. Or make backup, delete this account,restore. Maybe there are somewhere custom configs, so they might be removed.
 
In such case try to create new account and move all data to it. Or make backup, delete this account,restore. Maybe there are somewhere custom configs, so they might be removed.
I'd rather not, but this seems like the only real course of action at this point. The problem is that this is a customer's account, and I can't verify that things like their e-mail data are transferred correctly
 
Have you tried downloading something from the shell with wget? Maybe the server isn't slow, but the internet connection itself? It is not normal for a normal simple echo in PHP to take way too long. Can you see how many memory PHP is using in the Proces monitor? And how many memory do you have?
 
Have you tried downloading something from the shell with wget? Maybe the server isn't slow, but the internet connection itself? It is not normal for a normal simple echo in PHP to take way too long. Can you see how many memory PHP is using in the Proces monitor? And how many memory do you have?
As I said, other users on the same server aren't experiencing any issues, so it's not network load
An entire load of WordPress uses about 42MB of memory (after some pruning and updating, was worse before) which is not unreasonable, server has 4GB memory with only about 1.5GB used.
 
os version?
php version?
have you tried a different php version?


are you using cloudlinux by any chance ?

the user might be hitting lve I/O limits.
this can be caused by a bloated mailbox for example..
check this in case you are using cl:
 
os version?
php version?
have you tried a different php version?


are you using cloudlinux by any chance ?

the user might be hitting lve I/O limits.
this can be caused by a bloated mailbox for example..
check this in case you are using cl:
CenOS 8.5.2111
Tried different PHP versions, problem exists in 5.6, 7.2, 7.3, and 7.4.

Not using CloudLinux, and this user barely has any email going on (or any I/O for that matter). Other users with much more I/O activity are not having issues.
 
first you should move away from centos 8, it is EOL and poses a security risk.
about your wordpress issue, i would not rule out malware, miss-configuration in wp-config or a borked config.
without seeing firsthand, it would be guesswork.
 
first you should move away from centos 8, it is EOL and poses a security risk.
about your wordpress issue, i would not rule out malware, miss-configuration in wp-config or a borked config.
without seeing firsthand, it would be guesswork.
It has nothing to do with malware, misconfiguration, or a broken config, I've already verified all of those.

What I did find out was that there was a cgroup slice configured for this user, which slowed down the process quite a bit. Removing the limits has almost fully restored the website itself, at the cost of heavy resource usage when a new page is generated.

This means the PHP slowness issue is mostly resolved, now I just need to figure out why WordPress itself is taking ten times the resources it should
 
WordPress itself is taking ten times the resources it should
Its usually a poorly coded plugin OR wordpress isnt updated.

+1 on moving to a more production based OS. CentOS is no longer that.
 
Its usually a poorly coded plugin OR wordpress isnt updated.

+1 on moving to a more production based OS. CentOS is no longer that.
Sadly a poorly coded plugin isn't really something I could do much about in this case. I know the theme adds some load, but I disabled all calls to external servers and did my best to optimize what I could.

Without the cgroup limits, the load time for an uncached page is now down to 6-ish seconds after a lot of tuning and pruning (was still well beyond 30 seconds before with just the cgroup limits off). This would be acceptable if it didn't use 100% of one core during that time, triggering monitoring (as it should, because that's unreasonable).
Not sure if there's more to do that belongs in these forums though, the DA/system related issue has been found. We are working on migrating away from CentOS 8 or from CentOS altogether, I used to have DA running on Debian and that experience was a lot smoother, but this host had a pre-built image for CentOS with an included DirectAdmin license, so that seemed convenient. Ended up costing me a lot more time than just managing things myself ?
 
Glad to hear you got to the bottom of the issue,
apparently close to what i suspected, a resource limit configuration.

regarding moving away from centos, you can (and should), do an in-place upgrade , it is possible to convert your centos to alma for example.
 
Is MySQL/Maria optimised? I had this issue (yawn) and believe it or not, it was the database choking even with my my.cnf I thought was optimised.......

If the site has a high concurrent of users (eg. ~500) at once, I'm pretty sure it's the database..
 
Back
Top