Web resource speed is one of the essential points for both user experience and SEO marketing.
Numerous researches have proven that more than 50% of users close the webpage if it needs more than 3 seconds to load. This influences user experience negatively, increases the bounce rate, and results in a lower position of your website on the search results page.
Moreover, many search engines analyze page speed and prioritize faster loading websites in their ranking system.
Letâs find out what web app speed depends on and how to increase it.
Which factors influence website loading speed
Website loading speed depends on quite a number of different factors. In this article, we will focus on 3 key points:
- Server response time.
- Content peculiarities and content loading speed.
- Page rendering.
1. Server response time
When a user opens a website, the browser sends an HTTP request to the server. After the server has responded to that request, the content becomes visible. The time span between the request sent and the response received is called server response time.
This term is also called Time To First Byte, or TTFB.
The user perceives it as the time span between the moment they opened the website and the moment the page started loading.
Server response time depends on:
- Server load, i.e., the number of users opening your website simultaneously and the number of requests that take place at the same time. The more requests there are, the slower the server processes them.
- Server characteristics, i.e., if the server has enough capacity for the current load.
- Server and user location. The larger the distance between the server and the user, the more time will be required to process the request and get the response.
- Working with databases. If your website interacts with a database, this can also lead to delays if the database is located on a server that either has scarce resources or features settings that are irrelevant to the current load.
2. Content peculiarities and content loading speed
The main idea is easy to understand: the heavier your content, the longer it is going to load. Hence, the smaller the size of the elements published on your website, the better.
Yet it is important to maintain a balance between the file size and quality. Images weighing several kilobytes are certainly going to load faster. But if they look blurry or contain some barely distinguishable elements, this may create a bad impression of your services and reduce sales.
3. Page rendering
Your web app consists of images, videos, text content, graphic elements, and so on. While the page is loading, all these elements appear on the userâs screen altogether. This is called page rendering.
Page rendering speed can be tested using various services like the popular Page Speed Insight service.
Page rendering speed depends on the following factors:
- The number of elements on the page.
- The order of elements loading (the most important elements should appear first).
- Page layout.
How to reduce server response time
1. Database performance optimization
In order to make the content appear on the page, the server needs to call the database that this content is stored in. The lack of database performance optimization can result in increased website load time.
This turns even more important if you use dynamic content (social networks, forums, recommendations lists in online stores, and any other content that isnât stored in databases, canât be used out of the box, and needs to be created on request). In this case, the system needs not just to retrieve the files but also to form an information block that the client is supposed to see.
Speeding up database performance is a priority task for experienced programmers. The first things that need to be done are as follows:
- Optimize database requests. When working with databases, use the EXPLAIN command to understand which requests work slowly and find a way to speed them up.
- Cache answers to most common and similar requests. Dynamic content websites need this more than any other sites. Instead of forming the same content over and over again, the database can return ready materials stored in the cache.
- Set database indexes. Indexed table fields facilitate and speed up data search.
2. Connecting CDN
The further the server is located from the users, the longer it takes to process their requests and get responses. If all your clients live in the same region, there is no problem because you can just buy a server located nearby. For example, if all your target audience lives in Luxembourg, it is advisable to have your server also located in Luxembourg.
Yet in most cases the target audience of online businesses is scattered over different cities and countries, and having a server in each city is impossible.
This problem can be solved using CDN (Content Delivery Network) servers. It is a large number of connected servers (i.e., points of presence) that retrieve data from the origin server, cache them, and convey the information to the users.
CDN servers are usually placed as closely to the end users as possible. When a user opens your website, the request is sent to the nearest point of presence instead of being sent to the origin server. This reduces both the request path and the server response time.
When CDN servers are used, the information gets cached in the points of presence after the first request has taken place:
- Letâs imagine that your origin server is located in Germany whereas your clients are scattered all over Europe, America, and China. Youâll need a CDN featuring points of presence in all these regions.
- When, say, an American user opens your website for the first time, the initial request goes to the origin server.
- The data retrieved from the origin server, however, get stored on the CDN server that is closest to the user location.
- When another American user opens your website, the request will no longer go to the origin server. It will be directed to the nearest point of presence that already has the necessary information cached.
Using CDN not only reduces server response time but also enhances the serverâs fault tolerance. In case of traffic surges the requests get distributed evenly among the nearest servers instead of being sent to the origin server altogether. This makes it possible to balance the server load and to stabilize website performance.
If you have a global project, youâll need a CDN server featuring worldwide points of presence to speed up your website. Analyze the number of points of presence available and their location. First of all, they should be positioned in the regions where your clients live. The more points of presence, the shorter the response time and the more stable the system performance.
Gcore CDN has more than 80 points of presence on all continents except Antarctica. Thanks to the excellent coverage, we can boast an average worldwide response time of about 30 ms. Our total network capacity exceeds 50 Tbit/s.
A high-capacity worldwide CDN can reduce server response time significantly. Yet you should bear in mind that it will only help in case your clients actually live far from the server. If this is not so and the server response time parameters are still poor, there must be another problem with the server, and enabling CDN wonât help.
3. Server load reduction
To reduce server load, the first thing to do is cutting down the number of requests.
When loading a website, the browser sends requests for each of the page elements. The fewer elements there are on your website, the fewer requests the browser will need to send.
At that, to avoid changing page design, you can do the following:
- Use CSS sprites, i.e., combined images consisting of several small pictures. As a rule, background images, interface elements (such as buttons and icons), and images of the same color palette are usually combined to form a CSS sprite.
- Use inline images, i.e., the images using the âdĐ°ta: URLâ scheme (the pictures are included in the HTML file).
- Combine several files in one. For example, you can combine several CSS or JS files.
In some cases, CSS sprites can even reduce image size and speed up content load. Note that inline images increase HTML file size. Combined files are also heavy. This is a double-edged sword: while cutting down the number of requests and reducing server response time, you make your content heavier.
If you have many heavy files, their combination will reduce the server load but this wonât result in any significant website performance speedup.
A more effective way of reducing server load is using origin shielding. It is an additional pre-caching server located between the points of presence and the origin server.
The main function of the shielding technology is preventing your server from getting too many requests. All requests from CDN servers first come to the shielding and only then to the origin server. As a result, the latter interacts only with the pre-caching server instead of interacting with the whole network.
This allows you to cut down the number of requests and process them faster, which leads to reduced server response time.
The origin shielding technology is available with many advanced CDN providers including Gcore CDN.
4. Placing domain names on the DNS servers located closest to your clients
Before sending a request to your websiteâs server, the browser needs to get its IP address. The information about domain names and their IP addresses is stored on DNS servers.
Before actually sending a request to the server, the browser first sends a request to the DNS server in order to receive the necessary IP address. For more information on the topic, read our article âWhat is a DNS server and how does it work?â.
The further the DNS server storing your domain names and IP addresses is located from your target users, the longer it will take to process the request, which increases server response time.
What can you do? Place your domain names on the DNS servers that are closest to your clients and opt for a reliable DNS hosting service featuring many locations and allowing you to balance the server load.
5. Opt for another server
If you tried everything, and the server response time still leaves much to be desired, the reason may root in the server characteristics. Your current server might be unable to cope with such high load, and youâll need to switch to a server with higher computer performance characteristics.
Calculate how much storage space and RAM are needed for your website to function properly and check if your current server meets these requirements.
If not, switch to a hosting plan with higher capacity or even to another provider.
If your project is growing on a large scale, the resources provided by the common hosting services may no longer be enough for you. Then itâs time to transfer your project to the cloud. You can read more about the differences between these two kinds of services in our article âCloud vs hosting: which should you choose?â.
How to increase content loading speed
The smaller the page elements weigh, the faster they load. To speed up your website, reduce the size of all the files to a minimum.
But remember that size reduction shouldnât make the file quality much worse.
To maintain high content quality while speeding up your website, use modern data compression algorithms like Gzip, Brotli, and WebP.
These algorithms provide lossless data compression. They reduce element size significantly without affecting their appearance. These algorithms can compress files âon the wayâ while the content is being sent to the users.
Gzip is only capable of compressing text elements. The algorithm finds similar lines in a file and unites them, which results in 60â70% page compression.
Brotli works with all content types. It is based on the user browser dictionary that stores almost 100,000 most frequent phrases and text fragments used online. The algorithm finds new text fragments in the files and conveys only them to the user while replacing everything else with the elements borrowed from the dictionary.
This technology makes it possible to compress content up to 20â25% more effectively than Gzip.
WebP is an algorithm used for image compression. At present, it is used as an effective PNG and JPEG analog. WebP carries out lossless image compression up to 26% more effectively than PNG and up to 25â34% more effectively than JPEG.
The compression process goes in two stages:
- The algorithm tries to forecast the information block contents using primarily decoded elements.
- The algorithm encodes forecast errors and corrects them.
All the three algorithms are supported by the most popular browsers. Using them is a fine way of content load time reduction.
Gcore CDN not only supports these algorithms but can also compress files. While delivering content, Gzip works on servers whereas Brotli works with the origin server shielding. This means that you donât need to change compression settings or write code on your own. You can download the existing settings and code to the origin server, which will result in automatic content compression in the process of content delivery.
How to optimize page rendering
1. Place jĐ°vascript files at the bottom of the page. As mentioned above, the most important elements should be the first to load. JS files arenât considered as such.
The first thing that the user is supposed to see is the page content. It should become visible before the page loads completely. jĐ°vascript files can be pretty heavy, this is why they should be the last to load.
2. Hide the elements that are not essential for the mobile version of your website. Nowadays users browse many websites on their smartphones. Mobile devices have a weaker performance than desktop PCs. In case of unstable mobile Internet connection, website load time can increase immensely.
If you donât want to make your users wait for a long time, optimize the mobile version of your website and delete all unnecessary elements that can slow down your website operation.
Conclusions
- More than 50% of users close the website if it needs more than 3 seconds to load. Search engines rank fast websites higher. It is important to make your website function as fast as possible.
- Page speed depends on server response time, content loading speed, page rendering, and other factors.
- To reduce server response time, you can optimize database performance, cut down the number of requests, place domain names on DNS servers that are closest to your clients, and enable a CDN. If none of this helps, the existing load may be too high for your current server, and youâll need to opt for another server with a higher computer performance.
- To increase content loading speed, reduce the file size to a minimum. A fine way of doing so is using data compression algorithms like Brotli, Gzip, and WebP.
- To speed up page rendering, place JS files at the bottom of the page and hide the elements that arenât essential for the mobile version of your website.
- Using CDN not only reduces server response time but also enhances the serverâs fault tolerance. Enabling CDN is a fine way of optimizing website performance, especially if your network supports such convenient features as origin server shielding and data compression with the help of algorithms like Brotli, Gzip, and WebP. A proper CDN will also reduce the server load and help you optimize your content.
- With the Gcore CDN, you have all these functions. In addition to that, Gcore has over 80 locations all over the world, more than 5,000 peering partners, and an average worldwide response time of about 30 ms.
Test our CDN for capacity and reliability on your own or schedule a free consultation with our managers. They will help you select a plan that best suits your goals.