This is a continuation from my post, “A Very Basic Primer on How the Web Works”. I mentioned about how what a server is, and how servers play a part in the display of web pages on a person’s screen. I thought I’d like to expand on the types of servers there are, and how they work differently.
In my previous post, I gave the analogy of real estate when explaining what web pages are. I mentioned that the server is a remote computer that allocates “server space” to a website.
What I didn’t mention is that there are two categories of servers.
Note that the terms “server” and “web server” are used interchangeably in most cases. I will just stick with the term “server” to ensure consistency in this post, unless there are special exceptions where I need to explain what a web server is.
The two types of servers
Technically speaking, there aren’t two “types” of servers – just what form they take.
A server can refer to 1) hardware or 2) software. In some cases, both hardware and software servers are used simultaneously.
2. Software –
In a software context, a “server” is any application that runs most or all of the time, controlling how web users access files hosted online. Think of them as guardians-of-the-application, and they never need sleep. They perform requests as and when you need them. There can be hundreds of servers (usually called “services”) running at the same time.
One example I can think of is an HTTP server. An HTTP server is a piece of software that understands URLs and HTTP. When a user wants to access a domain, the browser will request a file via HTTP (a protocol). When the request reaches the correct physical server (hardware), the HTTP server (software) sends the documents to the browser via HTTP.
Who provides hardware and software servers?
For physical hardware servers, companies like Dell, HP, and IBM have been in the business for many years.
On the other hand, Amazon AWS, Microsoft Azure, and Google Cloud are companies that provide software servers. For smaller scale companies, some would reference Heroku as a favourite.
Could I be using both a hardware and software server at the same time?
Most definitely! In fact, they are often used together. In one of the previous questions, I mentioned about the HTTP server. Remember how the request has to reach the correct physical server (hardware)?
In a way, software servers are implemented on hardware servers (e.g. physical servers at IBM and even your own home computers) to retrieve files and perform tasks. The hardware server supports the software server this way.
What about static and dynamic servers?
In my previous post, I defined what static and dynamic web pages are. The concept for static and dynamic servers is the same.
In order to publish a website, you’ll need either one.
A static web server (a.k.a. stack) consists of a computer (hardware server) with an HTTP server (software server). We call it “static” because the static web server simply sends its hosted files to your browser, without doing anything else. This displays well, static web pages.
A dynamic web server consists of a static web server PLUS extra software, most commonly an application server and a database.
The “dynamic” part comes into play because of the application server will first update the hosted files (say, transcribing the static HTML and database contents into a smart template that allows for a much faster display of the web page on your browser) before sending them to your browser.
Could you explain more about the hosted files?
Sure. Let’s first go back to the concept of web pages.
When you want to fetch a web page, you are asking your browser to make a request to the web server (since you are on the web), which then proceeds to search for the files that will display the webpage accurately, before responding back to your browser. The searched files are the “hosted files” – either stored or hosted in your computer, or a much better option of a dedicated web server that runs 24/7.
The contents of the hosted files are displayed on the web page when the response is served back to the browser.
Note: The web server provides support for HTTP, which is a textual*, stateless* protocol on how to transfer HTML files between two computers.
*Textual: All commands are written in plain text and are human-readable.
*Stateless: Neither your computer (the client) nor the server remembers any previous commands or instructions. HTTP cannot remember the password you typed into a field previously.
Do servers have to respond to every request from the client?
Yes. A request-response cycle is necessary (see Image 2 above). If the server is unable to perform that request to a T, it will need to send an error message (the most common one you’d see is the “Error! 404! You’ve landed on a page that does not exist.”).
Now that you have a basic understanding of how servers work, you could:
· Understand what Web Hosting is about
· Learn more about HTTP
· Understand how the Internet connects everything