Have you been wondering how do servers work? I’m sure you’ve heard of the ever-increasing importance of web servers in today’s technologies. Servers are used to deliver cute cat images while other servers publish updates to mission critical rocket science software. No matter the use, the hardware, software, and location of the machines are very much the same.
Servers are everywhere. Every web page (yes, even this one), every app, and every digital image you browse on the internet gets stored on a server and delivered to you using server software. Let’s do a thorough analysis to see exactly how do servers work and why the work of servers is important.
A web server’s work is important because it transfers data from one location to another. Every web page you load, every online game you play, and every video you stream on Netflix is because of the work of a server (or more commonly, many servers). I’m sure you’ve heard of some website servers being “down” or having server outages. This results from when a server doesn’t do its job or incorrectly configured and doesn’t work properly. When this happens, you can no longer access the resources being served. This also means no more cute puppy GIFs from Reddit…ah! But there are professional server admins (typically called system admins or sys admins) whose job is to configure the servers and keep them running smoothly. Sys admin’s have their work cut out for them. New data breaches pop up every day and the attack vectors become larger all the time. This makes it critical for server admins to keep abreast on the latest technologies to help keep their servers running at their full potential securely and efficiently.
Let’s discuss what happens when you navigate to a webpage such as https://evergreentech.io. When you type that in your browser’s address bar and hit return you are making a request for particular resources so you can browse the EGT homepage. Your request gets sent over the internet to the server (or group of servers in this case). The server receives your request along with the equivalent of a return address on an envelope so it knows who to send the response to. The server’s job is to parse the request, which includes checking if the requester has permission to access the resource being requested and gathering data that gets sent back to the requester. Once the server validates the request and gathers the information being requested, it triggers a response which gets sent back to the requester (via the return address). The server’s work includes keeping track of which resources are being requested and by whom. Once your computer receives the response from the server it is the browser’s job to take that information and put it into a pretty web page for you to browse.
This process continues cyclically until the server delivers all requested resources and the server’s work is complete. Some systems have a polling method, which pings a server periodically to get data updates. Other systems have a push system which allows the server to push information to clients, but a typical request-response server workflow functions like this:
So a server is just a computer with memory, processor(s) and disk space, right? Well, yes, but also no. While it is true servers have all the standard components of regular desktop or laptop computers, they use specialized components crafted to run continuously with high network throughput and redundant hard disks setup in RAID arrays. Servers are typically more expensive than desktop computers or laptops and come in all shapes and sizes. Although, there is a standard size of servers that do their work inside a server rack. A server rack is a big, heavy, metal box that holds multiple servers. We measure servers in standard units labeled 1U or 2U. The units are for the number of horizontal rows the server takes up in a typical server rack. So 1U consumes the space of one row while 2U consumes two rows. Here is a single 1U server that would go in a typical server rack:
In most enterprise-grade web servers, the components are hot-swappable. This means if a hard drive goes bad you can leave the server running and swap out the dead drive with a fresh one without skipping a beat. Same for power supplies, which are the two most common failures. Since servers do their work continuously without being turned off every night, it’s imperative we can work on servers without having to shut them down or take them offline.
There are many distinct types of web servers that you can purchase or rent online. Almost all of them use the same underlying hardware we saw above. With modern virtualization technology, they all behave a little differently. Let’s review some of the most common types of servers and the work they do.
A dedicated server provides the owner with full and dedicated access to all of its components. This means none of the resources get shared with other clients. Hospitals and environments that store personal information such as health records or banking details typically deploy dedicated servers to keep their customer’s information safe and sound. Some web hosts offer dedicated servers to help their customers be HIPAA compliant.
A virtual private server, or VPS, provides the client with a segment, or piece, of a dedicated server. This is the best of both worlds, with the cost savings of a shared server and the dedicated resources of a dedicated server. For example, if a web host has a dedicated server with 64 GB of ram and 1 TB disk space and a quad-core CPU they can create two VPS’s each with 32 GB of ram, 500GB disk space, and two CPU cores. The two VPS’s technically run on the same machine hardware, but the virtual isolation allows them to do the work of two separate servers.
Shared servers typically share ALL resources. We only recommend shared servers as temporary solutions or to serve very light websites. These types of servers share the memory and processing power with other tenants on the same physical hardware. Sometimes, if a tenant on the same shared server has a post go viral or they get a lot of traffic, they will consume most of the resources and can slow down your website drastically. The only benefit to shared web servers is they are cost effective, often costing under $10/mo.
Now that you know the various kinds of servers, what they look like and what kind of work servers do, it’s time to dig into the fun stuff: server software. There are several software packages that power web servers. We’ll discuss two of the more popular server software that powers most of the websites we browse every day. Apache and Nginx serve over 70% of the websites around the globe. That’s a lot of responsibility!
Apache is an open-source software developed and maintained by an open collective of individuals distributed across the globe. Apache is solely responsible for powering roughly 40% of the websites around the world (as of this writing). Apache uses a process-driven architecture in which it creates a new thread for each request being made. Because of this process-driven approach, Apache can be a bit of a resource hog on more popular websites which needs to serve many users connecting concurrently. Using CDN’s and other caching techniques are helpful in these situations and make Apache-based servers able to handle larger workloads. Some of the most popular websites in the world are powered using Apache software. These include tesla.com, ny.gov, nordstromrack.com, homedepot.com, and squarespace.com, to name a few.
Apache’s little brother is Nginx. It serves around 32% of the websites around the world. Nginx uses an event-driven architecture and handles multiple requests in a single thread. This allows it to be more performant while utilizing fewer resources. It can handle a larger number of concurrent requests on servers with fewer resources as compared to Apache. Nginx falls behind Apache in the modularity department. Nginx doesn’t lend itself well to custom add-on modules while Apache does. In conjunction with Apache, Nginx often functions as a reverse proxy server. Some big names in the server space use Nginx including Netflix, Pinterest, Dropbox, Instagram, and more.
Because of the amount of bandwidth servers require to carry out their work, it’s typical for servers to exist in one large data center with a large network pipe (often 100 Gbps or more). These data centers can have hundreds or thousands of server racks and tens of thousands of rack-mounted servers. These data centers are secure with very few people having access. The rooms are temperature controlled to an extreme, usually with redundant air controller units! Similar to your laptop or desktop computers, the servers produce a lot of heat that needs proper airflow and cooling countermeasures. The data centers are in strategic locations across the world to provide the least amount of latency possible.
This concludes our guide of how do servers work. To recap what we’ve learned:
If you have any further questions about how do servers work, please drop us a line and we’ll be happy to help.