Scalable Hosting Services
+1 (866) 894-8284
Loading...
Logging in ... please wait

How To Optimize My Web Site?

optimize web site

Have you ever received a notification from your hosting provider that your web site is using too much CPU resources? From one side that is a good and a normal thing as it means your web site is getting more visitors and becomes more popular. From another side you have to pay more money for web hosting because your web site requires more CPU resources to operate and serve all visitors. Both are normal and both are part of the growing process of a web site. If you want to have thousands of visitors on daily basis don’t expect to be able to use a cheap web hosting plan. You will most likely need to switch to cloud server hosting or at least a higher shared hosting plan which allows more CPU resources. Upgrading is the easiest to do but it costs more money. There is one more step you can take before upgrading. You can optimize your web site and decrease the CPU resources it uses when a visitor comes to it. The optimization process includes many steps which may be hard to do if you have never done it before. You may need to get with your web designer to perform them for you although those steps must have been done before your web site has been published.

Why is it important to optimize my web site?

optimize your web site

Having an optimized web site has many advantages. If you are serious about your web site and if you want to make it popular it has to be optimized as best as possible. Many things depend on that.

Load times – an optimized web site loads fast. Google statistics show that visitors usually leave the web site if it takes more than 3 seconds to load. If it loads slowly you will lose visitors, traffic and business. A slow web site doesn’t always mean the reason is a slow server. In most cases it is heavy web site which is not optimized. If you have big images, lots of unnecessary code and queries to the database, it will load slowly. The optimization fixes that.

Better SEO – with a well optimized web site you will rank much better in the search engines. They like optimized pages and they rank them higher in the search results.

Those are just two of the many advantages that you get as a final result. The optimization is a long process which never ends. A/B testing for example is something you can do for as long as you have a web site online in order to make it better. That’s another optimization point though and in this article I will mainly cover the optimization which leads to less CPU usage and faster load times.

How to optimize my web site?

Let’s get to the point of this article and list the main steps you need to follow in order to have a great and well optimized online presence. Once again, if those steps look hard to do and you are not sure you can do them all I recommend to get with your web designer who should be able to do them for you.

  • More static content instead of dynamic – the reason is very easy to understand. The dynamic pages are written in programming languages such as PHP which are executed on the server. That means they utilize CPU resources every time a visitor comes to your site. In order to decrease the CPU usage you must have more static pages. Static content does not get executed on the server and doesn’t utilize CPU time. As a result you may have more visitors while your site uses less systems resources. Another point is that your web site will load faster because the content will be directly sent to the visitor’s browser instead of being executed on the server first and then sent to the visitor. The static pages use HTML, CSS, JavaScript while dynamic pages use PHP, Perl or another programming language. Use more static ones as much as possible to decrease the server load and have more visitors while using the same cheap web hosting plan.
  • Use less images – the images generate most of the total size of your website. They are the biggest elements on a web page and that’s why it is important to have less of them. The final result will be that the visitor will be downloading less data to their computer to display the website and it will load faster. If you have no choice and must use an image then try to find a small one. Every bit counts here especially when you add millions of visits. The total bandwidth will get dramatically decreased. That’s what optimization is – removing a little here and there and at the end making a big difference. A really important advise also if you have to use images: make sure each image has an alt tag and it is not empty. That will not increase load times or decrease CPU usage but it is great for SEO and you will rank better.
  • Compress your static content – a great thing about static content is that you can compress it to further decrease its size. The most famous module for such compression is the Apache module mod_deflate. With it you can compress most static content which is sent to the visitor. Check with your web designer if he has activated compression with mod_deflate and activate it.
  • Caching content in the browser of the visitor – you can configure how long a web browser should keep the cached data before it fetches it again. That’s an important tool you can use to decrease the number of elements that each visitor downloads when they access your web site again. For example, if it is configured to keep static content cached in the browser for 3 days, it will be downloaded only once in those 3 days. That will be less bandwidth for your server, less load and faster load times.
  • Minify JavaScript and CSS code – this step will remove all unnecessary code from your JavaScript and CSS scripts – white space, blank rows and so on. That decreases the total size of the code and adds another layer of optimization. No matter how small this step looks to you it is worth doing because there are multiple such small steps and each of them adds up. Keep in mind that each big picture contains many small pixels.
  • Use a CDN (content delivery network) – a CDN will definitely speed up the website and results in less requests to your server. That means less systems resources for your server to keep the site running. The CDN has many servers around the world and each of those servers keeps a copy of your static content. When a visitor comes to your website they access the static content from the nearest CDN server. That increases speed dramatically. ScalaHosting provides a free CDN in all shared and reseller hosting plans.
  • KeepAlive must be enabled – this is another important tool you use to make your website load fast. In this case though you will not have access to control the KeepAlive option unless you have your own server. KeepAlive is a feature of the web server which you can configure. When the option is disabled the web server will send each image and each separate static element via a separate connection. That increases load times. That’s why we want to have KeepAlive enabled. In that way it sends all static elements via one connection and makes your website load fast. KeepAlive is active on all ScalaHosting shared hosting plans, VPS hosting and SSD cloud servers.

The steps above will increase speed and decrease CPU resources your website needs to serve all visitors. How can you find that you have an optimized site? You can use Googe PageSpeed which will give you some insights. Use them to continue with the optimization even further. There are many more things you can do. I can’t list all of them here. I provide the most important of them. Above in the article are the steps for making websites load fast (except the first one which will also result in less CPU usage). Below in the article I will provide more information about decreasing CPU utilization as that is the point of this article.

In today’s world, most websites use free CMS systems such as WordPress, Magento, Joomla, Drupal, Prestashop. All of them are dynamic and use server-side programming languages such as PHP. Some of them such as Magento are very heavy and require lots of CPU resources. The most used CMS is WordPress and I will use it in my examples below. Since the CMS makes the website dynamic that results in easy management from a control panel (back-end). That’s good but results in high CPU usage when your website becomes popular and starts getting some thousands of visitors per day. At that point you will usually get the notification from your web hosting provider about the usage and that you need to upgrade. What can you do? You can just upgrade but you will have to pay more. You have one last step to do before it is actually time to upgrade.

  • Install a caching plugin – that’s the most effective way to decrease CPU usage. The caching plugins are scripts which generate static content from dynamic. As you already know, static content doesn’t need CPU resources. Now you can have even more visitors and stay on the same cheap web hosting plan. How can you find out which caching plugin to install? There are so many available out there both free and paid. ScalaHosting recommends the following ones for WordPress. The best caching plugin is paid but ScalaHosting provides it for free on all WordPress hosting plans. If you move your WordPress web site to ScalaHosting and notice it uses less CPU resources while your visitors increase, don’t panic. That is normal having in mind that we use the fastest caching plugin for WordPress.

LiteSpeed Cache plugin for WordPress

litespeed cache

That’s the most effective plugin that is available world wide. You must have an active LiteSpeed license with the cache feature enabled to use it. The results are amazing though. ScalaHosting recommends it to customers with very busy web sites. I will give you an example from the real life. The server load of a customer with a very busy WordPress web site who uses an SSD cloud server with Apache 2.4 is 50+ and the server crashes because it runs out of CPU resources. We recommend to install LiteSpeed with the WordPress caching plugin and the client approves it. After the installation the server becomes stable, the load drops under 5 and the client is happy.

W3 Total Cache – it’s another great WordPress caching plugin you can use to decrease CPU usage. It will also increase the speed of your website. This plugin is not easy to configure though as it has many many options and you may want your web designer to configure it for you. W3 total cache also has integration with the CloudFlare CDN which is worth activating. Install it, look at the features, play with it but on a test WordPress installation to avoid breaking your live website. You will see that you can control and configure tones of things such as caching of pages, caching of objects, caching in the browser and many more.

WP Super Cache – this is a very easy to use plugin for caching and increasing the speed of your WordPress website. It transforms dynamic pages into static ones by generating static HTML pages. It supports CDN functionality as well.

What can I do if the steps above are not enough?

It is time to upgrade. If you perform all the steps above and the CPU utilization of your web site is high, it is time to upgrade to a higher web hosting plan. Many people refuse to upgrade as they think the hosting provider is cheating and just trying to sell more web hosting. You can check if the usage your web site generates corresponds to the usage your web hosting provider reports. If your visitors increase it is normal to have higher CPU usage as well. If your visitors decrease but the CPU usage increases then there must be an issue with your web site. You have to identify which script causes the extra utilization and why. That’s not an easy process. You will most likely have to contact your web designer to find the issue and resolve it but that is only the case if the visitors decrease and CPU usage increases. Your CPU utilization will always increase when the visitors to your web site become more. Another mistake people do is they look at the unique visitors and not the total reloads they do. The CPU utilization is generated by each reload of every single page of your web site. That means you can have a web site with 5000 unique visitors per month which generates 1% CPU usage and a busy forum with 100 members and 100 unique visitors who reload the forum hundreds of times every single day resulting in 15% CPU utilization. Makes sense?

If visitors increase you will need a higher plan with more systems resources to host it. You can ask your hosting provider for advise which higher plan may work for you but if you have the budget to afford a server that will be best for you. Ideally, switch to cloud server hosting to get 100% control and be able to install anything you need. A cloud server will also increase reliability and security. It is worth the extra funds since you will also have your own IP address and there will be no chance for another customer to affect the reputation of your IP address.

Write a Comment

Required*