"Soft" Load balancing learning bit (II.)

Source: Internet
Author: User

Author: Early Zenwen





Demand turns to learning ... 2

"Soft" load balancing ... 2

LVS (Linux Virtual Server) ... 3

Virtual Server three mode introduction ... 3

Virtual server Three comparison of modes ... 5

Virtual Server three mode practice ... 6

Simple stress test in three different modes ... 9

Ha-proxy. 10

Ha-proxy Installation and use ... 10

Ha-proxy Stress test results ... 15

"Soft" load learning experience ... 15

Virtual Server three mode practice

Server resources: as the load balancer, and as the backend server.

Install the Apache2.2.14 on and, and then open port 80 to start the Web service.

1. Install the LVS Configuration tool (only need to install on load balancer)

Most Linux operating systems currently support virtual Server, so there is no need to compile the kernel, just download and install the User Configuration tool ipvsadmin. First check your Linux OS kernel version, my version is 2.6.18. Downloaded the ipvsadm-1.24.tar.gz from http://www.linux-vs.org/software/ipvs.html#kernel-2.6. The installation steps are as follows:

TAR–XZVF ipvsadm-1.24.tar.gz

Ln–s/usr/src/kernels/2.6.18-128.el5-i686/usr/src/linux (this must be done because you need to use directory/usr/src/linux to get the necessary external dependencies when compiling and installing)

Cd ipvsadm-1.24

Make && make install

Enter Ipvsadm, if you see the following to prove the installation was successful:

IP Virtual Server version 1.2.1 (size=4096)

Prot Localaddress:port Scheduler Flags

-> remoteaddress:port Forward Weight activeconn inactconn

2. Dr Mode Test

A. Bind virtual IP to this load Balancer network card.

Ifconfig eth0:0 netmask broadcast up

B. Establish a virtual IP on the load balancer.

Ipvsadm–a–t–s RR//221 IP is not in use by a physical machine, so as a virtual IP use, a indicates that a virtual ip,t representation is a TCP protocol, s represents a load algorithm, and a RR is a round Robin.

C. Establish a relationship between virtual IP and two entity servers on the load balancer.

Ipvsadm-a-T 1//Connect virtual IP and port to the entity machine, a indicates the relationship between the new virtual IP and the entity machine, R followed by the entity machine address and port, G means to use Dr Mode , W is the weight.

Ipvsadm-a-T 1

D. Establish the binding relationship between virtual IP and network card loopback on two other entity servers.

Ifconfig lo:0 netmask broadcast up

The following figure is configured to enter IPVSADM to see the virtual configuration information

Where route representation is the mode of Dr, and then Activeconn represents the number of connections, this is to access a published on two back-end server of the number of connections, access to the page is as follows two map: (mainly to see the return page in the server IP printing different)

The results of the access page are the same as the DR, and access to the virtual IP is polled to different back-end servers.

Simple stress test in three modes

The simple stress test employs Apache ab,500 concurrent users, and the total number of 10w requests.


Total time consuming (s)

TPS (#/sec)








Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.