Websites on shared hosting suffer a lot if they have high CPU usage. It increases the load time of the webpages and the account can be terminated for this reason. The main reason for this problem is that the shared servers have many websites running simultaneously. If a particular website is using lots of CPU then it may trouble other websites running on the same server. High CPU usage can be because of high traffic, bad html codes, or bad plugins. Following are the ways to optimize the website (especially those which are based on WordPress) to reduce CPU usage.
- You should regularly repair and optimize the SQL database. You can do it through cPanel or phpMyAdmin. How to optimize SQL database?
- Plugins (with poor PHP scripts) are the main cause of problems in most of the cases of poor WordPress-based websites. It unnecessarily increases the communication time between the database and PHP scripts. It loads each time whenever your website loads. Deactivate all plugins that you don’t need or that are not coming from a trusted source. Don’t keep the unactivated plugins. Just delete (available in wp-content/plugins)
- Try to avoid the use of images, video, and flash objects. It increases the time to load a particular page and utilize memory. Images can be reduced in size by using professional software like Adobe Photoshop. The images can be reused for posts on similar topics. WordPress stores all images in one place in wp_content. You can also use FTP to transfer your images here which you can use to add in posts. You can also use links to add images.
- Using Google Search also reduces the CPU work as the searches are performed on a Google server. Additionally, It also gives a chance to earn money.
- Only summaries should be shown in the feeds. To select this option go to Settings->Reading, select Use Summaries in Feeds
- Use caching plugins. Some good trusted caching plugins are WP Super Cache and W3 Total Cache. Caching greatly improves the loading of your page and reduces CPU usage.
- Try to avoid getting unnecessary e-mail notifications that you really don’t need. It unnecessarily puts pressure on the server. For example, if comments e-mail is opted, a mail will be sent each time a visitor comments. If you really don’t read those comments in emails why ask your mail server to send you emails. To turn it off, go to Settings->Discussion.
- Turn off any formatting options. Go to Settings->Writing. Uncheck both formatting options. “WordPress should correct invalidly nested XHTML automatically” is more serious than these two.
- Use less number of posts on each page. Similarly, less number of feeds should be chosen. To select it go to Settings->Reading. Reduce the number here.
- Try to avoid the use of badly coded related post plugins. Related post plugins have many issues. Even good plugins in this category like ‘Yet Another Related Posts Plugin (YARPP)’ have many issues. Many web hosts have banned its use in shared hosting plans. It resulted in a high load of CPU and increased query time. Think before using them
- Always update everything. If there is an update available, you should always go for it. Updates contain security improvements and bug fixes.
- Several plugins offer feeds from various sources like Twitter (X) tweets, Facebook updates, feeds of other sites, and RSS widgets. All these plugins try to gather information from external sources every time a visitor comes to your site. You should try to keep such feeds minimum.
- After updating the WordPress posts the old revision of the posts remains there in the database which increases the database size. You should remove old revisions of the posts from the database.
- You should avoid changing CSS, JS, and PHP without knowing the event. Excessive formatting of these files to include more and more things (visual formatting as well as including external sources) increases the loading time of your web pages. If you have added something on your PHP to load from an external source and the external site is down then your page will also load slowly.
- Try to avoid leaving ‘writing post pages’ open without using them. It will keep your site open for such a period. WordPress’s ‘auto-save ‘ option uses server resources which results in higher CPU usage. Posting articles through email and word also increases the use of resources. The best way to post an article is to write in word processing software like Wordpad, Microsoft Word, and Open Office and subsequently paste it into WordPress for publication.
- All web hosting companies have cPanel which has the option to see which of the queries are taking longer time to respond. Whenever a visitor opens a webpage a query is sent to the database to retrieve the data/information contained in that post. Queries that are taking longer time increase the pressure on the server and your site will load very slowly. You should always look for the logs that indicate which of your queries are taking longer time to respond. Subsequently, you should change the script to repair PHP scripts.
If you are exceeding the allowed CPU then there is no hope for you to continue with the current web host. If you have followed the above recommendations but still facing the problem of high load then high traffic is the main culprit and you need more resources to continue the smooth running of your website. In simple terms, high traffic needs more CPU usage and high bandwidth which is not possible in shared hosting. For high traffic, it’s advisable to consider transitioning to a virtual private hosting server /virtual dedicated server (VDS/VSH)) or dedicated server. Certainly, a higher payment is required, but there are no alternative solutions. If you want to compensate the money paid for hosting then you can monetize your traffic by adopting online money-making strategies discussed in other articles on this website.
This specific post will undergo regular updates to incorporate additional methods for lowering CPU usage. Feel free to contribute your insights in the comment section, guys.
- Discover Your Home’s Hidden Wealth: Elevate Your Financial Future! - October 2, 2024
- Mortgage Insurance Exposed: How to Identify and Lower Hidden Costs - October 2, 2024
- The Real Cost of Mortgage Insurance Premiums: What You Need to Know - October 2, 2024