- 1 CAUSE THE WORDPRESS WEBSITE LOADS SLOWLY
- 2 SOME WAYS TO FIX SLOW LOADING WORDPRESS WEBSITE
- 3 EPILOGUE
CAUSE THE WORDPRESS WEBSITE LOADS SLOWLY
Hosting / Server configuration
This is probably the first reason to mention when a WordPress website loads slowly. On the server side, there are two main reasons:
Configuration is not enough
We must all understand that each website will be able to use different server resources. Assuming your website is required to use more resources than usual (sales websites, or websites that use more complex features), you will now need a higher Hosting / Server service configuration. Normally, every feature on the website will handle smoothly, because usually the website will load the process in order, just one of the download process is slow, the time to load the whole website will be slow.
For Shared Hosting using cPanel, one way to know if the configuration is not sufficient for the website is to go to cPanel and see CPU / Physical Memory statistics in the right column. If you see it as a red or feel like this, then your website has used too many resources.
You can also go to the CPU and Concurrent Connection Usage section to review the history of times when your host package exceeded resources.
As for using VPS or private server that you have access to the server’s SSH, you can use the command
top -cto view the status of the CPU as well as processes taking up CPU:
Because each website has different download conditions, I can not advise exactly how much you need. So you can read all of this article and do all the ways below and the website still needs a lot of resources to handle, then upgrade the service to a higher package.
Error from server
Although it is quite difficult to happen, this is still a cause of website slow down unexpectedly. Usually with Shared Hosting server, you can go to cPanel => Server Information to see if the server’s load status is overloaded, or there may be a problem from the provider.
Normally, if there is a problem from the server, the Time To First Bytes (TTFB) time when loading the page will be very high (about over 5 seconds if using the service of domestic providers, while abroad, but when the cable is broken will be like that). To see the TTFB time when loading the page, you can open Google Chrome and visit your website, then right-click the page and select Inspect and find the longest download link to see TTFB as the image below. .
If the website uses many external links such as Facebook, Tawk.to, PushCrew, etc., it is also a cause of slow website because if the network speed of visitors to these links is slow, it will increase. Upload time of your website. Therefore, you should limit the use of the external service’s embed code, only for services that are really needed or embedded separately in an appropriate page.
SOME WAYS TO FIX SLOW LOADING WORDPRESS WEBSITE
Limit the use of multiple plugins
Each plugin installed on the website, the consumption of resources will increase more or less depending on the type of plugin, so you should limit the use of plugins that are not really or not needed. Especially, there are some plugins that you should consider using such as:
- Google XML Sitemaps : Sitemap you can use Yoast SEO plugin to install without a separate plugin for it. Because when the sitemap updates, if your number of pages is large, the server will need quite a lot of resources to update the sitemap file.
- Security plugins : WordPress security is complicated but also simple, so you do not need to use many different security plugins but only one plugin. The plugin I recommend is iThemes Security because it has all the necessary features to secure WordPress website.
- The plugin automatically links to keywords in the article : Some users want to increase the number of internal links in the website, so they have used the plugin to automatically link with keywords in the article to the tag, category or post. write. This is not necessary because the abuse of these plugins will make your article full of links very unsightly, you can do this manually or use the Internal Link Manager plugin to link to only yourself. Your desired keywords to the specified page.
Use the cache on the website
Every website should have caching, there are many different caching techniques for WordPress , but every website should have HTML Cache to minimize the server using many resources to handle. If you are not very technical, you can use the WP Super Cache plugin or LiteSpeed Cache (with LSCache-enabled hosts like AZDIGI) to create a cache for the website, so your website has saved a lot of resources. quite good.
Compress images before uploading to the website
This error is very common with some users, it is uploading an unoptimized original image weighing tens of MB on the website. This means that when a user loads the page, their browser will load dozens of megabytes of images excluding the other components, taking 5 seconds to be less.
For normal websites that do not need the precise resolution of each pixel of the image, the size should be reduced to a maximum of 1100px for the horizontal. In addition, you can install the Smush Image Optimization, Compression, and Lazy Load plugins to support automatic image compression when uploading to the website, reducing image file size to the lowest level while maintaining the quality.
Reduce the frequency of running WP Cron
Each WordPress website has its own cronjobs built right into the source code to do some repetitive things like checking for new versions, deleting comments in the trash, or some features that the plugin / Available theme.
One feature of WP Cron that uses a lot of resources is that the wp-cron.php file always runs with high CPU usage, which you can only see when viewing with the command
topin the Linux server.
To view all the cron available in the WordPress website, you can use the WP Control plugin . Then if you see only unnecessary cron in this, you can turn off WP Cron by inserting this paragraph into the wp-config.php file:
define ('DISABLE_WP_CRON', true);
Then create a cronjob in Hosting / Server periodically 2 times a day as follows:
* * / 12 * * * / usr / bin / php /home/path/public_html/wp-cron.php> / dev / null 2> & 1
The admin-ajax.php file uses a lot of CPU
In addition to wp-cron.php, there is another equally hungry CPU file /wp-admin/admin-ajax.php. Often this file will work a lot when you use WooCommerce or plugins that use the Hearbeat API of WordPress . If you find that your admin-ajax.php file is constantly processing, then it’s time to check the frequency of this file’s operation.
The simplest way is to use the Hearbeat Control plugin to turn off the Hearbeat API if you think the website doesn’t need this, or reduce the frequency of this file.
Clean the database, especially the wp_options table
Those who are programmers are certainly no stranger to all the table data
wp_optionin WordPress downloading one at a time for each website load. This means that if you check the database and find that this table is large, you should review and optimize. I have a pretty detailed article about this here .
Use PHP version 7 and above
Versions of PHP earlier than 7.2 will be retired until November 2019, meaning there will be no updated or supported version from PHP. Therefore, you should use PHP 7.2 version for website right now partly because of security, the most important part is that PHP 7.2 has much faster processing speed than PHP versions 5.6 and below, if The better you can use PHP version 7.3, the better.
The above are just some simple ways that everyone can do to optimize their own website to website faster from saving resources for the server. With some of the other advanced ways I will mention in another article in more detail. In addition to this article, I also have a number of other articles related to website acceleration for WordPress that you can refer to below.Read more :