您什么时候需要多台服务器来托管一个 Web 应用程序?

发布于 2024-08-07 12:39:16 字数 110 浏览 3 评论 0原文

这就是所谓的服务器“集群”吗?当发送Web请求时,它是否经过主服务器,如果主服务器无法处理额外的负载,那么它会将其转发到可以处理负载的辅助服务器吗?另外,启动并运行应用程序的一台“服务器”是否称为“实例”?

Is that called "clustering" of servers? When a web request is sent, does it go through the main server, and if the main server can't handle the extra load, then it forwards it to the secondary servers that can handle the load? Also, is one "server" that's up and running the application called an "instance"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心安伴我暖 2024-08-14 12:39:16

[...]这就是所谓的服务器“集群”吗?

集群确实透明地使用被视为唯一实体的多个节点:集群。集群允许您扩展:您可以将负载分散到所有节点上,如果您需要更多功能,您可以添加更多节点(简短版本)。集群使您能够容错:如果一个节点(物理或逻辑)出现故障,其他节点仍然可以处理请求,并且您的服务仍然可用(简短版本)。

当发送网络请求时,它是否经过主服务器,如果主服务器无法处理额外的负载,那么它会将其转发到可以处理负载的辅助服务器吗?

一般来说,这是一个称为“负载均衡器”(硬件、软件)的专用组件的工作,它可以使用许多算法来平衡请求:循环、先进先出、后进先出、基于负载......

在 EC2 的情况下,您之前必须使用循环 DNS 和/或 HA 代理 进行负载平衡。请参阅Amazon EC2 软件负载均衡简介。但一段时间以来,亚马逊推出了负载均衡和自动扩展(测试版)作为其 EC2 产品的一部分。请参阅弹性负载平衡

此外,启动并运行应用程序的一台“服务器”是否称为“实例”?

实际上,实例可以是很多东西(取决于说话者):一台机器、一台虚拟机、一台启动并运行的服务器(软件)等。

对于 EC2,您可能需要阅读 Amazon EC2 实例类型

[...] Is that called "clustering" of servers?

Clustering is indeed using transparently multiple nodes that are seen as a unique entity: the cluster. Clustering allows you to scale: you can spread your load on all the nodes and, if you need more power, you can add more nodes (short version). Clustering allows you to be fault tolerant: if one node (physical or logical) goes down, other nodes can still process requests and your service remains available (short version).

When a web request is sent, does it go through the main server, and if the main server can't handle the extra load, then it forwards it to the secondary servers that can handle the load?

In general, this is the job of a dedicated component called a "load balancer" (hardware, software) that can use many algorithms to balance the request: round-robin, FIFO, LIFO, load based...

In the case of EC2, you previously had to load balance with round-robin DNS and/or HA Proxy. See Introduction to Software Load Balancing with Amazon EC2. But for some time now, Amazon has launched load balancing and auto-scaling (beta) as part of their EC2 offerings. See Elastic Load Balancing.

Also, is one "server" that's up and running the application called an "instance"?

Actually, an instance can be many things (depending of who's speaking): a machine, a virtual machine, a server (software) up and running, etc.

In the case of EC2, you might want to read Amazon EC2 Instance Types.

何以笙箫默 2024-08-14 12:39:16

这是一个真实的示例:

此特定配置托管在 RackSpace 的托管 Colo 组中。

请求通过思科防火墙。然后,它们通过千兆位 LAN 路由到 Cisco CSS 11501 内容服务交换机(例如负载均衡器)。负载均衡器将传入内容与内容规则进行匹配,在必要时处理 SSL 解密,然后将流量转发到多个后端 Web 服务器之一。

每 5 秒,负载均衡器就会在每个 Web 服务器上请求一个 URL。如果 Web 服务器未能(连续两次,IIRC)响应正确的值,则在 URL 开始正确响应之前,不会向该服务器发送任何流量。

网络服务器后面是 MySQL 主/从配置。连接可能与主设备(用于事务)或与从设备的连接用于只读请求。

Memcached 安装在每个 Web 服务器上,并有 1 GB 的 RAM 专用于缓存。每个Web应用程序都可以利用memcache服务器集群来缓存各种内容。

使用 rsync 来处理部署,将管理服务器上的特定目录同步到每个 Web 服务器。 Apache 重新启动等是通过管理服务器上的 ssh 上的类似脚本来处理的。

通过此配置可以处理的流量非常大。易于扩展和易于维护的优点也很大。

Here is a real example:

This specific configuration is hosted at RackSpace in their Managed Colo group.

Requests pass through a Cisco Firewall. They are then routed across a Gigabit LAN to a Cisco CSS 11501 Content Services Switch (eg Load Balancer). The Load Balancer matches the incoming content to a content rule, handles the SSL decryption if necessary, and then forwards the traffic to one of several back-end web servers.

Each 5 seconds, the load balancer requests a URL on each webserver. If the webserver fails (two times in a row, IIRC) to respond with the correct value, that server is not sent any traffic until the URL starts responding correctly.

Further behind the webservers is a MySQL master / slave configuration. Connections may be mad to the master (for transactions) or to the slaves for read only requests.

Memcached is installed on each of the webservers, with 1 GB of ram dedicated to caching. Each web application may utilize the cluster of memcache servers to cache all kinds of content.

Deployment is handled using rsync to sync specific directories on a management server out to each webserver. Apache restarts, etc.. are handled through similar scripting over ssh from the management server.

The amount of traffic that can be handled through this configuration is significant. The advantages of easy scaling and easy maintenance are great as well.

呆橘 2024-08-14 12:39:16

对于集群,任何 Web 请求都将由负载均衡器处理,该负载均衡器根据形成集群的服务器的当前负载进行更新,并将请求发送到负载最小的服务器。至于是否是一个实例……我相信是这样,但我会先等待确认。

不过,您需要一个非常大的应用程序来考虑集群以及它在软件和硬件方面带来的“乐趣”。除非您打算开始或已经在运行一些大的东西,否则没有什么可担心的。

For clustering, any web request would be handled by a load balancer, which being updated as to the current loads of the server forming the cluster, sends the request to the least burdened server. As for if it's an instance.....I believe so but I'd wait for confirmation first on that.

You'd' need a very large application to be bothered with thinking about clustering and the "fun" that comes with it software and hardware wise, though. Unless you're looking to start or are already running something big, it wouldn't' be anything to worry about.

遗弃M 2024-08-14 12:39:16

是的,集群可能需要它。通常,随着负载的增加,您可能会发现自己的前端服务器可以进行 url 重写、https(如果需要)以及使用鱿鱼进行缓存。请求被传递到多个后端服务器 - 如有必要,可能会使用 cookie 将会话与特定后端关联起来。您也可能将数据库放在单独的服务器上。

我应该补充一点,您可能需要多个服务器的其他原因,例如出于安全原因可能要求数据库不在前端服务器上

Yes, it can be required for clustering. Typically as the load goes up you might find yourself with a frontend server that does url rewriting, https if required and caching with squid say. The requests get passed on to multiple backend servers - probably using cookies to associate a session with a particular backend if necessary. You might have the database on a separate server also.

I should add that there are other reasons why you might need multiple servers, for instance there may be a requirement that the database is not on the frontend server for security reasons

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文