stories

Server frenzy, explained. What does one need to run a website, anyway? (pt. 1)

We all know there are servers involved. But what do they actually do? Here’s (almost) everything that you need to know.

Although it secretly caters to clueless project managers, this blog post is primarily meant for clients. It will make the whole server & infrastructure situation much clearer. Rest assured it is quite normal to not understand what’s under the hood of your future website. Having said that, it could benefit you immensely to at least have a general idea. The whole subject is crystal clear to web developers and utterly vague to everyone else, which makes it a bit of a trap. You could pointlessly dish out real megabucks if you go overboard with resources for no good reason. Or seriously cock things up if you do not set a project on firm-enough server foundations.

Servers & Types of Web Hosting

If your IT background is not strong enough (read this sentence as Cher would sing it), that’s ok. First, definitions of server and hosting. Boring but necessary, therefore bear with us. We opted for an explanation shorter than Wikipedia’s. That one is 1309 characters long. Ouch.

A server is a computing system that stores and distributes data among interconnected devices. It’s a central facilitator, managing requests and delivering resources efficiently over a network, in our case, the Internet.

That wasn’t so bad, huh? So servers are basic building blocks of the internet. Or nuts and bolts of it. Whatever analogy works for you, the internet as we know it will not work without them. Now, there are many types and they do very different jobs.

First and foremost, what you need is a hosting service. Yup, that too is some kind of a server. But how do we explain hosting simply? You are basically paying for a chunk of resources to store your website’s files and make them accessible on the internet. It’s like renting space on a server, and it’s important to choose the right type for your online product.

Now there are many types, and they fit very different needs in terms of performance and scalability. Here are the options one usually comes across, ranging from very basic setups to power user mega solutions:

Shared Hosting

This is one of the most affordable hosting options. The catch? Multiple websites can be on a single server, so heavy traffic or resource usage from one site may affect others. This is the way to go if you are super small, as shared hosting can handle up to 1000 visits per month (very low to low traffic).
Think blogs, portfolios, small business websites and the likes. This option is great for beginners, especially if you choose a shared hosting provider that offers reliable customer support.

Virtual Private Servers (VPS)

Unlike shared hosting, VPS gets you a dedicated portion of server resources. Now we’re talking! There are usually 10-50 websites per server, but VPSs are smart. If there’s extra capacity not used by others, VPS will use it to temporarily provide flexibility for handling increased demand at the other end.
The ability to handle up to 50000 visits per month makes it great for low to medium traffic.

Dedicated Private Servers

All yours, baby. A physical machine dedicated to a single customer with exclusive access to all server resources. It can handle up to 100,000 or more visits per month (medium to very high traffic). Maintenance can be done either in-house or by a hosting provider, and the number of websites on a server depends on your needs.
The point is you have full control over server configurations if you want to customize software, change security settings, etc.

Cloud Hosting

If it’s in the cloud, it must be awesome! Well, more often than not, it is. With multiple servers in multiple locations, the failure of one server means the workload is automatically shifted to others, ensuring consistent availability
Available from 1 to 100 CPUs and GBs of RAM, it allows for seamless scaling. You can define min and max resources and the cloud automatically adjusts them depending on your traffic and settings.
These setups can handle anything from 0 to 1.000.000+ visits per month (both very low and very high traffic)
The usual setup is one site per hosting (you can have more, but it’s not a good practice). Cloud solutions often offer automated backups and robust security features. These tend to be pricey but pack a serious, scalable punch.

Kubernetes

This is a solution most often used by power users with serious traffic. These are not the people who read blogs in order to find out about server types, but for the sake of being thorough, let’s explain what it’s made of. Kubernetes is an open-source container orchestration system for automating software development, scaling, and management.

What the duck are containers, you’ll ask, and rightfully so.

They’re software packages that include everything needed to run a piece of software, including the code, runtime, libraries, and system tools)
Able to handle 1.000.000+ visits per month (High to Very High traffic), these solutions are ideal for enterprises and startups with complex and scalable applications, cloud service providers, Software as a Service (SaaS) providers, etc.

Kubernetes has many fancy features we should not explain in length since those that use them have specialists that handle the whole thing.

Content Delivery Network (CDN)

There are some cases where physical distance between content and users starts presenting problems, especially if speed is of importance to you. We do not want to have that Australian guy wait too long for your Greenland based content, heh? A bit oversimplified, but that is the general idea here.

So CDN is a network of distributed servers strategically placed worldwide to deliver static content, such as images and videos. Original source content is copied to multiple servers around the world and waits to be delivered locally, fast.
This is ideal for websites with a global audience. Or when you want to offload your server (eCommerce businesses, media companies, news and publishing organizations, online gaming platforms, etc.) However you put it, these are serious systems for serious needs.

Web Servers

Oki, so after some basics about different hosting types, it’s time to tackle web servers. They function as dedicated hosts for websites and web apps, handling HTTP requests and delivering content to users’ browsers. Basically, these bad boys are not here to store but to do the work. Whatever you click or tap on the internet, somewhere out there is a machine that understands what you need, turns the gears and levers and delivers it to you. There are many types which operate quite differently under the hood, but more or less do the same thing. Here are some examples:

Apache HTTP Server

This is one of the most common types. It is used for both static and dynamic solutions and is well suited for smaller to medium-sized websites. Able to handle tens of thousands or a few hundred thousand visits per month (low to medium traffic, Apache works well with various operating systems (OS).
It offers lots of modules for customization and can be tailored to your specific needs, whether it’s about handling specific types of content, improving security, integrating with other software, etc.
The caveat is it can be slower under heavy load and tends to use more memory and more Central Processing Unit (CPU) resources compared to some other server options.

Nginx

A somewhat beefier option, Nginx (man, does this name sound like the name of a villain in a Marvel franchise) is used for a wide range of websites, including static, dynamic, and content-heavy sites.
It is capable of handling a broad range of traffic (from tens of thousands to millions of visits per month), it excels at serving static content (images, stylesheets, scripts).
This setup is often used as a reverse proxy, managing incoming requests on behalf of backend servers. Oftentimes used as a load balancer, it is good for maintaining consistent performance. Designed for efficiency, Nginx needs less memory and CPU power compared to some other web servers, making it resource-friendly.
It has fewer modules than Apache.

LiteSpeed

Good for high-traffic websites as it is known for its speed and resource efficiency, LiteSpeed is commonly used for improving the performance of CMS solutions like WordPress and its peers. It is optimized to execute PHP swiftly, resulting in more efficient operation of PHP-driven websites and apps
As for the cost, it’s a commercially licensed web server which means users need to pay for a license to use its advanced features. Life as we know it is subscription based, so what can you do?
There is a tiny catch: compared to Apache and Nginx, it has a smaller user community. This could haunt you in terms of smaller support forums, community-driven plugins, and shared knowledge among users.

HAProxy

Primarily used for load balancing, this baby is designed to distribute web traffic across multiple servers to prevent overload.
This is useful for websites with varying levels of traffic; ideal for those with a fluctuating number of visits. From zero to hero and vice versa, that sort of thing.
Used for high availability, HaProxy ensures that web services remain available and responsive even if individual servers fail. Stable and reliable in managing traffic, its configuration can be complex, but this is justified by the advanced features and customization options at your disposal.
It doesn’t provide the full functionality of a comprehensive web server, so you may need to combine it with other tools to get a complete web server solution.

Traefik

Designed as a modern HTTP reverse proxy and load balancer, it ensures that incoming web traffic is efficiently distributed across multiple servers or containers. This optimizes resource usage and prevents individual servers from being overwhelmed.

What’s special about this one is that it was tailored for websites and apps deployed in containerized environments, like Docker and Kubernetes. It’s well-suited to manage web traffic in dynamic and scalable setups where apps are deployed in containers (standalone units that hold everything an app needs to run)
Able to handle small to high-volume traffic, Traefik can automatically adapt its settings when you add or remove services without requiring manual intervention. Smart puppy. Less mature compared to Apache or Nginx, it has fewer features or a shorter development history and is primarily focused on containerized environments.

IP & Subnets

IP Addresses

This is the part that you are not very likely to ever need in your lifetime, but it can’t hurt to understand a few basics. You’ve heard about it thousands of times but never delved deeper into IP addresses. KK, we’ll break it down for you now.

IP Addresses are numerical labels assigned to devices on a network, like a home address for computers. They consist of four segments, each ranging from 0 to 255 (0.0.0.0 - 255.255.255.255), giving us a total of 4,3 billion different possibilities. Oh, shoot. That doesn’t sound like enough, does it? It is not. This naming principle is called IPV4, it is old and obsolete and it is a major problem nowadays, with a gazillion devices out there. And each needs an IP.

Binary - 11111111.11111111.11111111.11111111 - this is the binary representation of an IP address- Each “1” or “0” translates into a 32-bit representation of an IP address. Understanding this representation might be beneficial when you need to troubleshoot network issues, configure network devices, etc. Not understanding it will not leave you so much the worse for.

0.0.0.0 /8 - Current network - this is a special space representing the current network

10.0.0.0 /8 - Private Network - This range is often used in internal corporate networks

127.0.0.0 /8 - Loopback - this range is reserved for loopback addresses, commonly used for communication within the device itself

172.16.0.0 /12 - Private Network - This range is reserved for private networks, often used for larger networks within organizations

192.168.0.0 /16 - Private Network - This range is used for private network space, allowing for a large number of devices in smaller networks. This is most likely what your home network naming looks like, the one with your IP router and your smartphone in it.

255.255.255.255 - Broadcast address - this is reserved for broadcasting messages to all devices on a network, it’s the highest possible address in the IPv4 address space

Ports

If IP addresses are digital home addresses, then ports are like the doors inside of the same building, each door for a separate service, allowing different applications to send and receive data. They enable organized communication by assigning unique numbers (from 0 to 655525) to specific services or processes, such as web browsing (80 for HTTP and 443 for HTTPS), mail services (25, 110, 143, 465, 993, 995), or Secure Shell known as SSH (22). When a properly functioning connected device has trouble talking to the network, there is a high chance something is messed up with the ports.

See that? The main culprit of our connectivity frustrations now has a name. Cool.

Subnets

Subnets are used to separate large networks into smaller, more manageable parts, making it easier to manage and control how data moves around.

Segregation enables segregation (never would have guessed it, huh?), meaning users in one subnet can’t see users in another subnet, which improves network security and efficiency.

Subnet Mask defines how many bits are reserved for the subnet and how many remain for IP addresses. For example, in the notation “/24”, 24 bits are assigned to the subnet, leaving 8 bits for IP addresses.

Switches

Switches are devices in computer networks that efficiently manage and direct data traffic. They’re essential for creating local area networks (LANs) and optimizing the flow of information within them.

Routers

Routers are devices crucial for dividing and connecting different networks or subnetworks. They play a vital role in managing the flow of data between private and public networks, ensuring that information reaches its intended destination.

Conclusion

There it is, the basics of servers. And some other related things which we’ve put here because we believe you need to know about them. We believe it so much and with such passion that we are preparing part 2 blog of this infrastructure series that will, with equal clarity and brevity, explain the basics of domains, DNS, SSL certificates and databases. Everything a curious client like yourself strives to know more about. Right?

DT / February 29, 2024