Internet Technologies 简明教程

Web Server

Overview

Web server 是一个存储网络内容的计算机。基本的网络服务器用来承载网站,但也存在其他网络服务器,例如游戏、存储、FTP、电子邮件等。

Web server is a computer where the web content is stored. Basically web server is used to host the web sites but there exists other web servers also such as gaming, storage, FTP, email etc.

Web Server Working

网络服务器以以下两种方式之一响应客户端请求:

Web server respond to the client request in either of the following two ways:

  1. Sending the file to the client associated with the requested URL.

  2. Generating response by invoking a script and communicating with database

internet web server working

Key Points

Key Points

  1. When client sends request for a web page, the web server search for the requested page if requested page is found then it will send it to client with an HTTP response.

  2. If the requested web page is not found, web server will the send an HTTP response:Error 404 Not found.

  3. If client has requested for some other resources then the web server will contact to the application server and data store to construct the HTTP response.

Architecture

网络服务器架构采用以下这两种方法:

Web Server Architecture follows the following two approaches:

Concurrent Approach

并发方法允许网络服务器同时处理多个客户端请求。可以通过以下方法实现:

Concurrent approach allows the web server to handle multiple client requests at the same time. It can be achieved by following methods:

  1. Multi-process

  2. Multi-threaded

  3. Hybrid method.

Multi-processing

在这种情况下,单个进程(父进程)启动多个单线程子进程,并将传入请求分配给这些子进程。每个子进程负责处理单个请求。

In this a single process (parent process) initiates several single-threaded child processes and distribute incoming requests to these child processes. Each of the child processes are responsible for handling single request.

由父进程负责监控负载,并决定是应该中止进程还是创建新进程。

It is the responsibility of parent process to monitor the load and decide if processes should be killed or forked.

Multi-threaded

与多进程不同,它创建了多个单线程进程。

Unlike Multi-process, it creates multiple single-threaded process.

Hybrid

它结合了上述两种方法。在这种方法中,会创建多个进程,每个进程会启动多个线程。每个线程处理一个连接。在单个进程中使用多个线程,会导致系统资源上的负载更少。

It is combination of above two approaches. In this approach multiple process are created and each process initiates multiple threads. Each of the threads handles one connection. Using multiple threads in single process results in less load on system resources.

Examples

下表介绍了当今最主流的网络服务器:

Following table describes the most leading web servers available today:

S.N.

Web Server Descriptino

1

Apache HTTP Server This is the most popular web server in the world developed by the Apache Software Foundation. Apache web server is an open source software and can be installed on almost all operating systems including Linux, UNIX, Windows, FreeBSD, Mac OS X and more. About 60% of the web server machines run the Apache Web Server.

2.

Internet Information Services (IIS) The Internet Information Server (IIS) is a high performance Web Server from Microsoft. This web server runs on Windows NT/2000 and 2003 platforms (and may be on upcoming new Windows version also). IIS comes bundled with Windows NT/2000 and 2003; Because IIS is tightly integrated with the operating system so it is relatively easy to administer it.

3.

Lighttpd The lighttpd, pronounced lighty is also a free web server that is distributed with the FreeBSD operating system. This open source web server is fast, secure and consumes much less CPU power. Lighttpd can also run on Windows, Mac OS X, Linux and Solaris operating systems.

4.

Sun Java System Web Server This web server from Sun Microsystems is suited for medium and large web sites. Though the server is free it is not open source. It however, runs on Windows, Linux and UNIX platforms. The Sun Java System web server supports various languages, scripts and technologies required for Web 2.0 such as JSP, Java Servlets, PHP, Perl, Python, and Ruby on Rails, ASP and Coldfusion etc.

5.

Jigsaw Server Jigsaw (W3C’s Server) comes from the World Wide Web Consortium. It is open source and free and can run on various platforms like Linux, UNIX, Windows, and Mac OS X Free BSD etc. Jigsaw has been written in Java and can run CGI scripts and PHP programs.