I'm having a VPS server with below configuration

2 core CPU 2GB RAM 50 SSD Centos 7 Web Panel: Sentora

From the last week, I'm facing a high CPU usage. Most the sites are WordPress. On opening each page or admin pages that run PHP codes, CPU usage goes to 50-60%. If there are 3 or 4 developing on WordPress sites at the same time, server takes lots of time to load sites

By running the command 'top' I found that apache is using this much CPU. Ram is almost stable. enter image description here

  • PHP is dog slow if you haven't done anything to rectify the situation. What have you done to accelerate PHP? – Michael Hampton Apr 17 '16 at 1:38
  • @MichaelHampton I haven't done anything (moreover I don't know). I heard php7 uses very low resources. Or do I have to installed some kind of cache system for PHP or something? But the main thing is, it wasn't using this much CPU before – Gijo Varghese Apr 17 '16 at 1:41
  • 1
    You have some reading to do, then. – Michael Hampton Apr 17 '16 at 1:47
  • @MichaelHampton once I had to set permissions of all folder to 777. So I doubt about viruses or malware too. Any way to detect that? – Gijo Varghese Apr 17 '16 at 1:50
  • Start by checking your php opcache is enabled and correctly configured. You really haven't given enough information to help you. PHP uses a fair bit of CPU. If you don't know about this stuff you'll have to hire someone who does to help. – Tim Apr 19 '16 at 23:16

You need to ask some questions about your current Apache configuration before you can begin troubleshooting the performance:

  1. What worker process are you using in Apache? Pre-fork or MPM(threaded)?
  2. Are these workers configured correctly in your apache.conf? What happens if you change some of the values? (does performance increase when you add more idle resources?)
  3. How is your PHP code being sent to Apache? CGI or mod_PHP?

The suggestion is to use the MPM worker with a CGI interface to PHP.

really though there isn't enough information here to make a good determination on the performance issues

| improve this answer | |
  • I am not about these. Which one should i use prefork or mpm? And cgi vps mod_php, which one is good? – Gijo Varghese Apr 18 '16 at 7:44
  • Depends on your workload. If you don't want to read a bit about it. Just test it out and see what happens with your workload. – Joseph Kern Apr 20 '16 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.