Definition
As the name implies, an origin server is a source of website content. When a user requests an HTML file or any media file, the data originates from an origin server. An origin server is a computer that waits for incoming requests from web visitors and responds to them. It contains the original version of your website and serves up its web pages when requested.
It’s common to see origin servers discussed alongside edge servers. This is because they work together most of the time. But unlike origin servers, edge servers store copies of websites at access points around the world. This means edge servers are closer to website visitors — more on this later. First, let’s dive deeper into how an origin server works.
Overview
An origin server is a computer that watches for inbound requests on the Internet and acts accordingly. These servers have a fixed amount of capacity.
It’s important to note that the physical location of the requesting device contributes to the speed at which the origin server delivers data. The greater the distance between the requesting device and the server, the higher the latency.
Latency is the time it takes for a data packet to move from its origin (origin server in this case) to its destination (requesting device). There is also the round-trip time (RTT), which is the time it takes for a network request to go from a starting point (requesting device) to a destination (the server hosting the requested resources) and back again to the starting point. Other factors, such as using the Secure Socket Layer (SSL) over Transport Layer Security (TLS) protocols to establish a secure connection on the server, also impact the RTT.
Origin Servers vs. Edge Servers
An origin server stores the original version, while an edge server stores cached versions of the content.
An edge server is a computer located at crossroads between major internet providers worldwide. These servers act to deliver content as quickly as possible. And they cache content to relieve the origin servers of their workload.
The goal of an edge server is to store content as close to the requesting client as feasible to minimize latency and load time.
There are two types of edge servers:
- Content delivery network (CDN) edge servers
- edge-compute servers
CDN edge servers cache static content from origin servers and provide users with cached versions of the content — including images, JavaScript, HTML, and downloadable files. Whereas edge-compute servers provide users with functionalities such as data processing for the Internet of things (IoT) applications and fifth-generation technology standard (5G) networks.
When a website owner doesn’t set up edge servers for their website, every request goes to the origin server regardless of its physical location. This may provide a bad user experience if the servers are far from the users and requests have a long RTT. To remedy this, website providers may use edge-compute servers to bring computing and storage systems as close as possible to their users. Edge computing reduces latency significantly since essential processing functions are closer to end-users, allowing faster response times.
Example
Origin servers and edge servers can coordinate their functions to bring content to users. We must direct inbound HTTP requests to the edge servers as website developers. To accomplish this, we must modify our domain name system (DNS) to redirect requests coming to our domain to our edge servers instead of the origin servers.
When a visitor makes a request, the edge server will receive it. If the requested resources are static files and the edge server has cached them, it will serve the resources. If not, it must send a request to the origin server to get the requested resources and return them to the user, after which the edge server caches the resources. For example, a website landing page (which shows up the same for every website visitor) has static files, CSS stylesheets, JavaScript files, and probably lots of images. Edge servers will cache these and serve them to users.
As users continue to interact with the website — for example, when they fill out and submit a form — requests travel to the edge server. But most of the time, edge servers cannot handle dynamic requests.
In this case, the edge server relays the information to the origin server, which processes the request and inserts the details into a database. Then, the origin server returns a response to the edge server and sends the information to the requesting user. The website either updates the edge server with information from the origin server or, more effectively, the edge server can pull updates from the origin server directly.
Key Takeaways
Origin servers respond to Internet requests, and edge servers usually accompany them. An origin server oversees serving the content of an Internet entity, such as a website, so long as the amount of traffic and the number of requests don’t exceed its processing capabilities. Edge servers are close to website visitors, and they mostly hold static content that doesn’t change.
An origin server is usually the last point of your network, and as the final point of your network, it receives all the traffic if you don’t have an edge server setup. Using edge servers in conjunction with origin servers allows the origin server to process fewer requests. This also means users can load websites and receive data faster.
For more information on edge computing, check out StackPath.