Before starting with details, I think it would be good to explain “why hosting service providers count the executions?” and “why lowering them ensures smooth performance?”. Based on my experience on the field, I can say for sure that hosting companies pay attention to executions and overall performance, because increased usage of server resources may affect the other users hosted on the same server. The main idea is to guarantee the fair share of the resources.
What is the connection between WordPress executions and CPU usage ?
Well, that is easy. Usually a high number of executions requires more CPU. The things however, going further. If your account generates a lot of executions with low real time CPU, then this means that your website is well known with a lot of visitors or you are under some kind of attack. Another thing is low number of executions with high real time CPU. The only conclusion in this case is poor coding. Perhaps some of the additionally installed plugins does not work as good as expected.
So, how to proceed when the alarm is sounded ?
Usually the hosting service providers offer a number of specific tools to analyse the stats and logs to find a solution. In this particular case, we will review the options in Awstats tool which is available in all cPanel based control panels.
Hosts – in this part you can find top hosts or IP that visited your website. If you see suspicious activity, you can easily block the offending hosts using IP Deny Manager. This is another handy tool available in cPanel.
Robots and Spiders – nowadays the automated programs that crowl websites are known as spiders or robots. In many cases however, they are quite aggressive and cause CPU spikes. What you can do is block or limit them using robots.txt file. It should be placed in the root folder or your website. It should contain instructions about the robots and more specifically what to be crowled and what not. Additionally you can set crowl delay to lower the number of hits.
Pages and URLs – this is another important part of the stats. If you see unusually high number of hits towards the login page, then perhaps some bots are trying to gain access. In this case, I advise you to protect the login form either using plugin or deny rules in .htaccess file
WordPress and Slow Mysql Queries
Another aspect of the whole problem is the interaction between WordPress and Mysql daemon. Considering the fact that by default WordPress operates with indexed databases, during its normal functionality no slow queries should occur. The situation however, changes when there are poorly coded plugins or the database got too large. When it happens, Mysql daemon needs more time to handle the query and return results. If the time frame is over a second, then this is slow and the query itself is considered as slow. Mysql puts it in slow query log and starts working slowly because other queries are made while the daemon is trying to work on the slow one. The ultimate effect of this is slowly working website or server.
What to do when the reason for the low speed are slow Mysql queries ?
More or less this problem requires the attention of a professional developer familiar with the specifics of your website. Random actions such as clearing logs or tables may affect the normal functionality of the entire website, so I advise you not to proceed this way. If you have slow queries, then they need to be analysed and carefully fixed. Note that Mysql restart is only temporary solution, so you should not reply on it. If no developer is available at the moment, you can open PhpMyAdmin tool and find the largest tables. Once done, you may disable the plugin that puts or gets data from it. Another option is to look for transient records and remove them using plugin. Large number of transient records in wp-options table could be a good reason for slow performance.