High CPU Usage by Prestashop on Apache2

March 12, 2016 2.1k views
Linux Commands Load Balancing Server Optimization Configuration Management PHP Apache Debian

Hello.
I have a 2GB Droplet and I have problem with high CPU usage when someone is on the website. The site is running on Apache2 and Prestashop.
When site is online the CPU usage is 1-2%, but When somebody will enter on the site, the CPU usage by Apache2 is 60-70%.

1 Answer

What version of PHP are you running? If you're running PHP 5.6.x, you might consider enabling OPcache with a configuration like this:

[opcache]
opcache.memory_consumption=64
opcache.interned_strings_buffer=4
opcache.max_accelerated_files=4096
opcache.revalidate_freq=600
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.enable=1
opcache.dups_fix=0
opcache.load_comments=0
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.save_comments=0
opcache.enable_file_override=1
opcache.inherited_hack=1
opcache.protect_memory=2

Also, lower your KeepAlive timeout, and follow the documentation here for a performance boost:

http://doc.prestashop.com/display/PS16/Performance+Parameters

  • I enabled OPCache and I had 30% CPU usage, but after one minute i got ERREMPTYRESPONSE chrome error. And that was still high CPU usage.

Have another answer? Share your knowledge.