Time is the most valuable human asset, and when combined with user impatience, it can be a dangerous threat to your website. Research conducted by Akamai shows that 47% of users expect websites to load quickly and in just a few seconds. This issue is so serious that according to estimates, if the Amazon website loads one second late, about 1.6 billion dollars in profits will be lost! Also, according to Pingdom research, about 78% of the top 100 shopping websites in the world are loaded in less than 3 seconds. Finally, it should be noted that search engines also consider speed very important. There are many reasons for the slowness of your website and the issue is more complicated than one article, but in this article we are going to point out the most important reasons for slow website speed.
Table of Contents
Images without optimization
Images and videos occupy the largest volume of a web page. On the other hand, novice webmasters think that by uploading HD images to their website, they attract users, while very high quality images are large in size, so they consume a lot of bandwidth (both from our server and from the Internet). user) and naturally it takes more time to download them.
The use of high-quality images (HD or 4K or 8K, etc.) is allowed only for websites that work in the field of graphics and images (websites for downloading stock images, downloading wallpapers, etc.), but in this type Websites also have special rules and we should not upload all images at once. In addition, if the desired image must be displayed in a small space (for example, 300 x 100 pixels), you should not use images larger than this format (for example, images with 1300 x 500).
Of course, the chosen format for images is also very important. For example, JPEG images are usually smaller than GIF or PNG images, because JPEG is an optimal format and using it reduces the site’s loading speed. Even the new webp format is more optimal than JPEG and it is recommended to use it if possible.
Java Script
In modern web design, our need for JavaScript is greater than ever, so the possibility of overwriting it is also higher. There are various factors that can increase the download speed of our JavaScript files. In short, the following points can be mentioned in this context:
- Avoid using old libraries like jQuery. Today’s JavaScript alone can do the work of these libraries.
- Use JavaScript libraries only when needed. For example, you should not use a complete package like lodash just to use a specific function.
- Defer JavaScript loading on your pages to the end and make sure it’s async.
Too many HTTP requests
Another important issue of low site speed that is usually ignored is the number of HTTP requests. Your browser sends a separate HTTP request to the server to download each site file. Apart from the fact that this causes the server to be involved, it should be kept in mind that it also increases the site loading time for the user. It is recommended to reduce the number of files on your website as much as possible. For example, using tools such as webpack, convert your JavaScript files into a large file, do this with CSS files, and do not neglect operations such as minification.
Lots of ads on the site
Everyone knows that displaying ads on a site causes the site to slow down because these ads are usually presented in the form of images (especially GIF images, which are very large). In addition to increasing the volume of your website, these images also increase the number of HTTP requests and, of course, disrupt the user experience (UX).
Not using Cache
Browser caching is one of our trump cards as developers. As you know, when the user visits our website for the first time, all JavaScript and CSS files are saved in the browser for a certain period of time so that there is no need to download these files in the next visits.
If you do not use WordPress websites, you should use Cache-Control and Entity tags (the same as ETags) to cache the site content. ETags determine whether the target user has the latest version of a file or not, while Cache-Control is responsible for enforcing cache rules on the server and browser. Therefore, by combining these two items, we can determine whether the user has already downloaded a file or not, and in this way, we prevent downloading the same file multiple times. Naturally, this greatly increases the loading speed of the site.
If you use WordPress websites, it is better to use caching plugins to increase the speed of your website. The WP Rocket plugin is one of the most famous plugins in this field, which also performs other tasks such as lazy loading and cleaning the database and similar tasks.
Paralysis of server and database
It should be noted that your website receives various requests per day, but the number of these requests must match the type of your server. For example, if hundreds of thousands of requests are sent to your servers daily, using a server with limited RAM (for example, 1 GB) or a weak CPU will cause severe server conflict and reduce the loading speed of the website. The same goes for your database. If your server’s hard disk is an HDD type but has to process a large number of requests, you will have a big problem. It’s always better to spend a little more and use servers with NVME hard drives. By doing this, in addition to improving the performance of the database, you will also increase the overall performance of your site because reading files from disk is much faster.
Geographical location of the server
What country are your target audience in? If your target audience is Canadian, then it is better to use servers that are in Canada. Why? Because the physical distance of the server from the users has a great impact on their access speed. People who have talked on the phone with another person abroad know that there is a long delay in sending and receiving messages because the information must physically travel the distance between you and the person abroad, and naturally, whatever the distance if it is more, this interruption will be more. The same thing happens when you are on the Internet. For example, if a user from Sweden connects to your website and your server is in Canada, the request from Sweden must reach Canada, and then the response from Canada will return to Sweden.
Not using CDN for international websites
By international websites, I mean websites whose target audience is international and not from a specific country or geographic region. In this case, choosing a server in any particular part of the world will cause a drop in speed for users in other countries. In such a case, using a CDN is the best solution. CDN stands for content delivery network and means “content distribution network”. In simpler words, CDN is a network of servers that are located in different parts of the world (different countries) and deliver your website content or files to users faster.
Therefore, if we want to summarize the contents of this section, we say:
- If your website works at a local and regional level ,you don’t need a CDN.
- If your website is not very large, you probably don’t need a CDN.
- If your website receives its traffic mainly from one country, you don’t need a CDN.
If your website is not one of the above, you will not need a CDN.
Social media script
As you know, social networks are a big part of our lives and it is very important for internet businesses to work with these networks and have an active presence in them. Many webmasters use scripts provided by these networks to communicate between their website and social networks to display their posts on their website. This is not wrong at all, it can be a great marketing opportunity, but injecting too many of these scripts will increase the number of HTTP requests and can cripple your website. Imagine you have accounts on Twitter and Facebook and Instagram and LinkedIn. Placing the scripts of all these networks on your website will slow down the site.
Note: By “script” we mean JavaScript codes that take your posts from the API of these social networks and display them on your website. Placing links to your accounts (for example, your Instagram account link) is not included in this discussion and has no effect on your website speed.
Old version of CMS and back-end language
CMS or Content Management System are content management systems and everyone is familiar with them. Famous examples of CMS are WordPress, Joomla, and Drupal. Many websites, use CMS, but due to the trouble of updating them, they are often not updated. Not updating CMSs will slow down your website in addition to security issues. This is also true for your back-end language. If you’re using PHP for your back-end but don’t update it to new versions, you’re missing out on all sorts of optimizations and speedups, so try to keep everything up to date.