- 浏览: 3499884 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
wanglf1207:
EJB的确是个不错的产品,只是因为用起来有点门槛,招来太多人吐 ...
weblogic-ejb-jar.xml的元素解析 -
qwfys200:
总结的不错。
Spring Web Flow 2.0 入门 -
u011577913:
u011577913 写道也能给我发一份翻译文档? 邮件437 ...
Hazelcast 参考文档-4 -
u011577913:
也能给我发一份翻译文档?
Hazelcast 参考文档-4 -
songzj001:
DbUnit入门实战
Ideally
you should install a load balancer on a dedicated machine that can
handle all the incoming connections, with a separate network interface
for internal and external connections. However, none of this is
necessary for the purposes of this article. To start testing balance,
download the latest version from the project's Web site. Unpack it,
build it, and install it as follows:
# tar -zxvf balance-3.24.tar.gz
# cd balance-3.24
# ./configure
# make
# make install
Keep in mind that you'll need to be running as root in order to access ports
below 1024.
Let's start with a simple case. We have connections coming in to port 80, the default HTTP port. We'd like to evenly share the work between two computers (although load may be distributed among any number). You specify machines to balance by referencing their IP addresses or hostnames. By default balance will connect to those machines on the same port on which it is listening. You can specify other ports by adding ":port" to the end of the address.
Let's assume we have two machines with hostnames "alpha" and beta". The most basic solution (we'll get to more sophisticated uses in a moment) is just to alternate connections between the two computers, back and forth. This kind of balancing is called round-robin. It simply means each person or device gets an equal share, one after the other.
Balance has a simple command-line interface. We need to tell it
where incoming connections will be coming from, and the possible
destinations. By running:
# balance -f 80 alpha beta
we can share the load equally between servers alpha and beta. Including the -f
parameter will keep balance in the foreground. Without it, balance will
fork to the background, but an adminstrator could communicate with it
interactively by running balance -i
. In this example, if
the machines alpha and beta machines happen to be serving different
data and you were the only current user, refreshing the page over and
over would alternate you between the two sites (although presumably in
most cases you would want both computers to serve the same content).
Another thing we can do with balance is set a failover machine. That
is, if for some reason a connection fails or times out, balance will
establish a connection to the failover. For example, the command:
# balance -f 80 alpha beta ! failover
tells
balance to forward a connection to the machine named failover only if
both alpha and beta fail. The exclamation point separates the machines
into two separate groups. Connections will only be forwarded to the
next group if all connections to the first fail.
Another way of telling balance to move to the next group is by
setting a limit on the number of connections a machine can handle, as
follows:
# balance -f 80 alpha::256 ! beta::64 ! failover
This
specifies that alpha can handle up to 256 simultaneous connections,
after which point balance will move on to beta, and once beta has 64
connections, we finally move to the failover machine. The basic idea
here is that we're filling up one virtual bucket before we move on to
the next.
There's one important thing still lacking with these kinds of balancing commands. While sufficient for static HTML content, many real-world Web sites require sessions. User logins, shopping carts, or any kind of "memory" from page to page require session data to be retained when a user clicks onto a different page. Because HTTP is inherently stateless, each time we load a new page we're starting a new connection, which the load balancer might well send to a new machine. This would make preserving session information difficult.
The easiest solution to this problem is to make sure each client
always gets forwarded to the same machine. We can tell balance to do
this with the command:
# balance -f 80 alpha beta %
The
percent symbol denotes that the preceding group will be a "hash" type.
Balance will hash the user's IP address and associate it with one of
the machines. As long as the IP address remains the same, a connection
initiated from it will always go to the same computer. A good hashing
algorithm will make sure hashes are evenly spread among the machines.
Where do we go from here?
These techniques will produce a good, workable load balancer, but in cases where load is great, they will not suffice. An application like the Linux Virtual Server is more appropriate for cases like this. The LVS works on the IP level to increase efficiency, in contrast to balance, which works on the application level and thus has increased overhead in that it must deal with the HTTP protocol. In addition, LVS provides many different kinds of scheduling in addition to round-robin and hashing, which are the only methods we can use in the free version of balance. But the basic principles remain the same.
Thanks to load balancing, you can keep your servers' connection and download times high, and seamlessly serve the ever-increasing number of clients using the Internet every day.
Costa Walcott is the co-founder of Draconis Software and a freelance writer.
发表评论
-
collectd
2011-08-03 14:27 2277collectd是一个守护(daemon)进程,用来收集系 ... -
HP ASR(Automatic Server Recovery)机制
2011-04-15 14:24 3555ASR(Automatic Server Re ... -
LINUX下用HP的IML工具查看服务器的日志信息
2011-04-14 16:40 4888LINUX下用HP的IML工具查看 ... -
LINUX做服务器的无盘系统
2011-01-26 18:19 1920客户端是支持PXE方式启 ... -
简易搭建一个私有云平台
2010-11-17 18:30 3216众说周知Amazon EC2是一个公共云的计算平台,属于Iaa ... -
[HA]利于heartbeat构建Oracle高可用
2010-09-17 12:41 476110月 24th, 2008 @ Kevin.yuan ... -
服务部署--IP SAN潜在的关键应用
2010-08-26 09:38 2092IP SAN可以说是近几年来存储领域的关键技术之一, ... -
通过HAProxy构建开源负载均衡架构平台
2010-08-09 00:07 49961. 目的 通过此作业指导书,知道如何使用ubu ... -
MySQL负载均衡
2010-08-08 23:39 46861. 添加监控MySQL状态的端口 # vi /etc/se ... -
Ha-proxy 学习
2010-08-08 23:08 8958什么是ha-proxy ... -
SQL Server 各版本的区别
2010-08-08 17:49 4037SQL Server 2005 Enterprise Ed ... -
Oracle数据库11g版本介绍
2010-08-08 17:44 3474无论您是独立开发者、中小企业还是大型企业,这些世界一 ... -
tpmC简单计算法
2010-07-29 18:59 17959计算原则: 以单台服务器性能进行计算,即确保单台服务器工作的时 ... -
KVM遥控服务器群
2010-07-07 15:54 2147众所周知,所谓KVM,就是键盘(Keyboard)、显示器 ... -
数据存储配置参考
2010-07-02 10:07 1789型号 配 置 数量 ... -
More Numbers (OpenDS and a hint at ApacheDS)
2010-04-29 23:45 2475Some more numbers have come in. ... -
利用Copssh在windows下搭建ssh服务
2010-03-09 01:04 13432现在远程维护基本上用ssh连接,linux系 ... -
Software Based Load Balancers
2010-03-05 15:57 1837keyword:Load Balance ref: http ... -
SAN,NAS,DAS及其架构之间区别
2010-02-26 14:11 1687随着计算机技术的发展 ... -
Apache: Creating A Session-Aware Loadbalancer Using mod_proxy_balancer (Debian E
2010-02-12 14:45 3166Since Apache 2.1, a new module ...
相关推荐
In this book, the reader will learn how to configure and leverage HAProxy for tasks that include: • Setting up reverse proxies and load-balancing backend servers • Choosing the appropriate load-...
Making application scalable with load balancing
Load Balancing with HAProxy原版英文书籍,Open-source technology for better scalability, redundancy and availability in your IT infrastructure
Practical Load Balancing starts by introducing key concepts and the tools you'll need to tackle your load-balancing issues. You'll travel through the IP layers and learn how they can create increased...
自行翻译的PhotonServer LoadBalancing应用的详细说明。
distributed computing Load Balancing
Network Load Balancing Architecture
this is the load balancing ppt file, in this file. you can get the concept of the load balancing.
Network Load Balancing (NLB) 是 Windows 操作系统中的一项功能,它允许通过将网络流量分散到多个服务器上来提高应用程序的可用性和可伸缩性。NLB 通过创建一个集群来实现这一目标,集群中的每台服务器(或主机)都...
《NGINX Cookbook: Advanced Recipes for High Performance Load Balancing》是由Derek DeJonghe编写的,这本书在2019年出版,ISBN为9781491968932,包含了175页的英文内容,格式为PDF。这本书专门针对那些希望提升...
分布式缓存系统作为构建可扩展应用程序的基石,在云计算模型的出现后变得愈发重要。随着越来越多的应用程序访问分布式对象缓存,如Facebook和Twitter使用的Memcached,对于高效负载均衡算法的需求变得迫切。...
对Weblogic中HTTP负载均衡的配置
### Fortigate Load Balance 实用手册知识点详述 #### 引言 Fortigate Load Balance 是一款由Fortinet公司研发的企业级负载均衡解决方案。本手册旨在帮助用户深入理解Fortigate的负载均衡功能及其配置方法,适用于...
客户端负载均衡发生在客户端连接数据库时,通过TNSNAMES.ORA配置文件中的LOAD_BALANCE参数,客户端可以将连接请求发送到多个地址,Oracle会自动选择当前负载较低的节点进行连接。例如,配置一个包含三个VIP(Virtual...
### DNS Load Balancing知识点 #### 一、DNS基础概述 **域名系统(DNS)**是互联网服务中的核心组件之一,其主要功能在于将人类可读的域名转换为计算机能够识别的IP地址。DNS在现代网络架构中扮演着至关重要的角色...
node.js-process-load-balancing, node.js 进程负载平衡性能 node.js 进程负载平衡性能: 比较集群模块,iptables和 Nginxnode 是单一线程,并且要使用更多的CPU内核,我们必须创建新进程并分配负载。 这是对 node....
Network Load Balancing Technical Overview
Wiley.Load.Balancing.Servers.Firewalls.and.Caches.Feb.2002.rar