Website performance

Editor: Evgeniy Burovinskiy 859 4 min Audio

Page speed influence

Page speed affects the visitor’s user experience greatly and thus, your traffic. Most users leave the website, if the pages or page elements are loading slowly. This leads to income decrease and ranking drop. Moreover, page speed is taken into account by search engines and due to this, it can slightly influence the overall website ranking.

How to measure website speed?

Page Speed is the parameter that measures the website loading speed. There are a few ways to measure it. They are described in this article (add link).

How to speed up your website?

Red - very important, orange - recommended , green - optional.

1. Optimize images.

It is quite obvious that large images are loading quite slowly.

Nowadays, there are plenty different online image modifiers and minifiers. Сompressor is one of the most popular tools that allows to reduce the image or photo size either with or without quality loss. It can compress the image up to 90%. Another tool, Imagify, can not only compress images but also optimize all of the images at the same time. As for gif optimization, it’s pointless to review all of the tools as there are quite a lot of them and each of them has its pros and cons.

It’s also possible to reduce the image size manually using Adobe PhotoShop or any other graphic editor. We recommend to perform a more or less lossless compression. If the images are of very poor quality, users will not be very eager to visit your website because it will look horrible. In this case it is better to speed up the website by other means.

File extension. We offer to use png and jpg. The first one has the highest compression rate and the latter supports transparency. We also highly recommend to use WebP extension. WebP is a modern image format that provides lossless and lossy compression for images on the web.

WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller compared to JPEG images at equivalent compression rate.

2.Set up browser caching

When someone visits your website, your browser loads all of its elements (images, CSS-styles, text etc) from the server where the website is stored. Browser caching is the process of temporarily storing this data on the visitor’s hard drive. It means that the next time the user visits your website, it will load much faster because the browser will load only those elements that have changed and takes all of the others from its memory (cache). What to store is determined by the website.

In order to enable caching, you need to add the following code to the .htaccess file (please note that this is applicable only for Apache web server, not for Nginx):

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
</IfModule>

Storing time in this code is set to 1 month since we consider this period to be optimal. You can set different values e.g. 7 days, 1 year, etc.

Please mind that mod_expires.c module should be enabled on the side of your hosting provider for this code to be executed. Most hosting companies have this module enabled by default. Though, there are still a few companies that have it disabled and you might want to contact their support to resolve this issue.

You can add the following code to optimize script caching:

FileETag MTime Size
<ifmodule mod_expires.c>
<filesmatch ".(jpg|jpeg|gif|png|ico|css|js)$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
</filesmatch>
</ifmodule>

Large hosting providers have all these features integrated into their hosting control panels so you can turn them on/off without modifying the .htaccess file manually.

3. Enable gZip compression

How it works: when a user is attempting to open a webpage, the server where the website is located takes the requested data and makes it smaller (compresses it). Hence, the amount of data transferred to the user is smaller and is received faster than if it would be transferred uncompressed. Once arriving at the user’s device the data is restored by un-zipping with his browser and your webpage is displayed. The benefit here is that even though the process takes a bit of time, it’s still less than it would take to download a full sized file.

Since many hosting providers do have gZip enabled on the server level by default, you won’t have to turn it on yourself. It is rarely mentioned on hosting provider’s webpage and you might want to check with their support if it’s on.

Here is a guide (add link) for those who will have to turn it on manually.

4. Optimize CSS files

CSS optimization does not provide significant user experience difference. However, doing it will improve page speed. There is a lot of online services that you can use for this purpose.

Your styles will work as intended. Unnecessary spaces will be removed and the data will be contracted wherever applicable. Nothing else will change.

We recommend to use cleancss.com. Alternatively, you can use the following tools:

  • CSS Compressor (uncheck the “Output using smallest size” checkbox so that the CSS structure is preserved).
  • YUI Compressor (recommended by Google) which we don’t find all that comfortable.

Hosting providers are eager to take the extra mile to keep the customer by providing more tools. Thus, you might be able to optimize CSS in your hosting control panel.

5. Optimize JavaScript

Just like CSS files optimization, it is worth to optimize JavaScript, even though this will not provide significant user experience improvement. Insert the JavaScript code to this online service (recommended by Google) and get the script that is minified and loads faster. jslint.com (by Yahoo) may be considered a reasonable alternative.

Hosting service provider might add similar tools to your hosting control panel. Those tools will work just as well as the ones we provided, so feel free to use them.

6. Optimize database queries

If your website is using a database, you might want to check for queries that might be optimized. Unless optimized, they might load the server and affect the Page Speed.

Check if your hosting service provider offers any database monitoring system to identify slow queries. This will allow you to analyze the web page performance and highlight the points that need to be modified.

In a best-case scenario, database queries should be executed in less than 15 seconds.

7. Asynchronous JavaScript and CSS Loading

Usually, webpages are being loaded in this way: styles and scripts load first and the rest of the content afterwards. All of that content loads synchronously and until both (JS and CSS) are loaded, the page content will not be displayed to the user. It is advised to set asynchronous CSS, JS, and main content (text, images etc.) loading.

We don’t recommend doing that. If it takes some time to load a script or CSS file, it will take just as much with asynchronous loading. In case you enable asynchronous loading, the user will see the web page text a bit sooner. If he rushes to click something that utilizes JavaScript while it’s still loading he will most likely get an error message.

In order to avoid that, we advise to optimize your scripts and styles for them to load faster.

8. The upper part of the web page coded first

Try to arrange your code in a way that elements located on top of the actual webpage were located in the upper part of the code (for them to be executed prior to elements located below on the page). This is useful if you have a long web page. Hence the user will see the upper part of it as soon as possible. The rest of the page content will load while the user is checking the upper part of it.

9. Use the Page Speed tool

Page Speed is a tool provided by Google. It identifies web page’s main speed issues and provides useful tips on how to fix those.

10. Check the hosting provider’s control panel tools

Most hosting companies have a fairly wide toolset in the control panel. There you can find the majority of tools that will help to speed up your website.

We do advise using those. If something goes wrong and the website stops working, you can always contact the provider's support and they will assist.

11. Use OpCache or Memcache/Memcached

We recommend using OpCache/Memcache. Both of these tools work in a similar way but OpCache optimizes scripts while Memcache/Memcached is designed to optimize database queries.

OpCache improves PHP performance by storing precompiled script bytecode in shared memory that speeds up their functioning. Memcache/Memcached (which one to use is defined by the PHP version) caches database queries.

Might you have any advice on page speed improvement, please leave those in the comments below and we’ll be glad to add those to the article.

Feel free to ask any related questions in the comments as well. Our experts will reply as soon as possible.

Evgeniy Burovinskiy
Did not find an answer to your question?
Ask the experts! Answers are quick and go directly to your email.

Adding confirmation "I'm not a robot" you also agree to receive messages from hostings.info and accept its Privacy Policy, allowing hostings.info to store and process your personal information indicated above to provide requested content.

Ratings of hosting providers by site tasks
Hosting price

We highly recommend not to purchase the cheapest hosting package. Usually, they come with a row of issues: the server is often down, the hardware is outdated, lousy and slow support, registration and payment errors, etc.

For your convenience, we have created a tool that can help you to choose the right hosting package for you just by answering a few simple questions.

CMS

CMS is a content management system. A lot of hosting providers offer so-called CMS optimized packages. However, this is a marketing trick because most CMSs do not have special software or hosting requirements.

Free trial

Trial period is a period of time, usually from 7 to 30 days, during which you can use the hosting services for free to test them.

Moneyback policy allows the customer to receive a refund for his order within a certain period after the purchase.

OS

OS means the operating system is installed on the server. We recommend to choose Linux hosting unless your website requires another OS.

Other

Bulletproof hosting - it’s a type of service that allows to host almost any type of content, even the restricted one (adult content, warez, spam etc). Bulletproof hosting providers do not remove your content in case someone reports an abuse.

Unlimited hosting - refers to companies that provide packages with unlimited disk space, bandwidth, number of domains, databases or email accounts, etc. This is usually a marketing trick but sometimes you can find something worth a try.

Secure hosting - it’s a type of service when the hosting provider is mostly responsible for the security of the user’s account: updates the software installed on their servers, provides an antivirus and malware scanner, firewalls and basic anti-DDoS protection, etc.

DDoS-protected hosting - companies that provide packages that include anti-DDoS protection. These packages are considerably more expensive than regular ones. Nevertheless, they’re totally worth their price because the company will ensure that your website is secured from cyber attacks.

Technologies

Most websites require MySQL and PHP installed on the server to work correctly. Almost all hosting providers support these technologies.

ASP.NET is a Microsoft web application development platform.

Control panel

The more comfortable the control panel is, the easier will it be for you to change the website and hosting account settings.

Most hosting providers that are in TOP20 in our rating offer user-friendly control panels, such as cPanel, Plesk or DirectAdmin. That’s why we recommend to pay attention to other, more important parameters, while choosing a hosting provider.

Disk type