In the vast landscape of the internet, web servers quietly perform an indispensable role, ensuring that web pages are stored, processed, and seamlessly delivered to users worldwide. They serve as the backbone of the World Wide Web, acting as the unassuming bridge between users’ requests and the vast repository of online content.
In one of our recent internal workshops, skillfully led by our colleague Stefan Rajić, we delved into the intricacies of this essential topic. This enlightening session shed light on the often-overlooked yet pivotal role of web servers in shaping our online experiences.
In this introductory blog post, we will explore the fundamental concepts of web servers, their functionality, transfer protocols, and common use cases, as well as explore key features and performance metrics.
What is a Web Server?
At its core, a web server is a specialized software or hardware system designed to handle and respond to HTTP (Hyper Text Transfer Protocol) requests from clients. The primary function of a web server is to store, process, and deliver web pages to clients, which are typically web browsers. Clients communicate with the server by sending HTTP requests, and the server responds with the content of the requested resource, which can include HTML documents, images, style sheets, scripts, and text.
Users interact with web servers by entering a Uniform Resource Locator (URL) that points to the web server using its Fully Qualified Domain Name (FQDN) and specifies a path to the desired resource.
Web servers primarily use the Hyper Text Transfer Protocol (HTTP) to transfer web pages. However, they also support other protocols, such as HTTP over Secure Sockets Layer (HTTPS) for secure communication and File Transfer Protocol (FTP) for uploading and downloading files. HTTP status codes play a significant role in these interactions, categorizing responses into five classes based on their first digit, including Informational, Success, Redirection, Client Error, and Server Error.
Common Use Cases
Web servers, often referred to as HTTP servers, handle requests on the internet through HTTP and HTTPS protocols. They are distinct from other server types like application servers (e.g., Gunicorn) and servers for various protocols (e.g., WSGI), as they specialize in handling HTTP and HTTPS requests, making them an essential component of web infrastructure.
Common and Advanced Features
Web servers offer a range of features to meet different needs. Common features found in most web servers include:
- HTTP Support: Compatibility with various versions of the HTTP protocol, including HTTP/1.0, HTTP/1.1, and, in some cases, HTTP/2 and HTTP/3.
- Logging: The capability to log information about client requests and server responses for security and statistical purposes.
- Virtual Hosting: Serving multiple websites using a single IP address.
- Authorization: Managing access to specific website paths or resources.
- Content Cache: Caching static and dynamic content to improve response times.
- Large File Support: Serving files larger than 2 GB on 32-bit operating systems.
- Bandwidth Throttling: Limiting the speed of content responses to prevent network saturation.
- Rewrite Engine: Mapping clean URLs to their actual file paths.
- Custom Error Pages: Providing customized HTTP error messages to clients.
Static Content Serving
Web servers send file content when a request matches a valid URL path corresponding to an existing file under the website’s root directory. Static content remains unchanged until modified by a program, making it an efficient way to deliver unchanging web resources.
Dynamic Content Serving
Web servers can also serve dynamic content. In this case, the server communicates with internal modules or external programs associated with the requested URL path. It passes client request parameters, receives data responses generated on the fly, and forwards them to the client. To enable this communication, web servers implement gateway interfaces.
Web server performance is crucial for delivering a seamless user experience. Web servers must respond quickly to client requests, ensuring high transfer speeds and low response times, even under high web traffic loads.
In other words, a web server should always be very responsive, even under high load of web traffic, in order to keep the total user’s wait (sum of browser time + network time + web server response time) for a response as low as possible.
Key performance metrics for web servers include:
- Requests per Second (RPS): The number of HTTP requests processed per second.
- Connections per Second (CPS): The rate at which connections are accepted by the web server.
- Network Latency and Response Time: Measuring the time it takes for clients to receive a response.
- Throughput: The rate of data transfer in bytes per second.
Concurrent client connections also influence performance, and understanding how a web server handles various levels of concurrency is vital for optimizing its performance.
As we conclude our exploration of web servers, guided by the insights of our colleague Stefan Rajić in our recent workshop, we recognize the critical role these unsung heroes play in the digital landscape.
At Walter Code, our commitment to knowledge sharing and continuous learning is at the heart of our success. We believe that understanding the fundamental technologies that underpin the internet is essential for delivering cutting-edge solutions to our clients.
We encourage you to stay engaged with us, as we embark on future journeys to demystify the world of technology and to stay at the forefront of innovation. Thank you for joining us in this enlightening blogpost, and we look forward to sharing more knowledge and insights in the days to come.