I hear people complain of their web host for all their site problems, truth be told most times your web host is not your problem. Your poor WordPress optimization may be causing your site to malfunction and cause your web host problems.
Most WordPress sites are running on shared hosting plans where the server resources are apportioned and shared by all the sites hosted on that server, so when one poorly optimized site hogs up all the server resources the web host will be forced to take it down and then you will blame the web host who is trying to protect other sites on same shared server for your problems.
Proper WordPress optimization is important for smooth running of your website and cohabitation on same server with other websites. It won’t be proper for one poorly optimized site to cause all the other sites hosted on same server to run slow or go down.
So when a web hosting company notices such they quickly take action to protect the other well optimized sites hosted on same server.
So instead of blaming the web hosting company for your site’s poor optimization and malfunction, you should address the problem or contact the hosting support for help if you cannot solve it yourself.
Must Read: How to compress images on WordPress using Smush.it
In this article I will share my experience with you and suggest measures to properly optimize your WordPress website.
Poor WordPress Optimization – Causes:
1. Theme: A poorly coded theme can be a serious source of trouble for your WordPress site and your web host. Most free themes may not have proper coding and support and that is why I always advise people to buy premium themes developed by serious developers that can provide good support even if you run into problems.
Must Read: What to consider while choosing a WordPress theme for your site
2. Plugins: Plugins are also another source of trouble especially those that hogs up server resources with poor support and lack of updates. WordPress has seen a lot of updates and some plugins were coded based on the old versions of WordPress, so when such plugins run on newer versions of WordPress they may encounter errors that could cause problems for your site.
3. Web hosting package: Sometimes you may be running a site that requires higher server resources on a server with lower resources and it could cause it to be slow or consume the server resources and force the host to suspend your site from time to time.
So ensure to buy a suitable hosting plan that can meet all your site needs for optimal performance and less trouble.
4. You: Are you surprised I included you as a source of problems for your web hosting troubles? Yes you may cause more problems for your site than you know. I will explain in details in a while.
Some WordPress Optimization Tips:
1. WordPress Heartbeat and heavy admin-ajax.php usage: Most WordPress sites run into this problem, it is a common problem caused as a result of excessive requests to admin-ajax.php which could lead to high CPU usage.
Since WordPress 3.6, the WordPress Heartbeat API which uses /wp-admin/admin-ajax.php to run AJAX calls from web browsers allows WordPress to communicate between the web browser and the server. This allows for improved user session management, revision tracking and auto saving.
In the past my WordPress site ran into this problem causing spikes in server resource usage and my site was suspended by my web host, but after reading Jacob Nicholson’s post on WordPress Heartbeat and heavy admin-ajax.php usage, I was able to fix this problem. Check it out.
2. Cron Jobs (wp-cron.php): Cron jobs specially assigned PHP script which runs all the automated tasks on WordPress such as posting contents on scheduled time, checking pending comments for spam, sending emails to notify you of a new comment, check plugins for new updates etc.
Every time a page is loaded the Wp-cron.php is called up. Imagine you have 100 visitors in every hour on your WordPress site, and each of them reads 2-3 pages, then that means the wp-cron.php is called up;
100 x 3 = 300 times per hour
300 x 24 = 7,200 times per day
7200 x 30 = 216,000 times per month.
A script that runs 7,200 times every day can put serious burden on the server which also affects other sites hosted on same server.
This could cause problems that can make your web host to suspend your site.
In this case you are required to either disable the cron job or reduce the number of such requests. While i will not advise you to totally disable cron job because you still need some automation on WordPress, i will advise you to reduce it to say every 6 hours.
First you disable the default wp-cron.php behavior and then set up a manual cron job for wp-cron.php. Check out another Jacob Nicholson’s post on how to disable and setup manual cron job for wp-cron.php.
3. Caching: Every time a web page is requested from the server database it causes a PHP execution, when 100 people view same page it creates 100 PHP executions.
Instead of having to pull same web page from the database every time it is requested, you can create a cache page on your server that can be viewed thousands of times without having to disturb the database any more.
So if you are not using a cache plugin like WP Super Cache or my favorite W3 Total Cache, you may be stressing your database which will in turn cause a high resource usage because you are assigned a certain number of processes on a shared server.
4. Dealing with Comment Spamming: A poorly optimized WordPress site can encourage comment spammers to target your site which will in turn cause a high server resource usage and of course suspension by your web host.
Ensure to use anti-spam plugins like Akismet to protect your site against comment spam. Blacklist any spammers IP you see, that way it will discourage them to stay away from your site.
Must Read: How to reduce spam on WordPress
5: Block Unwanted Crawlers/Bots with Robot.txt: While it is necessary for some search engine bots to crawl a site it may not be great to allow certain content scrapper bots to crawl your site. Not only will it add load to your server, it could also cause penalization from Google.
Use robot.txt file to block such unwanted bots from crawling your site. For example if you want to block the viola bot from accessing your site, simply add the code below to your robot.txt file.
User-agent: Voila
Disallow: /
6. Content Delivery Network: If you are not using a CDN then you may be putting so much stress on your server. CDN helps make your site fast by serving pages from the nearest server to the user. I have talked extensively about CDNs in this blog you can check it out.
7. Minification: WordPress has a lot of JS, HTML and CSS files from multiple locations, it could be from the plugins, theme etc. So when you load a WordPress site the browser sends a request to the server, each JavaScript or CSS file on your site is a request and when you have multiple requests it will add load on your server.
A proper WordPress optimized site will combine and minify these files to reduce the number of requests from your server. This will help to make your site fast and reduce the possibility of running into troubles.
Conclusion:
No matter the web hosting company you move to, with time the same problem will rear its ugly head again. Contact your hosting support for help when you don’t know what to do. No web host can boast of a 100% uptime, they all have their downtimes.
Properly optimized WordPress site using the guide I have shared here will greatly improve your site server resource management and of course performance. Jumping from one web host to another does not solve such problem.
Try and investigate to know what exactly is causing your WordPress site problems. If you have any questions please don’t hesitate to ask using the comment section below.
I use wordpree for website development but i dn’t know about the reduce spam on wordpress thanks for this suggestion .
Thanks for this tips, will give it a try