Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
CloudLinux
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to troubleshoot high loads

gwnd1989gwnd1989 Member
edited May 2024 in Help

Hi

We have some web servers (with no panels) and sometimes they report 100% cpu usage. The processes with the most percentage of cpu usage are php-fpm.

How do you troubleshoot this?

Any bible like troubleshooting resource you can point me to?

Thank you

Comments

  • lukast__lukast__ Member, Megathread Squad

    @gwnd1989 said: We have some web servers and sometimes they report 100% cpu usage.

    How exactly do you measure that?

    Thanked by 1gwnd1989
  • @lukast__ said:

    @gwnd1989 said: We have some web servers and sometimes they report 100% cpu usage.

    How exactly do you measure that?

    Site24x7 alert

  • @Obelous said:
    killall php-fpm

    And hand in the resignation thereafter

  • Did you enable opcache?

  • gwnd1989gwnd1989 Member
    edited May 2024

    @jwg29859 said:
    Did you enable opcache?

    I have it enabled

  • HajtHajt Member

    Which PHP version are you currently using? If your apps are compatible with 8.3, then it's advisable to upgrade for better performance and reduced load.

    Thanked by 1gwnd1989
  • ehabehab Member

    what are you doing with your other hand with a profile pic like that?

    Thanked by 1totally_not_banned
  • @ehab said:
    what are you doing with your other hand with a profile pic like that?

    Off topic

  • ehabehab Member

    @gwnd1989 said:

    @ehab said:
    what are you doing with your other hand with a profile pic like that?

    Off topic

    you were doing something off tropical ?

    Thanked by 1totally_not_banned
  • amit177amit177 Member

    What are your settings for php-fpm? When do you see the CPU usage on 100%? Does it happen randomly or does it happen when there's a traffic spike? Did you enable slow log?

    Thanked by 1gwnd1989
  • aj_potcaj_potc Member

    As @amit177 suggested, the PHP slow log is a great place to start. This will identify any scripts that are running for longer than some threshold you set. Poorly written scripts can be a cause of high CPU utilization, so that's a key way to find out where your problems are.

    Start with a higher value like 5 or 10 seconds to see if you have any really long-running scripts. Then gradually reduce the number until you've identified all of the troublesome ones. From there, you can work backwards to find the specific functions that are taking so long to execute.

    Thanked by 1gwnd1989
  • vsys_hostvsys_host Member, Patron Provider

    First, find an exact website that makes 100% load; you can do that with a status page, for example. Next tail -f access.log of that website. If there are a lot of requests per second - it's DDoS or some kind of parser or visitor's peak. If requests are rare - isolate slow requests and try to debug it with google / reading code / strace ...

  • have you tested using profiler like xdebug?
    maybe create a dev environment first then use xdebug to identify bottlenecks on your php app?

Sign In or Register to comment.