Server and website speed is important regardless of what you're hosting or who for. As well as ensuring a pleasant experience for you and your users, it can impact your search engine rankings. This guide is designed to cover the main factors that could be affecting your website performance and how to address them.
Hardware is the aspect of server performance that gets the most attention, and for good reason. Insufficient hardware or poor allocation of hardware resources is one of the most common reasons users experience slowdowns on their server or website. There are generally two important components for server performance:
Every program on your server will use RAM, some just a little, and some massive amounts. If a program or service is using too much memory, the server may be unable to process requests in an orderly fashion, particularly if you have an unexpected surge in traffic.
The speed of some tasks can be significantly affected by processor speed and core counts. While simple web pages generally do not require much CPU power (two cores for a small site is fine), tasks like game server hosting, or dynamic websites with lots of database lookups or heavy media use will start to experience issues if your CPU specs are not up to par.
While disk input and output (I/O) isn't much talked about, it is an important part of hosting. Disk I/O determines how fast scripts on your server can carry out input and output operations – a low I/O speed therefore will mean a slow website or service, regardless of your CPU or RAM. Thankfully, most modern VPS servers meet these requirements. However, if you are hosting at home or on a shared cloud hosting plan, it may bear investigating.
The bandwidth of a server determines how much data it can transmit at once. As you can imagine, if your server has thousands of people connecting to it at the same time, the bandwidth requirements can be intense, and servers with a bandwidth "cap" may begin to struggle to transmit data to all clients at a reasonable speed. This is particularly true if it is transmitting media-heavy content. As a result, it is important to host any serious service or website on a VPS at a high-capacity data center rather than at home or on a shared plan.
Server location and latency
Even with fibre optics, data can only travel from your server to other clients so fast. The further away a server is from you or your customers, the more latency there is going to be and the slower it is going to be.
There are other things that affect latency too. Network conditions between the browser can have a big impact, including the number of "hops" the data needs to take, the quality of the physical infrastructure between the two locations, etc.
This is part of why dedicated data centers are important. They are connected (at least in their immediate vicinity) to high-quality infrastructure.
If you are loading a lot of dynamic content, database speed can have an impact. If the database is slow, the page or application may have to wait for a query to run and retrieve the data, which can take a while if the database does not have many resources available or the request is heavy. Some pages and tasks may have to wait for the answer from the database before they load.
Encryption and security
SSL and TLS adds overhead because it has to encode and decode content. This overhead is usually quite minimal, but if you are already experiencing issues in other areas, it could push it over the edge.
Of course, it is not a good idea to forgo encryption, so there is little you can do about this.
Content delivery networks
CDNs are generally excellent at speeding up a website or application's page load time. They have multiple high-quality servers in multiple geographic regions, and requests can be routed through these, which are typically closer to the end-user.
However, CDNs can also have issues, particularly if they are low-quality ones. They ultimately create new points of failure and resources are also shared between customers. If another CDN customer has a surge in traffic, it could affect the speed of your service. A CDN's servers also may not be located in the ideal place for your customers. A CDN with servers primarily in North America is not going to be much help to you if all of your customers are in Europe and may just make things worse.
Domain Name System Servers translate the domain name you type into your browser into an IP address that a computer can understand. However, just like any servers, DNS servers can experience slowdowns or outages. If a DNS server takes a long time to process your request, the website will take a long time to load or not load at all.
There is a chance that your sever or website slowdown is a result of a DDoS attack by a competitor or angry user. DDoS attacks are very simple to carry out, and usually consist of sending thousands of requests to a server that it must dedicate resources to, slowing the service down or causing it to stop loading entirely.
Your server has been compromised
Though it is unlikely if you have implemented the proper security, there is a chance your server has been more seriously compromised. A malicious party or program may be running its own tasks on your server that leave it with few resources to serve you or your users.
How to diagnose your server slowdown
Naturally, you will want to get to the root of your server or website issues before implementing any changes. There are several tools at your disposal for this:
Sites like ping.pe allow you to test the route from your server to client PCs using the ping tool. It allows you to assess delays to different regions to determine whether there are issues along that route.
You can also perform an mtr test, which combines traceroute (recording the route a packet takes to get to its destination) and ping. It is useful for determining problem areas within a network or wider network infrastructure.
Monitor your server
Server issues can be identified quickly through the use of server monitoring tools:
- Top or HTtop: allow you to search out memory/CPU-hungry processes
- Netstat or Tcpdump: Let you monitor your incoming and outgoing TCP traffic, routing tables, network interfaces, and protocols.
- Iotop and Iostat: Help you to determine CPU and I/O usage to determine bottlenecks there.
You can read more about the best tools for Linux server monitoring in our dedicated guide.
If you are a BitLaunch customer, you can also monitor your server's CPU utilization, disk IO, and bandwidth in your server control panel.
If you are in control of multiple servers, manually checking these monitoring tools on each server may not be feasible. For this reason, we recommend Cockpit, which will provide a web UI for a clear overview of problems in various areas across multiple servers.
Check your traffic stats with Matomo or Google Analytics
Sometimes being popular is costly. Hooking your website up to Google Analytics or our recommendation, Matomo, will allow you to assess whether you are experiencing unusually high traffic. Though there are still steps you can take to optimize your server if it is experiencing increased traffic, upgrading your server will usually be necessary sooner rather than later.
Check and manage your logs
Server logs will help you to identify whether processes are misbehaving, if there is a user performing malicious tasks on your server, and more. Linux servers keep a multitude of different logs that can be used to diagnose various issues. If you suspect malicious activity, you should especially check the authentication logs, which will show you who logged in, when, and from what IP address.
However, you should make sure that you aren't keeping logs for too long, as this process can use valuable SSD space and other system resources.
How to speed up your website/server
There are dozens of ways to optimize and fix your server. Which mitigations are necessary for you will depend on the issues you have identified in the previous steps, and we cannot provide recommendations for all of them in this blog (though our customers can always reach out to support). That said, here are some of the actions that most commonly lead to improvement.
Remove unused applications and plugins
It is easy to install a WordPress plugin or other application on your server, use it once, and then forget about it. Over time, these can add up, take up storage space, and hog server resources that could be used for more important tasks.
We recommend checking your server every few months to ensure that you are only running the applications and plugins that you need for it to function.
If you have noticed floods of certain packets, such as TCP SYN-ACK, ICMP, FIN, etc., then you should think about whether your server is experiencing a DDoS attack and consider implementing DDoS protection. While most VPS server providers ask you to pay extra for this, BitLaunch includes DDoS protection for free on all of its first-party servers.
Optimize your website/application
Sites like PageSpeed Insights will highlight factors that are negatively effecting your website performance and give you suggestions on how to improve them.
One of these is using caching, which will store a copy of a page for reuse rather than serving it fresh each time. Other improvements could include minimising or optimizing stylesheets and fonts, minimizing HTTP requests, reducing the sizes of videos and images, etc.
Use a CDN
As CDNs have a large network of high-capacity servers across the globe, they are able to distribute content from a location that is closer to the user, reducing ping and load times. CDNs like Cloudflare even have a free plan.
Increase swap space
Swap space is a space on your SSD that is reserved for instances where your server does not have enough RAM to hold an application in memory. If your server is frequently running out of memory, following our guide to increase your swap space may help, though it is worth noting that using swap space to hold data that should be in RAM is still significantly slower. Ideally, you should be looking to upgrade your server ASAP. Swap space is a band-aid to stop issues like crashing or data loss that could lead to more slowdowns than using swap space.
Optimize your database performance
Database optimization could be a whole new guide (and we may even write one, in the future). The short of it is that while the best way to improve database performance is to increase the resources it has available, there are other optimizations you can make. For example:
- Look at which frequent queries have a large impact on query execution times and optimize them using a query optimizer or outsourced database expert.
- Improve your database's indexes. A strong index means better organization of your data and therefore allows the server to find what it is looking for faster.
- Defragment your data, allowing relevant data to be grouped together and therefore retrieved more quickly.
Upgrade your server
Most slowdowns can be solved by increasing the resources available to the server. However, it is important that if you have underlying issues, you try to find and address them first. You don't want to have to upgrade every month or due to a spiraling technical problem.
The sad fact is that a lot of web hosts and server providers prioritize a low price over performance. This is understandable, as most consumers just want to host their service as cheaply as possible. However, if your website or server is frequently performing poorly or experiencing disruption, it's time to ask whether you're losing more than you're saving. This is particularly true when you are on a shared hosting plan, as you'll be sharing resources with other customers in your server block.
BitLaunch provides its customers with fast and secure servers whose performance is not affected by other customers. Feel free to sign up here and talk to our support for a free trial.