Web server
The term web server or webserver can mean one of two things:
1. A computer program that is responsible for accepting HTTP requests from clients (user agents such as web browsers), and serving them HTTP responses along with optional data contents, which usually are web pages such as HTML documents and linked objects (images, etc.).
2. A computer that runs a computer program as described above.
Common features
1. Virtual hosting to serve many web sites using one IP address.
2. Large file support to be able to serve files whose size is greater than 2 GB on 32 bit OS.
3. Bandwidth throttling to limit the speed of responses in order to not saturate the network and to be able to serve more clients.
The origin of the content sent by server is known as:
- static if it comes from an existing file lying on a filesystem;
- dynamic if it is dynamically generated by some other program or script or application programming interface (API) called by the web server.
Serving static content is usually much faster (from 2 to 100 times) than serving dynamic content, especially if the latter involves data pulled from a database.
Web servers are able to map the path component of a Uniform Resource Locator (URL) into:
- a local file system resource (for static requests);
- an internal or external program name (for dynamic requests).
For a static request the URL path specified by the client is relative to the Web server's root directory.
Consider the following URL as it would be requested by a client:
A web server (program) has defined load limits, because it can handle only a limited number of concurrent client connections (usually between 2 and 80,000, by default between 500 and 1,000) per IP address (and TCP port) and it can serve only a certain maximum number of requests per second depending on:
- its own settings;
- the HTTP request type;
- content origin (static or dynamic);
- the fact that the served content is or is not cached;
- the hardware and software limits of the OS where it is working.
When a web server is near to or over its limits, it becomes overloaded and thus unresponsive.
A web server can be either implemented into the OS kernel, or in user space (like other regular applications).
An in-kernel web server (like TUX on Linux or Microsoft IIS on Windows) will usually work faster because, as part of the system, it can directly use all the hardware resources it needs, such as:
- non-paged memory;
- CPU time-slices;
- network adapters buffers.
Web servers that run in user-mode have to ask the system the permission to use more memory or more CPU resources. Not only these requests to the kernel take time, but they are not always satisfied because the system reserves resources for its own usage and has the responsibility to share hardware resources with all the other running applications.
Also applications cannot access the system internal buffers, which is causing useless buffer copies that create another handicap for user-mode web servers.
As a consequence, the only way for a user-mode web server to match kernel-mode performances is to raise the quality of its code to much higher standards than the code used into another web server that runs in the kernel.
|