PHP-FPM nightmares

LawsHosting

Verified User
Joined
Sep 13, 2008
Messages
2,418
Location
London UK
Apache (event) and PHP-FPM.......

Ok, I run OpenVZ containers and have a client with a pretty big site, ~100 visitors at once...... It also runs on Wordpress (don't get me started!) and various plugins.

It runs slow, to the point it stalls...... You can see how bad with the attachment I gave..... It might be a bad plugin..... This happened before, turned out to be a forum plugin. That was sorted by changing to a different forum plugin..... Today it started to act up again.

Its database is on another server using just ~18% CPU.

I tried optimising the global, as well as the user's php-fpm.conf files... Tried 7.3 too.. I've only tinkered with ondemand, not tried static or dynamic.

I'm running out of ideas, leading me to potentially losing the client.....

I'll post the site url if needed.
 

Attachments

  • 2020-09-02_15-53-49.jpg
    2020-09-02_15-53-49.jpg
    532.5 KB · Views: 67
It might just be another plugin? Check if caching works, what urls are requested and make things slow, check if you have memory enough for the number of http processes. Maybe lower this number even tho this seems like the opposite, but having less processes might help you preventing swapping (you have about 50% swap which is 49% too much, hehe). When a system starts swapping, there's nothing more to measure and it will slowly die in 9 out of 10 cases. Also, having 0 buffers for the kernel might indicate you're saturing your disk bandwidth. That might explain why you still have some spare memory left. This again can be the result of the swapping.
 
http processes are only 3, of course, they open/close periodically.....

Here's my event section
Code:
 ServerLimit              2800
        StartServers             4
        MinSpareThreads          25
        MaxSpareThreads          75
        ThreadLimit              64
        ThreadsPerChild          25
        MaxRequestWorkers        1200
        MaxConnectionsPerChild   1000

opcache is enabled, 99.7% hit rate...
 
Last edited:
Find out if all of the forum visitors are really visitors, or just also a bunch of useless forum-search bots that cause lots of traffic.

I've noticed a steadily increase in CPU-load recently that was caused by some annoying searchbot that kept hammering a forum.
I blocked its complete IP-range and things have returned to fairly normal again.
 
change opcache_revalidate time from 0 to 5, 10, 30 etc.
vm_swappiness change from 60 to 5
check access log for srtange IPs/subnets/bots
also you can install memcached and phpmemcached and activate it in wp-caching plugins
 
If the site goes through Cloudflare, is W3TC et al still relevant? (Note: I don't use Wordpress myself, so I don't know what's good, bad or total rubbish)
 
I definitely agree you need file caching in Wordpress such as W3TC. Cloudflare still routes almost all the hits through your server.

With file caching think of it in concept:
- No caching: 1 hit will make 1000 sql queries and process all that data
- With caching: 1 hit will make 10 sql queries and just read the most data from a static file

Anyone who has properly played with a wordpress site knows the major speed and resource difference when using the right caching. This is not something you can really fix on the server level.

Yes there are server options also discussed here, but those cannot do what the caching within the application can do. That is to say it has not already been done, but if not sure that would be the #1 thing to check really.
 
If the site goes through Cloudflare, is W3TC et al still relevant? (Note: I don't use Wordpress myself, so I don't know what's good, bad or total rubbish)
W3TC has cloudflare extension, its can be activated separately. So, its could work well.

But i think forum is intensive dynamic site, so is not too good to integrate with anycast dns cdn using cloudflare. I prefer using cdn just for static file like image and script.
 
Last edited:
I definitely agree you need file caching in Wordpress such as W3TC. Cloudflare still routes almost all the hits through your server.

With file caching think of it in concept:
- No caching: 1 hit will make 1000 sql queries and process all that data
- With caching: 1 hit will make 10 sql queries and just read the most data from a static file

Anyone who has properly played with a wordpress site knows the major speed and resource difference when using the right caching. This is not something you can really fix on the server level.

Yes there are server options also discussed here, but those cannot do what the caching within the application can do. That is to say it has not already been done, but if not sure that would be the #1 thing to check really.
Agreed with you
Yes, There many thing when optimizing wordpress site at developer/user end, like minification and compression. But if user can do the server config, all that job will be easier to do..

One thing i like from W3TC, the disk caching generated 2 files, 1st origanal cache and 2nd compressed cache. So its help loot to optimizing cpu usage for each cache hits
 
Maybe some of this will help.

 
It is a long shot.. But I once had a forum (had transferred to me) that had really high cpu and usage. I downloaded all the files to my Computer and scanned them with BitDefender AV. I found it had viral code in the attachments a some of the php files. Once I replaced those files with the standard ones. The performance went back to normal. I find ClamAV or Virus total (https://www.virustotal.com/) sometimes isn't good enough.
 
Maybe I've found the issue....... There's some packet loss between the 2 servers, well, CTs..... Makes sense now.........
 
Back
Top