Web服务器如何在单个端口(80)上一次处理多个用户的传入请求? [英] How can a web server handle multiple user's incoming requests at a time on a single port (80)?

查看:216
本文介绍了Web服务器如何在单个端口(80)上一次处理多个用户的传入请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Web服务器如何在单个端口(80)上同时处理多个传入请求?

How does a web server handle multiple incoming requests at the same time on a single port(80)?

示例: 同时30万用户希望从www.abcdef.com看到一个分配了IP 10.10.100.100和端口80的图像.那么www.abcdef.com如何处理传入用户的负载?

Example : At the same time 300k users want to see an image from www.abcdef.com which is assigned IP 10.10.100.100 and port 80. So how can www.abcdef.com handle this incoming users' load?

一台服务器(分配了IP 10.10.100.100)可以处理大量的传入用户吗?如果不是,那么如何将一个IP地址分配给多个服务器来处理此负载?

Can one server (which is assigned with IP 10.10.100.100) handle this vast amount of incoming users? If not, then how can one IP address be assigned to more than one server to handle this load?

推荐答案

来自 tcpipguide

这种使用客户端和服务器套接字进行连接的标识,可以灵活地允许我们认为在互联网上的设备之间建立多个连接.例如,繁忙的应用程序服务器进程(例如Web服务器)必须能够处理来自多个客户端的连接,否则万维网将几乎无法使用.由于使用客户端的套接字和服务器的套接字来标识连接,所以这没有问题.在Web服务器维护上述连接的同时,它可以轻松地拥有另一个连接,例如IP地址为219.31.0.44的端口2199.这由连接标识符表示:

This identification of connections using both client and server sockets is what provides the flexibility in allowing multiple connections between devices that we take for granted on the Internet. For example, busy application server processes (such as Web servers) must be able to handle connections from more than one client, or the World Wide Web would be pretty much unusable. Since the connection is identified using the client's socket as well as the server's, this is no problem. At the same time that the Web server maintains the connection mentioned just above, it can easily have another connection to say, port 2,199 at IP address 219.31.0.44. This is represented by the connection identifier:

(41.199.222.3:80, 219.31.0.44:2199). 

实际上,我们可以从同一个客户端到同一个服务器建立多个连接.每个客户端进程都将被分配一个不同的临时端口号,因此,即使它们都尝试访问相同的服务器进程(例如41.199.222.3:80处的Web服务器进程),它们都将具有不同的客户端套接字并代表唯一的连接.这样一来,您就可以从计算机向同一网站同时发出多个请求.

In fact, we can have multiple connections from the same client to the same server. Each client process will be assigned a different ephemeral port number, so even if they all try to access the same server process (such as the Web server process at 41.199.222.3:80), they will all have a different client socket and represent unique connections. This is what lets you make several simultaneous requests to the same Web site from your computer.

同样,TCP独立跟踪每个连接,因此每个连接都不知道其他连接. TCP可以处理数百甚至数千个同时连接.唯一的限制是运行TCP的计算机的容量以及与之物理连接的带宽-一次运行的连接越多,每个人共享共享有限资源的次数就越多.

Again, TCP keeps track of each of these connections independently, so each connection is unaware of the others. TCP can handle hundreds or even thousands of simultaneous connections. The only limit is the capacity of the computer running TCP, and the bandwidth of the physical connections to it—the more connections running at once, the more each one has to share limited resources.

这篇关于Web服务器如何在单个端口(80)上一次处理多个用户的传入请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆