Why
Why virtual server?
With the explosive growth of the Internet and its increasingly important role in our lives, the traffic on the Internet is increasing dramatically, which has been growing at over 100% annual rate. The workload on the servers is increasing rapidly so that servers will be easily overloaded for a short time, especially for a popular web site. To overcome the overloading problem of the servers, there are two solutions. One is the single server solution, i.e. to upgrade the server to a higher performance server, but it will soon be overloaded when requests increases so that we have to upgrade it again, the upgrading process is complex and the cost is high. The other is the multiple server solution, i.e. to build a scalable network service system on a cluster of servers. When load increases, we can simply add a new server or more into cluster to meet the increasing requests, and commodity server is of highest performance/cost ratio. Therefore, it is more scalable and more cost-effective to build server cluster system for network services.
随着互联网的爆炸式增长及其在我们生活中的日益重要的作用,互联网上的流量急剧增加,并以每年100% 以上的速度增长。服务器上的工作量正在迅速增加,因此服务器将很容易在短时间内过载,尤其是对于流行的网站。为了克服服务器的过载问题,有两种解决方案。一种是单服务器解决方案,即将服务器升级到性能更高的服务器,但是当请求增加时它很快就会过载,以至于我们不得不再次升级它,升级过程复杂,成本很高。另一种是多服务器解决方案,即在服务器集群上构建可扩展的网络服务系统。当负载增加时,我们可以简单地将新服务器或更多服务器添加到集群中,以满足不断增长的请求,并且商品服务器具有最高的性能/成本比。因此,构建用于网络服务的服务器集群系统更具可扩展性和成本效益。
There are several methods to construct the cluster of servers.
有几种方法可以构建服务器集群。
- DNS based load balancing cluster 基于DNS的负载均衡集群
DNS load balancing is probably the simplest method to build network service cluster. It uses Domain Name System to distribute requests to different servers through resolving the domain name to different IP addresses of servers. When a DNS request comes to the DNS server to resolve the domain name, the DNS server gives out one of server IP addresses based on scheduling strategies, such as in round-robin manner, then subsequent requests from clients using the same local caching name server are sent to the same server in the specified time-to-live (TTL) of name resolving.
DNS负载平衡可能是构建网络服务集群的最简单方法。它使用域名系统,通过解析域名到服务器的不同ip地址,将请求分发到不同的服务器。当DNS请求到DNS服务器来解析域名时,DNS服务器会根据调度策略给出其中一个服务器ip地址,例如轮询方式,然后,来自使用相同本地缓存名称服务器的客户端的后续请求将在指定的名称解析生存时间 (TTL) 中发送到同一服务器。
However, due to the caching nature of clients and hierarchical DNS system, it easily leads to dynamic load imbalance among the servers, thus it is not easy for a server to handle its peak load. The TTL value of a name mapping can’t be well chosen at the DNS server, with small values DNS traffic is high and DNS server will be a bottleneck, and with high values the dynamic load imbalance will get even worse. Even the TTL value is set with zero, the scheduling granularity is per host, different users’ access pattern may lead to dynamic load imbalance, because some people may pull lots of pages from the site, and others may just surf a few pages and go away. Moreover, it is not so reliable, when a server node fails, the clients who maps the name to the IP address will find the server is down, and the problem still exists even if they press “reload” or “refresh” button in their browsers.
但是,由于客户端和分层DNS系统的缓存特性,很容易导致服务器之间的动态负载不平衡,因此服务器不容易处理其峰值负载。在DNS服务器上无法很好地选择名称映射的TTL值,小值DNS流量高,DNS服务器将成为瓶颈,而高值的动态负载不平衡将变得更加严重。即使TTL值设置为零,调度粒度为每台主机,不同用户的访问模式可能会导致动态负载不平衡,因为有些人可能会从网站上拉很多页,而另一些人可能只是浏览几页就走了。而且,它不是那么可靠,当服务器节点出现故障时,将名称映射到ip地址的客户端会发现服务器已关闭,即使在浏览器中按 “重新加载” 或 “刷新” 按钮,问题仍然存在。
- Dispatcher based load balancing cluster 基于调度器的负载均衡集群
Dispatcher, also known as load balancer, can be used to distribute load among servers in a cluster, so that the parallel services of servers can appear as a virtual service on a single IP address, and end users interact as if it were a single server without knowing all servers in clusters. Compared to DNS based load balancing, dispatcher can schedule requests at fine granularity, such as per connection, for better load balancing among servers. Failure can be masked when one server or more fail. Server management is becoming easy, and administrator can take a server or more in and out of service at any time, which won’t interrupt services to end users.
Dispatcher,也称为负载平衡器,可以用于在集群中的服务器之间分配负载,从而使服务器的并行服务可以在单个ip地址上显示为虚拟服务,并且最终用户就像它是单个服务器一样进行交互,而不知道集群中的所有服务器。与基于DNS的负载平衡相比,dispatcher可以以精细的粒度 (例如每个连接) 调度请求,以更好地实现服务器之间的负载平衡。当一台或多台服务器发生故障时,可以屏蔽故障。服务器管理变得越来越容易,管理员可以随时使用服务器或更多服务器进出服务,这不会中断对最终用户的服务。
Load balancing can be done in two levels, application-level and IP-level. For example, Reverse-proxy and pWEB is an application-level load balancing method to build a scalable web server. They forward the HTTP request to the different web servers in the cluster, get back the result, and then return it to the clients. Since the overhead of dealing the HTTP requests and replies in the application-level is high, I believe the application-level load balancer will be a new bottleneck when the number of server nodes increase to 5 or more, which depends on the throughput of each server.
负载平衡可以在两个级别完成,应用程序级别和IP级别。例如,反向代理和pWEB是一种应用程序级负载平衡方法,用于构建可扩展的web服务器。他们将HTTP请求转发到集群中的不同web服务器,获取结果,然后将其返回给客户端。由于在应用程序级处理HTTP请求和回复的开销很高,我相信当服务器节点数量增加到5个或更多时,应用程序级负载平衡器将是一个新的瓶颈,这取决于每个服务器的吞吐量。
I prefer the IP-level load balancing, because the overhead of IP load balancing is small and the maxim number of server nodes can reach 25 or up to 100. That’s IP Virtual Server code designed for. How it works will be explained in detail in the next section.
我更喜欢IP级别的负载平衡,因为IP负载平衡的开销很小,并且服务器节点的maxim数量可以达到25或最多100。这是为。它是如何工作的将在下一节中详细解释。