You are on page 1of 34

Network Load Balancing

Nhm 8 Phan T Quc Thng Nguyn Vit Thng Nguyn Vit H V Vn c Phm Vn Thnh Ph B Thnh L Minh c

thangptq91@gmail.com

t vn ???

Cn bng ti l g?
Cn bng ti l mt h thng gip lm tng tnh kh m v tnh kh dng ca mt nhm cc server dng cung cp d liu

Phng php cn bng ti: Mt a ch IP o c dng i din cho nhm cc server Yu cu t client n s c phn phi hp l{ n cc server trong nhm

Cc phng php cn bng ti

Cn bng ti bng phn cng


S dng cc module (load balancer) cm thm trn cc thit b chuyn dng nh router, switch

Cn bng ti bng phn mm


S dng phn mm ci song song trn cc my ch, kt hp nhiu server to thnh 1 server o

Cn bng ti bng proxy sever


Tn dng kh nng chia ti sn c trn cc phn mm proxy nh ISA Proxy ca Microsoft hay Squid (open source).

So snh cc phng php


So snh Kh nng theo di trng thi ng dng M rng Phn cng Phn mm Proxy server

Km

Tt

Km

Tt

Km

Tt

Tng tc, hiu nng s dng

Tt

Km

Km

Bo mt

Km

Chp nhn c

Tt ( firewall)

Network Load Balancing

Network Load Balancing l g?


Windows NLB:
L mt gii php phn mm phn tn cho cn bng ti Tch hp sn trong cc phin bn Window Server 200x ca Microsoft

Yu cu cho Windows Network Load Balancing


Mi my phi c t nht mt card mng dnh cho cn bng ti Ch c dng TCP/IP cho NLB adapter Cc node trong mng NLB phi c cng subnet

Network Load Balancing


Logical Design

Khng c im chu li duy Internet/ nht intranet Khng c hin tng tht c chai Khng cn thm phn cng NLB Virtual c bit
IP Address

Tng s node theo nhu cu s dng Ti a 32 node cho mt cluster nh kz trao i bn tin heartbeat

NLB Host

NLB Host

NLB Host

NLB Host

NLB Host

Qu trnh x l cc server cht trong sut vi ngi s dng

Phn phi ti
Mi host c th nh ra mc ti m n x l{ hoc ti c phn phi u gia cc host

kh dng
kh dng c tng cng vi N-1 cch khc phc li trong mt nhm c N host

Kin trc h thng NLB


Kin trc phn mm phn tn hon ton: NLB driver c ci t v chy song song trn tt c cc host trong nhm Trn mi host, NLB driver hot ng nh mt b lc gia network adapter driver v tng TCP/IP, iu ny cho php mt phn lu lng mng n c nhn bi host Mi host s thc hin nhng tinh ton ging nhau mt cch c lp v quyt nh nn x l{ gi yu cu hay l khng.

Kin trc h thng NLB

Nhc im NLB
NLB lm tng ti trn cc chuyn mch (switch) do chim thm bng thng cng khi qung b phn phi lu lng mng n cc host trong nhm y khng phi l vn trong phn ln ng dng (web, streaming media,) do t l lu lng n switch chim phn nh trong tng lu lng mng Nu cc kt ni t client n switch c tc nhanh hn nhiu pha server ??? Nhiu nhm kt ni trn cng 1 switch m khng c bin php thit lp VLAN cho tng nhm ???

Cc ch hot ng
Unicast mode: (default) Mt a ch MAC o duy nht i din cho nhm c cp cho card mng vt l{ ca tt c cc node trong nhm Khng s dng a ch MAC gc ca node Gi d liu n c nhn bi tt c node trong nhm Ch mt node c php x l{ v tr li Cc node khng th giao tip vi nhau C th s dng thm mt card mng trao i thng tin vi cc node khc

Multicast mode: Mt a ch MAC multicast c cp cho card mng ca tt c cc node a ch MAC gc ca node vn c s dng Loi b c vn s dng 2 card mng Ch mt node c php x l{ gi tin n

Node 1
IP:10.10.10.1 MAC:48-2C-6A-1E-59-3D

Before NLB

Node 2
IP:10.10.10.2 MAC:AA-9B-6A-1E-59-6E

Node 3
IP:10.10.10.3 MAC:58-B7-6A-1E-59-4D

Node 4
IP:10.10.10.4 MAC:B3-AA-6A-1E-59-5B

Node 1
IP:10.10.10.1 VIP:10.10.10.10 MAC:48-2C-6A-1E-59-3D VMAC:AA-BB-CC-99-88-77

NLB with Unicast Operation Mode

Node 2
IP:10.10.10.2 VIP:10.10.10.10 MAC:AA-9B6A-1E-59-6E VMAC:AA-BB-CC-99-88-77

VIP:10.10.10.10 VMAC:AA-BB-CC-99-88-77

IP:10.10.10.3 VIP:10.10.10.10 MAC:58-B7-6A-1E-59-4D VMAC:AA-BB-CC-99-88-77

Node 3

Node 4
IP:10.10.10.4 VIP:10.10.10.10 MAC:B3-AA-6A-1E-59-5B VMAC:AA-BB-CC-99-88-77

IP:10.10.10.1 VIP:10.10.10.10 MAC:48-2C-6A-1E-59-3D VMAC:AA-BB-CC-99-88-77

Node 1

NLB with Unicast Operation Mode

Node 2
IP:10.10.10.2 VIP:10.10.10.10 MAC:AA-9B6A-1E-59-6E VMAC:AA-BB-CC-99-88-77

VIP:10.10.10.10 VMAC:AA-BB-CC-99-88-77

Node 3
IP:10.10.10.3 VIP:10.10.10.10 MAC:58-B7-6A-1E-59-4D VMAC:AA-BB-CC-99-88-77

Node 4
IP:10.10.10.4 VIP:10.10.10.10 MAC:B3-AA-6A-1E-59-5B VMAC:AA-BB-CC-99-88-77

IP:10.10.10.90 MAC:F5-D1-BB-99-68-C7

IP:10.10.10.1 VIP:10.10.10.10 MAC:48-2C-6A-1E-59-3D VMAC:AA-BB-CC-99-88-77

Node 1

NLB with Multicast Operation Mode

Node 2
IP:10.10.10.2 VIP:10.10.10.10 MAC:AA-9B6A-1E-59-6E VMAC:AA-BB-CC-99-88-77

VIP:10.10.10.10 VMAC:AA-BB-CC-99-88-77

Node 3
IP:10.10.10.3 VIP:10.10.10.10 MAC:58-B7-6A-1E-59-4D VMAC:AA-BB-CC-99-88-77

Node 4
IP:10.10.10.4 VIP:10.10.10.10 MAC:B3-AA-6A-1E-59-5B VMAC:AA-BB-CC-99-88-77

Note: Network Device, such as switch infrastructure, must support multicast MAC addressing.

Tng kt cc phng php

Thut ton cn bng ti


NLB s dng thut ton lc phn tn hon ton nh x yu cu t client n cc host trong nhm
Cho php cc host a ra quyt nh cn bng ti mt cch c lp v nhanh chng cho tng gi n Cung cp hiu nng rt cao bao gm c thng lng cao v thi gian p ng ngn

Khi xem xt mt gi n, tt c cc host ng thi nh x thng k xc nh host s x l gi


Dng hm ngu nhin da trn IP v cng ca client cng cc thng tin khc tnh mc u tin ca host Host c chn s chuyn gi ln TCP/IP, cn li s loi b gi ny

Thut ton cn bng ti


hot ng cn bng ti c chnh xc cao, mt phn ti nguyn ca h thng dng o v phn ng trc nhng thay i ca ti (c bn l CPU v b nh) Khi mt host tham gia vo nhm, n s kch hot qu trnh hi t thng qua heartbeat message v h thng s tnh ton li thut ton cn bng ti

Qu trnh hi t
Cc host trong nhm trao i nh kz cc bn tin heartbeat multicast hoc broadcast cho nhau. iu ny cho php cc host gim st c trng thi ca nhm Trong unicast, mi host s qung b heartbeat theo chu kz. Cn trong multicast, n s pht cc bn tin ny ch multicast Bn tin NLB ca Microsoft gn gi tr 0x886F, chu kz mc nh l 1 giy. khi to qu trnh hi t, mc nh cn 5 heartbeat khng c nhn

Hiu nng cn bng ti


nh gi hiu nng ca h thng NLB da trn 4 tiu ch: CPU overhead trn cc host ca nhm Thng lng p ng Thi gian p ng Bng thng ca switch

Hiu nng cn bng ti


Khi nng lc cc host trong nhm c khai thc ti a cn b sung thm host (ti a 32 host) Nu ti tip tc tng cn nhiu nhm NLB v vic phn phi lu lng gia cc nhm c thc hin bng k thut round robin DNS Thc t c s dng cho website www.microsoft.com, c 5 nhm NLB, mi nhm gm 6 host v mi host chy 60% nng lc ti a

Demo

Ni dung bi demo
Gi lp 2 website chy trn 2 server vt l{ Cu hnh Network Load Balancing Cc bc kim tra

Demo trn Windows Server 2003


Chun b 3 my o Windows Server 2003 trn nn VMWare, 2 my ng vai tr Server, 1 my l Client. Cc my o tt ht Windows Firewall.

abdullah_swalhah@yahoo.com

Demo trn Windows Server 2003


Cng vic cu hnh Network Load Balancing cng chnh l i to ra mt Virtual IP i din cho cc server web. Cu hnh TCP/IP cho cc my o nh sau:
Server 1: 192.168.1.18 / 255.255.255.0 v Server 2: 192.168.1.19/ 255.255.255.0

Gi lp 1 website chy trn 2 server bng cng c Internet Information Services (IIS).

Demo trn Windows Server 2003


Tin hnh cu hnh bng dch v Network Load Balancing c sn trn Windows Server 2003. Chn ch Multicast (c khuyn co l s t pht sinh li trong qu trnh hot ng hn so vi ch Unicast). Thit lp Virtual IP chung cho 2 Server l 192.168.1.90 Thit lp cng cho 2 Server l port 79. Chng ta c th quy nh u tin truy cp vo server vt l{ no trc thng qua gi tr Priority, priority cng nh th u tin cng cao, y gi tr Priority cho 2 Server ln lt l 1 v 2. + Xem kt qu xc nhn li qu trnh cu hnh NLB bng cu lnh wlbs query.

Demo trn Windows Server 2003


By gi chng ta s i kim tra kt qu. V trong m hnh c s lng my t nn ta khng th kim tra c kh nng cn bng lng truy cp vo hai my server khi c s lng truy cp ln. Ta ch kim tra kh nng gnh ti khi mt trong cc my server trc trc khng hot ng. u tin ng my Client truy cp vo WebServer bng a ch 192.168.1.90 Sau ngt kt ni 1 trong 2 Server vo truy cp WebServer t my Client, kt qu vn truy cp thnh cng.