Professional Documents
Culture Documents
Intro Thesis VoDuyPho
Intro Thesis VoDuyPho
N
TT NGHIP I HC
NGNH CNG NGH THNG TIN
CN BNG TI CHO CC H
WEBSERVER LN V M BO
SCALABILITY
H NI 6-2009
PHIU GIAO NHIM V N TT NGHIP
2. Mc ch ni dung ca ATN
Tm hiu v l thuyt cn bng ti cho cc h thng web server ln bao gm nhiu web
server c ci t nhiu ni khc nhau, tm hiu v l thuyt xy dng b cn bng ti
cho cc web server, ci t cc thut ton cn bng ti, khc phc mt s nhc im ca
cc thut ton ny. Tm hiu cc phng n ci t v cu hnh cc b cn bng ti vo h
thng web server nhm m bo c tnh m rng cao v kh nng chng li.
3. Cc nhim v c th ca ATN
- Tm hiu v kin trc website vi kh nng m rng
- Tm hiu v cn bng ti cho cc h thng web-server ln, cc k thut cn bng ti
server
- Tm hiu v l thuyt xy dng b cn bng ti, cn bng ti cho server, cn bng ti cho
server ton cu v cn bng ti cho cache
- Tm hiu v ci t mt s thut ton cn bng ti bng ngn ng C da trn mt sn
phm cn bng ti m ngun m, xut mt s phng php ci tin thut ton.
- Cu hnh v ci t cc b cn bng ti vo h thng theo cc kin trc khc nhau, m
bo c kh nng m rng v kh nng chng li ca h thng.
V Duy Pho
The boost of website services, especially the social network and online video-
sharing websites, in recent years causes the number of clients using Internet rapidly
increase. These websites are required to have a very powerful server system to match the
demand of over hundred millions of clients. An interesting website certainly attracts a lot
of users, then the clients go up, that makes servers overload and need to be improved. This
process is repeated when there are more and more clients access to server again. This
problem raise the question of how to build an website system which have ability to meet
the accessing demand of people within long enough time and easily improved if there is
necessary. That is scalable web architecture.
The most important factor in scalable web architecture is load balancing for web
server system. A global website have web servers in many different places. Load balancing
for the web server system is how to minimize clients response time without overloading. In
the competition between web services, a manager who successfully match users demands
will become winner. Therefore, load balancing demand is very crucial for the survival of
web service industry.
There many methods for load balancing but the general point is the necessity of
load balancer between clients and web server system. This load balancer receives the
requests from clients then directs them to suitable servers base on load distribution
algorithms, next it gets the response and returns to clients.
We will present a general view on the problems which need to be solved in the
process of webs ever designs with scalable ability. Then, we focus on the theory of load
balancing for large server systems, techniques and methods of load balancer in use. We
also mention the architecture and necessary factors for a load balancer, load distribution
algorithms which have been used globally, methods of installing a load balancer into
system for matching the demands as well as the scalable capability. The next part will
introduce some specific load balancing algorithms base on an open source load balancer
and improvements for these. The final part will provide a possible direction for building a
completely independent load balancer which implements improved load distribution
algorithms in order to apply in operating websites.
MC LC
TM TT NI DUNG N TT NGHIP ......................................................1
ABSTRACT OF THESIS........................................................................................2
DANH MC CC T VIT TT V THUT NG ...........................................6
T VN .........................................................................................................6
1. Tnh cp thit ca ti ..............................................................................7
2. Mc ch nghin cu .................................................................................10
3. Kt cu lun vn ........................................................................................11
CHNG 1: KIN TRC WEB VI KH NNG M RNG (SCALABLE
WEB ARCHITECTURE)........................................Error! Bookmark not defined.
1. Cc khi nim v kin trc vi kh nng m rng .....Error! Bookmark not
defined.
2. Cc vn cn gii quyt trong qu trnh xy dng website theo kin
trc vi kh nng m rng .................................. Error! Bookmark not defined.
2.1 Cn bng ti cho application servers ........ Error! Bookmark not defined.
2.2 M rng Database server.......................... Error! Bookmark not defined.
2.2.1 Shared nothing Cluster........................... Error! Bookmark not defined.
2.2.2 Real Application Cluster........................ Error! Bookmark not defined.
2.2.3 M hnh khuyn dng ............................ Error! Bookmark not defined.
2.3 T chc lu tr d liu.............................. Error! Bookmark not defined.
2.4 Cn bng ti cho Cache ............................ Error! Bookmark not defined.
2.4.1 nh ngha ............................................. Error! Bookmark not defined.
2.4.2 Cc loi Caches v cch ci t.............. Error! Bookmark not defined.
CHNG 2: K THUT CN BNG TI WEB-SERVERError! Bookmark
not defined.
1. L thuyt xy dng b cn bng ti cho web-servers .Error! Bookmark not
defined.
1.1 K thut cn bng ti server (Server Load Balancing SLB).......... Error!
Bookmark not defined.
1.1.1 Kim tra trng thi server....................... Error! Bookmark not defined.
1.1.2 La chn server tt nht......................... Error! Bookmark not defined.
1.1.3 K thut Session Persistence.................. Error! Bookmark not defined.
1.1.4 Cookie ................................................... Error! Bookmark not defined.
1.2 Cn bng ti cho server ton cu (GSLB) . Error! Bookmark not defined.
1.2.1 Domain Name System ........................... Error! Bookmark not defined.
1.2.2 Ci t b cn bng ti vo h thng mng DNS...Error! Bookmark not
defined.
1.2.3 La chn site tt nht............................. Error! Bookmark not defined.
1.3 Chuyn mch cache trong sut.................. Error! Bookmark not defined.
1.3.1 Cc phng php ci t cache .............. Error! Bookmark not defined.
1.3.2 Cc phng php cn bng ti cho caches.............Error! Bookmark not
defined.
1.3.3 Nhn bit ng cnh trong cache (Content-aware cache switching)Error!
Bookmark not defined.
1.4 Cn bng ti s dng phn cng v cn bng ti phn mm........... Error!
Bookmark not defined.
1.4.1 Cn bng ti s dng phn cng ............ Error! Bookmark not defined.
1.4.2 Cn bng ti s dng phn mm ............ Error! Bookmark not defined.
2. Cc thut ton cn bng ti .......................... Error! Bookmark not defined.
2.1 Thut ton ngu nhin (random)............... Error! Bookmark not defined.
2.2 Thut ton Round Robin (RR) ................... Error! Bookmark not defined.
2.3 Thut ton Weighted Round Robin (Ratio) Error! Bookmark not defined.
2.4 Thut ton Dynamic Round Robin - DRR (Dynamic Ratio) ............. Error!
Bookmark not defined.
2.5 Thut ton Fastest..................................... Error! Bookmark not defined.
2.6 Thut ton Least Connections (LC)........... Error! Bookmark not defined.
2.7 Thut ton Observed ................................. Error! Bookmark not defined.
2.8 Thut ton Predictive................................ Error! Bookmark not defined.
CHNG 3: CI T B CN BNG TI TRONG MNG V LP TRNH
M PHNG THUT TON..................................Error! Bookmark not defined.
1. Cc phng n ci t b cn bng ti vo h thng..Error! Bookmark not
defined.
1.1 B cn bng ti Haproxy........................... Error! Bookmark not defined.
1.2 Ci t n gin vi phng php cookie-insert......Error! Bookmark not
defined.
1.3 Ci t vi kh nng m rng cao ............ Error! Bookmark not defined.
2. Ci t thut ton cn bng ti trn HAProxy ...........Error! Bookmark not
defined.
2.1 Thut ton weighted round robin (WRR)... Error! Bookmark not defined.
2.2 Thut ton least connections ..................... Error! Bookmark not defined.
2.3 Mt s ci tin........................................... Error! Bookmark not defined.
3. Cu hnh v chy chng trnh..................... Error! Bookmark not defined.
KT LUN V NH HNG PHT TRIN .....Error! Bookmark not defined.
1. Tng kt ......................................................... Error! Bookmark not defined.
2. nh hng pht trin ................................... Error! Bookmark not defined.
TI LIU THAM KHO .......................................... Error! Bookmark not defined.
DANH MC CC HNH
S pht trin ca ngnh dch v web khin cho s lng ngi truy cp vo
cc website ngy cng tng mnh, c bit l cc mng x hi o hoc website chia
s video trc tuyn. Cc website ny khng ch cho php ngi dng trao i v
chia s thng tin, giao lu v kt bn m cn cho php ngi dng lu tr ti liu,
tm kim bn b, ngi thn, hay thm ch c i tc kinh doanh. Mc d ch mi
bt u pht trin trong vng 5 nm tr li y nhng mng x hi v cc trang chia
s video trc tuyn c c lng ngi dng ln n con s hng trm triu v
vn ang tng vi tc chng mt.
Vi mng x hi, ngi dng c th chat, email, voice chat, chia s file, vit
nht k c nhn (blog) v cng nhau bn lun v nhng vn m h cng quan
tm. Thm na, ngi dng c th thng qua mng tm kim bn b hay i tc
theo tn (tn s dng hoc email), s thch c nhn (nh th thao, phim nh, ca
nhc) hoc lnh vc quan tm (cng ngh, in nh, kinh doanh). Chnh nhng
tnh nng lm cho ngi dng tm n cc mng x hi ngy cng nhiu hn v
thi gian hng ngy h dnh cho n cng tng ln. C th k ra hng lot cc mng
x hi ang c s lng ngi dng ln nh MySpace, Facebook, Hi5, Friendster,
LinkdeInTheo s liu cp nhp thng 1/2009, myspace c 255 triu ti khon
ng k v ng th 9 trong bng xp hng cc website hng u th gii theo
Alexa, FaceBook c 177 triu ti khon v ng th 4. Cc website mng x hi
khc nh Hi5, Friendsteru c s lng ti khon ng k trn 50 triu.
Vi cc website chia s video trc tuyn cng vy, s pht trin ca cng
ngh k thut s gip cho mi ngi c th d dng to ra cc on clip vui nhn,
hay cc video gia nh, h mun lu tr, mun gi cho bn b khp ni, v vy h
tm n cc website chia s video trc tuyn. www.youtube.com, website chia s
video ln nht hin nay, c trn 6 t video v 100 triu video c xem mi ngy.
Youtube ng th 3 trong bng xp hng thng lng website ca Alexa.
2. Mc ch nghin cu
- Nghin cu tng quan v kin trc web vi kh nng m rng, tm hiu l
thuyt chung v cn bng ti server, cn bng ti database, cn bng ti cho
cache v qun l session.
- Tm hiu cc k thut cn bng ti cho web server, l thuyt xy dng b cn
bng ti cho web server v im mnh yu ca cc thut ton phn ti cho b
cn bng ti.
- Xy dng v ci t th nghim mt s thut ton cn bng ti c bn, thc
thi mt s thut ton cn bng ti tnh v cn bng ti ng.
- Tm hiu cch cu hnh cc b cn bng ti cng vi web server theo cc
iu kin khc nhau, nhm p ng c nhu cu tng h thng web ring
bit.
3. Kt cu lun vn