Technology

How to choose the right server for a website or application?

Paweł Lipka
7 min read

A server and server infrastructure, also known as hosting, allows for the publication of applications or websites on the internet. How do you choose one to ensure everything runs smoothly? Read this simple guide where I’ve used comparisons to illustrate complex IT concepts.

What is a server?

A server is a computer that ‘serves’ your data to people using your application or website. You can think of it as a waiter in a restaurant, bringing food to your table.

What are the types of servers?

  • Web Server (e.g., nginx, apache, IIS) – acts as an intermediary between the application and the client. It receives requests from users and directs them to the application on the server. It can be compared to the doors of your restaurant – controlling who enters.
  • Application Server (e.g., php, node.js, python) – a platform that runs application code, handles requests from the web server and responds to them. It’s like the chef – processing requests and ‘cooking’ responses.
  • Database Server (e.g., mysql, postgresql, mongodb) – stores data used by the application. Referring to our restaurant analogy, these are the ingredients for the offered dishes – all the data.
  • File Server – a place to store data, which can be an integral part of the application server or a separate service, like Amazon S3. It’s like a cabinet where you keep various items, like photos or videos.
  • Queue Server – allows for asynchronous processing of tasks, increasing efficiency. It’s like a waiting list in a restaurant. When there are many guests, it helps serve them in order.
  • Cache Server (e.g., redis) – stores frequently used data to speed up access. It’s like a menu with popular dishes ready to go, speeding up the whole process.

To fully support an application, you need at least three of the above servers. However, depending on the specific requirements of the application, there might be more (if the application has specific requirements or offers specific capabilities).

What are the types of server hosting?

  1. Shared Hosting – the simplest solution for small projects. Server space is shared with other users, limiting performance and configuration options. It’s like renting an apartment with many roommates. Cheap, but with significant limitations.
  2. Dedicated Server – you have full control over the physical hardware, providing great flexibility. It’s like having your own house. Full control, but also full responsibility.
  3. Virtual Private Server (VPS) – a portion of a physical server’s resources but operates as an independent unit. It’s like living in an apartment building. You have your own ‘space’, but you share the building.
  4. Cloud – services are provided by a cloud provider, offering various configuration options. It’s like renting a room in a hotel. Flexibly tailored to your needs.

The cheapest and most limited is shared hosting. On the other hand, the most expensive and flexible is the cloud. A dedicated server will cost you the most in administrative work. On the other hand, the least would be shared hosting.

Server Security

When choosing a server, security is a key criterion. This includes protecting the server, application, and stored data. Main threats include:

  • DDoS Attacks: Can block application operation. When choosing a provider, it’s worth looking for one that offers DDoS protection. If not, we must provide it ourselves.
  • Break-ins: Threaten data theft or malicious software installation. Protection can be ensured independently, especially on dedicated or VPS servers. However, a good provider should also assist in this matter. Check if the software is updated, if SSH keys are used (instead of passwords), and if the connection used to transfer files is encrypted (preferably via SFTP/SCP/RSYNC).

Additionally, it’s good to have the option to set up a firewall through the hosting management panel. For shared servers and some cloud ones, it’s also important to easily add an SSL/TLS certificate. If the provider doesn’t allow for independent certificate installation and charges extra for it, consider other options (disqualification).

Server Scalability

With increasing traffic and application development, it’s essential to ensure smooth operation and keep up with growth.

  • Shared hosting is essentially not scalable. If your application starts gaining popularity, consider switching to another server type quickly.
  • Cloud solutions are the easiest to scale, allowing for automatic resource addition/removal depending on server load.
  • Scaling VPS and dedicated servers is essentially a similar issue. You simply purchase and launch another server as needed (assuming the application architecture allows it). For VPS, there’s also the option of vertical scaling, i.e., switching to a larger VPS, which requires downtime. PS. Make sure your hosting provider offers this option.

When should you consider switching from VPS/dedicated server to the cloud or vice versa? It’s best to calculate all costs – the server itself, application administration, server or cloud administration, the possibility of automating some operations, or scaling speed (e.g., the cloud scales much faster than any other solution).

Load Balancing

It occurs when using more than one application server. It’s like waiters in a restaurant, sharing customer service.

Important parameters, besides price, are bandwidth and the number of server requests (requests) that can be handled. You can rely on solutions provided by the host or use your own (for VPS and dedicated servers). In the cloud, it’s best to use the cloud solution.

Backups

Losing data due to failure or break-in is a significant hindrance to our business, and in extreme cases, its end. To prevent unpleasant surprises, it’s essential to back up our data and keep it in a safe place. Depending on the nature of the application, we should back up data at least once a day, and with significant traffic, even more frequently – even hourly. Less often – once a week or only when changes are made, you should back up the server/cloud configuration. Shared hosting usually offers data backup for 14 to 30 days, sometimes up to 90. Lack of backup or less than 14 days is a reason to resign from such a hosting provider. For VPS servers, the provider sometimes offers backup in the form of an image of the entire server. It’s worth considering using such a backup, as long as it doesn’t generate too high costs. However, if we need to back up more frequently than once a day, it’s best to use our solution. With a dedicated server, we basically have no other choice and must take care of backups ourselves. Cloud solutions usually offer us this service – but we must remember to activate and configure it, as it often isn’t enabled by default (sometimes it works automatically for selected services, e.g., databases).

Hidden costs

  1. Hidden fees: Don’t be fooled by low prices in offers. Check data transfer limits and costs for exceeding them.
  2. Additional services: Features like daily backup or load balancing can generate additional costs.
  3. Cloud solutions: If you choose cloud hosting, determine the scope of file access (locally, continentally, or globally). This will affect the price.
  4. Cloud fees: Cloud services have many price components that can be complicated to estimate. Regularly check bills to know what generates costs.
  5. Administration: Remember the costs associated with management. Cloud, VPS, and dedicated servers have different skill and work time requirements.

Location

It’s important to consider where the data center (DC) hosting our server is physically located. For application performance, bandwidth and response time are crucial. The latter, in particular, is a derivative of physical distance, as it depends on how many kilometers of fiber optics and cables the information has to travel. It’s best to use a DC located in the country targeted by our application or in a neighboring country if we have a good connection with it (for Poland, this would be DCs in Germany). It’s also essential to consider legal issues, such as GDPR – when using a service provider from the EU territories, we can be fairly certain they meet the requirements. However, if we want to use a provider from outside the EEA, we should check if they have what’s known as GDPR Compliance.

Summary

Choosing the right server for a web application or another online application is a key aspect of a project’s online operation. There are several types of servers, including web servers, application servers, database servers, file servers, queue servers, and cache servers. To effectively support an application, it’s necessary to use at least three of these. Server types include shared hosting, dedicated server, virtual private server (VPS), and cloud, each with different cost, administration, and flexibility levels. Security is a priority, with threats such as DDoS attacks or break-ins. Scalability is essential as the application grows, and different server types offer various scalability levels. Load balancing is crucial when using multiple application servers. Backups are vital to protect against data loss, and hidden costs can arise in the form of additional fees and services. The location of the data center is significant for application performance, due to bandwidth and response time. When choosing a server, it’s essential to consider all these aspects to ensure optimal performance, security, and cost-effectiveness.

Paweł Lipka
DevOps / Backend Developer

Let’s talk about your project