Está en la página 1de 66

HC VIN CNG NGH BU CHNH VIN THNG KHOA VIN THNG 1 -------***-------

L NGC ANH
XY DNG NG DNG LUNG VIDEO STREAMING QUA MNG NGANG HNG

N TT NGHIP I HC
ti:

XY DNG NG DNG LUNG VIDEO STREAMING QUA MNG NGANG HNG

Ngi hng dn : THS.V TH THY H Sinh vin thc hin : L NGC ANH Lp : D09VT2 Kho : 2009 - 2014 H : I HC CHNH QUY

D09VT2

H Ni, 12-2013

HC VIN CNG NGH BU CHNH VIN THNG KHOA VIN THNG 1 -------***-------

N TT NGHIP I HC
ti:

XY DNG NG DNG LUNG VIDEO STREAMING QUA MNG NGANG HNG

Ngi hng dn : THS.V TH THY H Sinh vin thc hin : L NGC ANH Lp : D09VT2 Kho : 2009 - 2014 H : I HC CHNH QUY

H Ni, 12-2013

NHN XT CA GIO VIN HNG DN


im: ........ (bng ch ..) Ngy . thng 12 nm 2013 Gio vin hng dn

ThS. V Th Thy H

n tt nghip i hc

M u

NHN XT CA GIO VIN PHN BIN

im: ........ (bng ch ..) Ngy . thng 12 nm 2013 Gio vin phn bin

L Ngc Anh D09VT2

n tt nghip i hc

M u

M U Trong nhng ngy u pht trin ca ng dng a phng tin, khong na cui thp nin 90, vic xem mt video trn mng gn nh l iu khng th. Ngy nay, cng vi s bng n ca Internet, cc ng dng a phng tin trong c video streaming tr thnh nhu cu khng th thiu ca nhiu c dn mng. Theo thng k, ring ti M c khong 33 t video c xem trong thng 12-2012 (ngun comScore). Con s trn cho ta thy c s ln mnh khng ngng ca cc ng dng video streaming. Tuy nhin, pht trin mt ng dng video streaming tt gp phi rt nhiu vn . ng dng video streaming i hi nhiu bng thng v yu cu tr thp. Chnh v vy cn phi c mt phng php phn pht video trn ng truyn hp l. IP multicast vi kh nng ti u ha ng truyn l mt gii php cho vn ny. Tuy nhin, vic trin khai IP multicast li rt tn km bi n i hi ton mng phi c nhng Router t tin, chuyn dng. iu ny hon ton khng kh thi trong mt mng din rng nh Internet. Trin khai multicast trn tng ng dng vi vic khng lm thay i h tng mng pha di l mt gii php thay th hu hiu cho IP multicast. Hin nay, trn th gii v ang pht trin rt nhiu phng php truyn tin multicast trn tng ng dng khc nhau. Trong truyn tin multicast da mng ngang hng ha hn c nhiu u im. c th ca truyn tin multicast l phi to c mt cy multicast ti u, c s lin kt cht ch gia cc node vi nhau, c kh nng phc hi li nhanh. Mng ngang hng c cu trc hon ton c th p ng c yu cu vi vic cc node c lin kt vi nhau bng mt thut ton c th. lm r hn nhng li th ca mng ngang hng c cu trc trong vic truyn tin multicast, kha lun ny nghin cu xy dng ng dng truyn video streaming multicast da trn nn tng mng ngang hng c cu trc Pastry. Sau y l tm tt ni dung kha lun gm 3 chng. Chng 1: Tng quan v k thut Video Streaming Trong chng ny gii thiu khi qut v k thut Video Streaming. Cu trc v chc nng ca cc thnh phn trong h thng video streaming. Nu ra cc loi nh dng tp tin video ph bin hin nay. Trong chng I cng cp n vn truyn tin multicast gm truyn tin IP multicast v multicast lp ng dng. Chng 2: H thng lung video qua mng ngang hng P2P

L Ngc Anh D09VT2

n tt nghip i hc

M u

Trong chng ny gii thiu khi qut mng ngang hng P2P. Khi nim v mng P2P v cc kin trc mng ca n. Cc mc tiu, cc thun li, kh khn trong mng P2P. Trnh by cc cch xy dng lp ph cho truyn video streaming, nu mt s h thng ph bin hin nay ang c s dng trn mng nh NICE, CoopNet, HyPONu c cc u nhc im ca cc h thng ny.
Chng 3: Xy dng ng dng lung video streaming qua mng

Pastry Chng ny ch yu m t qu trnh gia nhp, ri nhm, truyn tin multicast ti mng v qu trnh sa cy multicast. Phn kt lun: Tng kt li ton b ni dung lun vn v a ra hng pht trin tip theo. Mc d c gng nhng do kin thc cn hn ch, thi gian lm n khng nhiu, nn n tt nghip ca em khng th trnh khi nhng thiu st v ni dung v hnh thc. Do em rt mong nhn c s gp ca cc thy, c gio bn n ca em c hon thin hn.

L Ngc Anh D09VT2

n tt nghip i hc

Li cm n

LI CM N Trc tin, em mun gi li cm n su sc nht n c V Th Thy H, ngi tn tnh hng dn em trong sut qu trnh hon thnh kha lun tt nghip. Em xin gi li cm n chn thnh su sc nht ti tt c cc thy, c gio trng Hc Vin Cng Ngh Bu Chnh Vin Thng tn tnh ging dy v gip em trong sut hn 4 nm hc va qua em c kin thc hon thnh kha lun ny. Ti cng xin gi li cm n ti tt c bn b D09VT2 ca ti, nhng ngi ng hnh cng ti trong sut 4 nm hc qua. Cui cng, xin gi li tri n n b m v gia nh, nhng ngi thn yu ca ti lng bit n su sc nht. H Ni, thng 11 nm 2013 Sinh vin

L Ngc Anh

L Ngc Anh D09VT2

n tt nghip i hc

Mc lc

MC LC

M U ........................................................................................................................ 1 MC LC ..................................................................................................................... 8 DANH MC HNH V .............................................................................................. 10 TM TT.................................................................................................................... 12 CHNG I: TNG QUAN V K THUT VIDEO STREAMING ................... 13 1.1 Tng quan video streaming ................................................................................. 13 1.1.1 Gii thiu v Video Streaming ...................................................................... 13 1.1.2 Qu trnh Video Streaming ........................................................................... 14 1.1.3 Kin trc h thng video streaming .............................................................. 14 1.2 Cc loi tp tin video ........................................................................................... 17 1.3 Hot ng ca h thng video streaming ............................................................ 19 1.3.1 Kin trc hot ng ca mt h thng Video Streaming ............................... 19 1.3.2 M hnh hot ng tng qut ca h thng ................................................... 21 1.4 Mt s phng thc phn phi lung video ........................................................ 22 1.4.1 IP multicast ................................................................................................... 23 1.4.2 Multicast lp ng dng ................................................................................. 24 1.5 Kt lun chng 1 ............................................................................................... 25 CHNG 2: H THNG LUNG VIDEO QUA MNG NGANG HNG .......... 26 2.1 Phn tch mt s im cn tn ti ca k thut streaming truyn thng ................ 26 2.2 Mng ngang hng Peer-to-Peer ........................................................................... 26 2.2.1 Khi nim ...................................................................................................... 26 2.2.2 u th ca mng ngang hng ........................................................................ 27 2.2.3 Phn loi mng ngang hng .......................................................................... 27 2.2.4 Cc vn cn xem xt trong P2P streaming................................................ 28 2.3 Cc phng php tip cn xy dng lp ph ....................................................... 29 2.3.1 Phng php tip cn dng cy..................................................................... 30 2.3.2 Cc h thng lung trc truyn da trn cy n lung ................................ 31 2.3.3 Phng php tip cn da trn cy a lung ................................................. 35 2.3.4 Cc h thng lung trc truyn da trn cy a lung................................... 36 2.4 Phng thc tip cn da trn li...................................................................... 37
L Ngc Anh D09VT2 8

n tt nghip i hc

Mc lc

2.4.1 Cc h thng lung trc truyn ph bin da trn li .................................. 39 2.5 Video theo yu cu trn P2P ............................................................................... 46 2.5.1 H thng VoD da trn dng cy ................................................................. 47 2.5.2 H thng VoD da trn li.......................................................................... 50 2.6 Kt lun chng 2 ............................................................................................... 52 CHNG III: NG DNG LUNG VIDEO STREAMING QUA MNG PASTRY ......................................................................................................................................53 3.1 Gii thiu v Pastry ............................................................................................. 53 3.2 Qu trnh truyn tin multicast trong nhm Scribe ............................................... 56 3.2.1 Chi tit gii thut ........................................................................................... 57 3.2.2 Qu trnh gia nhp nhm (join group): .......................................................... 58 3.2.3 Qu trnh ri nhm (leave group) .................................................................. 59 3.2.4 Truyn tin multicast ti mng ....................................................................... 59 3.2.5 Sa cy multicast .......................................................................................... 60 3.3 Ci thin Scribe bng cu trc Splitstream .......................................................... 61 3.3.1 Gii thiu SplitStream................................................................................... 61 3.3.2 C ch xy dng lung trong SplitStream .................................................... 62 3.4 Kt lun chng 3 ............................................................................................... 64 KT LUN N .................................................................................................... 65 TI LIU THAM KHO .......................................................................................... 66

L Ngc Anh D09VT2

n tt nghip i hc

Danh mc hnh v

DANH MC HNH V Hnh 1.1 Kin trc ca h thng video streaming ........................................................ 16 Hnh 1.2 Kin trc hot ng ca h thng .................................................................. 19 Hnh 1.3 Lc hot ng tng qut ......................................................................... 21 Hnh 1.4 Lc hot ng trn Server ...................... Error! Bookmark not defined. Hnh 1.5 Lc hot ng qun l Cache trn my ch Streaming ..................Error! Bookmark not defined. Hnh 1.6 Cc phng thc truyn tin trn mng ......................................................... 23 Hnh 1.7 Thnh phn ca IP multicast.......................................................................... 23 Hnh 1.8 (a) IP multicast (b) Multicast lp ng dng ................................................. 25 Hnh 2.1 Phn loi mng ngang hng .......................................................................... 27 Hnh 2.2 Cc loi P2P Streaming ................................................................................. 29 Hnh 2.3 M hnh cy n ............................................................................................ 30 Hnh 2.4 Xy dng li cy Streaming(a)Peer 0 ri (b)M hnh cy sau khi phc hi 31 Hnh 2.5 Gii php tp trung cho cu trc cy v duy tr cy ..................................... 31 Hnh 2.6 Sp xp cc host trong NICE........................................................................ 32 Hnh 2.7 SpreadIt mt ng dng cy multicast xy dng trn cc Peer................... 32 Hnh 2.8 SpreadItKin trc phn lp ca mt Peer ................................................... 33 Hnh 2.9 V d v ESM ............................................................................................... 34 Hnh 2.10 T chc hnh chnh ca Peer trongZigZag ................................................. 35 Hnh 2.11 Cy a lung trn c s Streaming .............................................................. 35 Hnh 2.12 Streaming Media s dng ni dung CoopNet ............................................. 37 Hnh 2.13 Danh sch peer t Tracker Server Hnh 2.14 P2PliveVideo Streaming .. 37 Hnh 2.15 Trao i d liu thit k trong h thng da trn li ................................. 38 Hnh 2.16 S h thng ca mt nt Anysee ............................................................ 40 Hnh 2.17 Kin trc c bn PPLive ............................................................................. 41 Hnh 2.18 Mt s h thng chung cho mt nt DONet .......................................... 42 Hnh 2.19 GridMedia Kin trc Da trn MSOMP ..................................................... 43 Hnh 2.20 Hai lp li/ cy che ph trong mng lai .................................................... 45 Hnh 2.21 Khung mTreebone (a) mt lp ph lai (b) x l trng thi nt ................... 46 Hnh 2.22 Cu trc trc tuyn trong CiqueStream ....................................................... 46 Hnh 2.23 Cu trc DirectStream................................................................................... 49 Hnh 2.24 BASS: (a) Tng quan h thng, (b)Mu khch hng .................................. 51 Hnh 2.25 Phng php tip cn BiToS ....................................................................... 51 Hnh 3.1 Bng nh tuyn ca nt 10233102 trong Pastry ........................................... 55 Hnh 3.2 Nt 10233102 gi thng ip m n nt 33321220 ..................................... 56 Hnh 3.3 Qu trnh 1 nt gia nhp vo nhm ............................................................... 58 Hnh 3.4 Truyn tin multicast trong nhm Scribe ........................................................ 59 Hnh 3.5 Qu trnh t sa cymulticast ........................................................................ 60 Hnh 3.6 Mt v d n gin minh ha cch tip cn ca SplitStream ........................ 62 Hnh 3.7 Splitstream F lung ........................................................................................ 62 Hnh 3.8 Xc nh nt cha khi bng thng i ra vt qu gii hn .............................. 63

L Ngc Anh D09VT2

10

n tt nghip i hc

Thut ng vit tt

THUT NG VIT TT
T vit tt ALM BASS Ting Anh Application Layer Multicast BitTorrent Assisted System Distributed Hash Table Hypertext Transfer Protocol Indentity Input/Ouput Internet Protocol Local Area Network Peer to Peer Quality of Service Real Time Streaming Protocol Transmission Control Protocol User Datagram Protocol Video on Demand Streaming Bng bm phn tn Giao thc chuyn ti siu vn bn S nhn dng u vo/u ra Giao thc mng Internet Mng cc b Mng ngang hng Cht lng dch v Giao thc iu khin phin Giao thc iu khin truyn dn Giao thc lp giao vn Video theo yu cu Ting Vit Multicast lp ng dng

DHT HTTP ID I/O IP LAN P2P QoS RTSP TCP UDP VoD

L Ngc Anh D09VT2

11

n tt nghip i hc

Tm Tt

TM TT
Thi gian gn y, cng vi s pht trin ca cc ng dng a phng tin trn mng Internet, video streamig qua Internet ngy cng thu c s quan tm ca nhiu ngi, c bit l cc ng dng video streaming thi gian thc. IP multicast l gii php hiu qu nht cho yu cu ny. Tuy nhin, vic trin khai IP multicast trn mng din rng gp nhiu vn kh khn. Do vy, nhiu nghin cu chuyn sang hng nghin cu v cc ng dng multicast lp ng dng. Nhiu gii php multicast lp ng dng c a ra. Tuy chng c nhng yu im ring, xong vn cha p ng c hu ht cc yu cu ca P2P streaming thi gian thc, v d nh s ra vo ca cc nt, tr cn ln. Hn na, cc gii php ny cha xt n vn ca cc nt khng ng gp. Lun vn m t chi tit giao thc mng ngang hng c cu trc Pastry v cch thc tuyn tin multicast trn nn mng ngang hng Pastry. Trong kha lun, vn truyn video streaming c cp n. T kha lun xy dng nn ng dng truyn video streaming multicast trn nn Pastry. Vic nh gi kt qu thu c qua qu trnh xy dng cho ta thy c nhng u im ca vic trin khai multicast trn mng ngang hng, cng nh nhng nhc im cn khc phc.

L Ngc Anh D09VT2

12

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

CHNG I: TNG QUAN V K THUT VIDEO STREAMING


1.1 Tng quan video streaming 1.1.1 Gii thiu v Video Streaming Video l mt loi d liu a phng tin quan trng phc v cho truyn thng hoc cho nhu cu gii tr ca con ngi trong nhiu thp nin. Trong thi k u video c x l v truyn di dng tn hiu tng t (analog). Vi s pht trin khng ngng ca mch in t v my tnh dn n s ha video v m ra mt cuc cch mng v nn v truyn thng video. S pht trin v ph bin ca Internet gia nhng nm 90 nh hng truyn thng video qua mng chuyn mch gi best effort. Video qua mng Internet gp phi rt nhiu yu t bt li v bng thng, tr v mt gi tin, cng vi mt s vn nh lm th no chia s ti nguyn mng gia cc lung hay lm th no c th trin khai hiu qu phng thc truyn thng mt nhiu. T c rt nhiu gii php c nghin cu v pht trin nhm khc phc nhng vn ny. Video Streaming c nh ngha l mt dng chy video, ngha l d liu video c truyn lin tc t mt ngun n mt ch no thng qua Internet. Video Streaming thng c s dng trong lnh vc gii tr hoc dy hc, dng lu tr cc tp tin Video hoc cc bi hc, cung cp cho ngi dng cc tin ch nh tm kim, lit k v kh nng hin th hoc hin th li cc d liu Video theo yu cu.Vi cc nh dng tp tin Video truyn thng, d liu ch c th hin th khi c ti v (download) ton b, v vy i vi cc tp tin Video cht lng cao c dung lng ln th cng vic ny s tiu tn rt nhiu thi gian. Video Streaming tit kim thi gian cho ngi dng bng cch s dng cc cng ngh gii nn kt hp vi hin th d liu ng thi trong lc vn tip tc ti video v. Qu trnh ny c gi l k thut m (buffering): Thay v c gi mt ln duy nht, d liu video streaming s c chia thnh tng gi nh, sau lin tc truyn nhng phn c chia ra. Ban u bn nhn s ly v mt phn chia nh ca d liu Video v hin th nhng phn video nhn c, ng thi trong lc hin th cc gi d liu cn li s ln lt c ly v kp cho vic hin th tip theo. Video Streaming c th hin di hai dng: Video theo yu cu (on demand): l cc d liu Video c lu tr trn my ch a phng tin v c truyn n ngi dng khi c yu cu, ngi dng c ton quyn hin th cng nh thc hin cc thao tc (tua, dng, quay li) vi cc on d liu ny. Video thi gian thc (live event): l cc d liu Video c bin i trc tip t cc ngun cung cp d liu theo thi gian thc (my camera, microphone, thit b pht d liu Video).
L Ngc Anh D09VT2 13

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

1.1.2 Qu tr nh Video Streaming Vi Video Streaming my tnh ca ngi s dng khng phi ti ton b Video v cng mt lc. thc hin tng tc ln ti v, ti bt k thi im no my tnh ch cn ti v mt phn thng tin ca Video. Vi k thut ny, chng ta cn mt my ch c bit kim sot vic cung cp cc ni dung Video, bt k phn no ca on Video c lu tr trn my ch u c th c truy cp bt k lc no. Video Streaming: True Streaming: tn hiu Video n theo thi gian thc v hin th ngay lp tc cho ngi xem. Download and Play: Sau khi ti ton b Video v, sau pht Video. Progressive Download and Play: y l cng ngh lai gia hai cng ngh trn. Trong cng ngh ny, Video s c chia nh ra thnh nhiu frame, chng trnh pht Video (player) s hin th ngay nhng gi va c ti v v lu tr d liu b nh m ca my. Khi tua li nhng on Video m ti v, Player s ly d liu t b nh m ti ln. Video Streaming s dng cc giao thc RTSP, MMS, HTTP truyn d liu theo dng lung qua mng Internet, ng thi s dng cc chun nn gim dung lng d liu, cung cp kh nng nn d liu ti nhiu mc nn, nhiu kch thc hin th c th ph hp vi rng bng thng ca nhiu mng truyn dn ti u ho vic truyn d liu qua mng. Cng chnh v vy vic truyn cc Video Streaming qua mng s ph thuc rt nhiu vo cc sn phm phn mm my ch lung Video. Hin nay, c rt nhiu chun cng ngh Video streaming. Cng nh c nhiu nh dng d liu ring vi cc chun cng ngh . Cc nh dng Video streaming ch gii hn bi cc cng ty dn u trong cng ngh streaming: Cc hng ny u cung cp cc b cng c trn gi gm my ch lung video (lu tr, truyn pht d liu theo cc giao thc h tr ...), Video Playe (hin th d liu ti pha ngi dng), v cng c kin to d liu vi cc chun nn. 1.1.3 Kin trc h thng video streaming 1.1.3.1 Kin trc v chc nng c c thnh phn Mt h thng video thng bao gm 6 khi, nh minh ha trong hnh 1.1. Trong hnh 1.1 video v m thanh gi l d liu th c nn bng cch s dng cc thut ton nn video v m thanh ri sau c lu trong thit b lu tr . Theo yu cu t khch hng, mt my ch streaming s ly video v m thanh nn d liu trong cc thit b lu tr v sau cng vi lp ng dng QoS l m-un kim sot iu chnh cc video v m thanh thnh cc lung bit theo tnh trng mng li v cc yu cu QoS. Sau s dng cc giao thc truyn ti nn cc chui bit ri gi cc gi tin video v m thanh qua mng Internet. Gi c th b gim hoc hoc b tr qu mc trong mng Internet do tc nghn, cc gi tin c th b h hng do b li bit. nng
L Ngc Anh D09VT2 14

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

cao cht lng truyn video v m thanh c truyn lin tc, dch v phn phi c trin khai trn mng Internet cho cc gi tin c gi n ngi nhn, s dng giao thc RSTP i qua cc lp vn chuyn v sau c x l bi lp ng dng trc khi c gii m cc b gii m video v m thanh. ng b ha gia video v m thanh , cc c ch ng b truyn thng c yu cu. T hnh 1.1 ta c th thy 6 khi ny lin quan rt cht ch vi nhau v chng l thnh phn thng nht ca kin trc video streaming. C ch nn video. D liu video nguyn gc cn phi c nn trc khi c truyn nhm t c hiu qu tt nht v tit kim bng thng. C ch iu khin cht lng dch v tng ng dng. i ph vi s bin thin ca ti nguyn mng hoc cung cp cht lng hnh nh nhm p ngtheo yu cu ca tng ngi s dng, nhiu k thut iu khin cht lng dch v tng ng dng c a ra. K thut bao gm iu khin tc nghn v kim sot li. iu khin tc nghn c s dng ngn nga mt gi d liu v gim tr kim sot li, mt khc cn nhm ci thin cht lng trnh chiu video khi khng c phn d liu ca gi tin b mt. Dch v phn pht video trn ng truyn. cung cp cc dch v a phng tin c cht lng tt, s h tr ca mng l quan trng. iu ny cho thy do c s h tr ca mng m t c th gim tr khi truyn ti v gim t l mt gi tin. c xy dng trn nn ca Internet (giao thc IP), dch v phn phi video trn ng truyn cho php t c QoS (cht lng dch v) v hiu qu cao cho vic phn pht video qua mng Internet. M y ch streaming. My ch Streaming ng mt vai tr quan trng trong vic cung cp cc dch v trc tuyn. cung cp cc dch v trc tuyn cht lng, cc my ch streaming c yu cu phi x l d liu video vi s rng buc v thi gian, hn ch thi gian tr v h tr hot ng kim sot tng tc nh tm dng (pause), tua (fast forword) tip tc, nhanh chng chuyn tip v nhanh chng quay li. Mt my ch streaming thng bao gm ba h thng con: mt h thng kt ni giao tip (v d, giao thc vn chuyn), mt h iu hnh, v mt h thng lu tr. C ch ng b d liu. Vi c ch ng b, ng dng ti bn nhn c th hin th video gn ging nh khi n c khi to ti bn gi. Mt v d ca c ch ng b l c ng mi ca ngi ni phi ph hp vi ting ni h pht ra. Giao thc cho video streaming. Giao thc c thit k v chun ha cho truyn thng gia khch hng v cc my ch streaming. Giao thc c th c chia lm 3 loi: giao thc tng mng nh Internet Protocol (IP), giao thc tng giao vn nh Use Datagram Protocol (UDP) v giao thc iu khin phin nh Real time Streaming Protocol (RTSP).

L Ngc Anh D09VT2

15

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

Hnh 1.1 Kin trc ca h thng video streaming 1.1.3.2 Cache Vi nhng h thng my ch trnh chiu Video trc truyn hoc cung cp cho vic ti v theo yu cu ngi dng ang c s dng hin nay, th vi mi yu cu ca ngi dng n s c my ch x l thng tin m bo yu cu ti l hp l thit lp kt ni. Tip sau , n s truy xut n cng (hoc thit b lu tr cc b) truy xut tp tin yu cu v gi v cho ngi dng. Nh chng ta u bit tc truy xut cng thng kh chm. Bn cnh , c nhng tp tin c nhiu dng cng quan tm trong mt thi im (sai khc nh v thi gian), vic truy xut cng lin tc truy xut cng mt tp tin nh cch lm vic hin ti l rt lng ph v tn km cho my ch. gii quyt vn ny, ta a ra gii php s dng Cache. Cache c hiu theo ngha thng l ni lu tr d liu nm ch phn cng x l, nhm mc ch tng tc x l. Cache c th l mt vng lu tr ca b nh chnh hoc mt thit b lu tr tc cao c lp. C rt nhiu loi Cache c bit n hin nay vi nhng chc nng khc nhau nh: Cache ca CPU, Caching ca Internet Browser, Caching ca OracleC th y ta quan tm n mt c ch x l Video Caching ngay trn my ch thay th cho Web Caching qu ti hin nay. Vic u t cho thit b Cache cng vi vic c mt gii php qun l Cache hiu qu s gim ti rt nhiu cho my ch. Cch thc hot ng thng qua Cache: D liu c truy xut t cng c y ln Cache. Vi mi yu cu t ngi nhn gi ti, my ch s tm kim d liu tn ti trn Cache cha, thc hin y d liu ln Cache, nu tn ti th d liu t Cache thng qua qu trnh x l d liu s c truyn trc tip n ngi
L Ngc Anh D09VT2 16

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

dng thng qua qu trnh x l d liu s c truyn trc tip n ngi dng thng qua mt lung tin (b qua giai on truy xut t cng). C ch qun l d liu trn Cache, quyt nh d liu no c a vo Cache hoc loi b ra khi Cache, chng ta phi thng qua vic phn tch thng tin truy xut d liu, cng vi th nghim nhng s liu thc thc t a ra mt gii thut qun l Cache hp l . 1.2 C c loi tp tin video Cc tp tin Video thng thuc 2 loi: codec v khng codec. Mt s nh dng tp tin, ch cn nhn vo ui tp tin ta bit c loi codec m tp tin s dng nh: WMV, RM, MOV Hoc cc loi ui tp tin khng ch nh chnh xc loi codec no nh: MP4, AVI, MKV Cc loi tp tin trn u l cc hp ng (container) cha ni dung, chng ta thng phi s dng cc trnh media player m v c cc tp tin . bit tp tin s dng loi codec no m ha. Ta xem xt mt s loi nh dng tp tin m cc website v cc nh cung cp ln thng h tr: nh dng Gii thiu

3GP 3GPP Multimedia

nh dng 3GP l nh dng Video c pht trin bi d n 3rd Generation Partnership da trn chun MPEG-4. c s dng cho cc tp tin a phng tin trn mng khng dy 3G tc cao, s dng ph bin trn in thoi c h tr quay phim.

ASF Advanced Systems Format

nh dng ASF c Microsoft pht trin. nh dng ny c dng truyn ti cc tp tin a phng tin cha vn bn, ha, m thanh, Video. Tp tin ASF ch yu l tp tin Windows Media Audio v Windows Media Video. Tp tin ASF ch c t cu trc ca tp tin video hay m thanh c truyn ti m khng ch r phng php m ha.

L Ngc Anh D09VT2

17

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

nh dng AVI cng c pht trin bi Microsoft v cha d Audio Video liu c m ha theo cc codec khc nhau (c th dng cc codec nh DivX m ha tp tin AVI). nh dng AVI bao gm hai loi Interleave nh dng chnh DivX, Xvid. y l mt nh dng rt ph bin hin nay. AVI l mt sn phm ca RIFF. D liu ca tp tin c chia trong cc khi, mi khi c xc nh bi mt nhn. Khi u tin cha d liu v Video, nhng thng tin v chiu di, chiu rng, t l khung. Khi th 2 cha d liu tht s ca tp tin AVI. Khi th 3 cha cc ch mc ca cc khi d liu trong tp tin. AVI FLV Flash Video Flash Video l mt nh dng Video thng c dng cho nhng website chia s nh Youtube hoc nhng website chiu phim trc tuyn, c pht trin bi Adobe System (Macromedia). H tr 2 loi nh dng FLV v F4V. Flash Video: ni dng nhng trong tp tin SWF v phn m rng FLV cha thng tin tp tin. nh dng ny c cht lng chp nhn c, trong khi kch thc tp tin nh, nn rt hiu qu trong mi trng Internet. Ph hp vi h thng trnh chiu Video trc tuyn ni chung v h thng dy hc bng Video ni ring. nh dng MPEG-4 l mt tiu chun c pht trin bi Moving Picture Experts Group, c s dng trn rt nhiu in thoi v cc thit b chi Video (cn gi l thit b chi MP4). QuickTime Movie l nh dng c Apple pht trin. Cng l mt nh dng thng c s dng trn Internet.

MP4 MPEG4 Video MOV Apple QuickTime Movie RM Real Media

Real Media l nh dng c pht trin bi RealNetworks. Real Media cha c thng tin v Video (Real Video) v m thanh (Real Audio). Thng c dng truyn ti cc tp tin a phng tin thng qua internet.

L Ngc Anh D09VT2

18

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

nh dng VOB lin quan n DVD Video Movie File. Mt tp DVD Video tin VOB thng cha cc lung a cng (multiplex) gm: Video, m thanh v ph . Object VOB WMVWindows Media Video Windows Media Video l mt nh dng tp tin thng gp nht cng c pht trin bi Microsoft. Tp tin Windows Media cha Video c m ha theo b codec Windows Media Video v m thanh c m ha theo codec Windows Media Audio codec. Tp tin WMV c thit k dng cho ng dng lung (thread) trn Internet. Dung lng tp tin WMV kh thp nn d dng truyn ti trn mng, tuy nhin chp lng hnh nh v m thanh khng thc s tt.

1.2 Hot ng ca h thng video streaming 1.3.1 Kin trc hot ng ca mt h thng Video Streaming Mt h thng Video treaming hot ng ch yu gm 3 thnh phn: Web server, Server v Client.

Hnh 1.2 Kin trc hot ng ca h thng


L Ngc Anh D09VT2 19

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

Web server Web Server l my ch c dung lng ln, tc cao, l ni lu tr thng tin v cc website c cung cp dch v chia s video trc tuyn (nhng Website ny nhng m embeded flash player do nh cung cp dch v lu tr v qun l tp tin cung cp) cng vi nhng thng tin lin quan khc. Khi my ch Web nhn yu cu t my khch v vic xem mt video c trong danh sch video m Website cung cp, th n s gi v my khch: on m html tnh cha tp tin embeded flash v tp tin xml cha thng tin ca video . Server Server l mt my ch gm c: cng (Hard disk) cha d liu v my ch qun l dng qun l qu trnh kt ni ca cc my khch (thng qua mt cng nht nh). Hard Disk: cng lu tr tp tin video ca nh cung cp. Server Manager: o To my ch vi cng c la chn, ch ngi dng kt ni ti. o Qun l ngi dng kt ni da trn IP. o Qun l nhng tp tin video c a vo cache. o Qun l vic la chn gi phn no ca tp tin video v cho ngi dng. My ch Video Streaming: o Khi nhn c yu cu t pha ngi dng ly mt tp tin video, my ch Video Streaming tm tp tin di cng v y vo thit b Caching. o Ti thit b Caching, tp tin video c ct ra thnh nhiu gi nh lu tr. o Sau tng gi ca tp tin video s c a qua mt c ch nn v m ha trc khi gi v ngi dng.(3) Client Truy cp vo web browser, chn tp tin video cn xem v bm play, lnh yu cu play tp tin video s c gi ln my ch Web.(1) Web browser s nhn software player (trong on m html tnh cha tp tin embeded flash) v thc hin kt ni vi server.(2) Software player nhn nhng video stream v thc hin vic gii nn, gii m trc khi hin th Video ln cho ngi dng. Tm li: Web Server: tr v ngi dng on html tnh, ni dung tp tin cha embeded flash. Server: lu tr tp tin video, gi tp tin video c yu cu v ngi dng. Client: nhn thng tin t my ch Web v kt ni n my ch (vi thng tin nhn c t my ch Web tng ng v tp tin video chn).
L Ngc Anh D09VT2 20

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

1.3.2 M h nh hot ng tng qu t ca h thng

H nh 1.3 Lc hot ng tng qut T hnh 1.3 ta c m hnh hot ng chi tit bn pha Server

H nh 1.4 Lc hot ng trn Server


L Ngc Anh D09VT2 21

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

H nh 1.5 Lc hot ng qun l Cache trn my ch Streaming 1.4 Mt s phng thc phn phi lung video Trong h thng mng ca chng ta hin nay c 3 cch truyn video c bn l unicast, multicast v broadcast (hnh 1.6). Unicast: l phng thc truyn tin c s ca IP network. Vi unicast mt my truyn v ch c mt my nhn theo kiu point to point. Hin nay hu ht cc ng dng mng c pht trin v s dng trn nn phng thc unicast nh HTTP, Telnet, FPTNhng vi nhng ng dng i hi phi truyn tin t mt ngun ti mt nhm ngi dng nh video streaming th vic trin khai trn unicast l khng hiu qu v truyn tin multicast l gii php thay th. Multicast: l cch truyn d liu mt nhiu (one to many), tc l d liu c gi t mt nt ngun v mt nhm nt ch s nhn c cng d liu . Cc truyn ny khc vi unicast gi thng tin trn mng theo cch truyn gi tin mt mt (one to one). Nu multicast c th so snh vi cuc gi chung cho nhiu ngi (conference call) th unicast c th so snh vi cuc gi ring gia 2 ngi. Broadcast: c m t nh truyn tin cho ton mng, tt c cc im trong mng u nhn c thng bo ny. Trong trng hp ny ch mt ngi gi nhng tt c ngi trong mng u nhn c. Broadcast c h tr trong mng LAN (v d nh Ethernet) v c s dng gi nhng gi tin ging nhau n cc my trong mng LAN (v d ARP c s dng gi a ch n ton b my trong mng LAN). Giao thc lp mng nh IP h tr khun dng gi tin gi n bt k h thng no trong logical network.
L Ngc Anh D09VT2 22

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

C th ni, multicast l cch thc hiu qu nht truyn video n mt nhm ngi trn Internet. Chng ta cng c th s dng unicast truyn tin ln lt t ngun n tng nt trong nhm. Tuy nhin, vi cch ny th nt ngun s phi lp i lp li vic truyn mt gi video cho rt nhiu cc nt khc nhau, dn n vic tiu tn ti nguyn ca nt ngun (CPU, memory). ng thi s c rt nhiu gi video khng cn thit c lu thng trn mng, dn n lng ph ti nguyn mng. Vi multicast, mt cy multicast s c hnh thnh vi ngun l gc ca cy v cc thnh phn cn li ca cy c th l nt u cui (end host) hoc c th l cc router. iu ny ty thuc vo cc cng ngh multicast khc nhau. Thay v vic nt ngun nhn bn gi tin v gi n tng nt trong nhm th n ch truyn cho mt hoc vi nt nht nh v cc nt ny c nhim v sao chp v truyn gi tin theo cy multicast.

H nh 1.6 C c phng thc truyn tin trn mng 1.4.1 IP multicast Ip multicast l chun m ca IETF (Internet Engineering Task Force) dng truyn d liu ti nhiu ngi nhn. Trong IP multicast, cc router s ng vai tr l nt trung gian trong cy multicast v c trch nhim sao chp gi tin ri truyn cho cc nt ng dng. y, cc nt ny s ng vai tr l ngn ca cy.

Hnh 1.7 Thnh phn ca IP multicast


L Ngc Anh D09VT2 23

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

Trong IP multicast, mi nt s gi yu cu mt router gn vi n khi mun gia nhp hoc ri khi nhm. Sau cc router multicast s trao i cc thng tin v vic qun l nhm thng qua cy multicast. IP multicast l gii php hiu qu nht cho cc k thut video streaming qua Internet v cc ng dng video streaming thi gian thc. Vi kin trc IP Multicast ang s dng hin ny trin khai trn h thng mng Internet ang thc s gp cc vn kh khn: Khi trin khai trn h thng ln nh Internet, cc router phi lu tr rt nhiu trng thi ca cc nhm. y thc s l mt vn ln khi s nhm tng ln cao. To v duy tr mt cy multicast mt rt nhiu ti nguyn v thi gian. Khi c qu nhiu kt ni hoc mt nt mng khng hot ng s gy ra ri mng v phi sa cha li nhiu phn ca cy. Vic cn bng ti v nh tuyn li cy cha c x l tht tt. Vn ln nht ca vic trin khai IP Multicast l chi ph thay th li h tng mng c xy dng l cc k ln. Do vy, nhiu nghin cu chuyn sang hng nghin cu v cc ng dng multicast lp ng dng, nhm khc phc nhng nhc im trn. 1.4.2 Multicast lp ng dng Do nhu cu s dng truyn thng multicast ang ngy cng ln, trong khi giao thc IP multicast tng mng cha p ng, do vy xu hng multicast ngy cng c m rng sang multicast lp ng dng. Multicast lp ng dng khng thay i v ph v h thng mng. Thay vo , n ch thc hin chc nng truyn multicast trn cc my cui lp ng dng. T lp ng dnga s truyn xung cc lp mng v lp giao vn. cc lp thp hn, c ch hon ton khng thay i. Khi nim multicast lp ng dng ch n gin l vic thi hnh multicasting nh mt dch v lp ng dng ch khng phi nh mt dch v lp mng. Hnh 1.8 m t vic truyn tin multicast cho cng mt nhm ngi nhn v ngi gi ca multicast lp ng dng v IP multicast. y, cy multicast c hnh thnh lp ng dng. Vi vic ch s dng phng thc truyn tin unicast ca lp mng, nt ngun S gi hai gi tin cho D1 v D2; ti D1, D2 gi tin c nhn bn v chuyn tip cho D4, D3.

L Ngc Anh D09VT2

24

n tt nghip i hc

Chng I: Tng quan v k thut video streaming

Hnh 1.8 (a) IP multicast

(b) Multicast lp ng dng

Khi truyn multicast lp ng dng, cc gi tin khng c nhn bn ti cc b nh tuyn ging nh m hnh multicast nguyn thy (IP multicast) m vic nhn bn gi tin s c thc hin ti cc my u cui. V mt logic, cc my u cui to nn mt mng ph v giao thc truyn thng multicast phi xy dng v duy tr vic truyn multicast trn mng ph ny. Trong multicast lp ng dng, cc cng vic iu khin nh gia nhp nhm, ri khi nhm, sao lu v chuyn tip gi tin, nh tuyn multicastu c thc hin ti im u cui (end system hoc proxy). Do , n khng i hi s h tr ca cc nt trung gian nh b nh tuyn hoc my ch chuyn dng. 1.5 Kt lun chng I Trong chng ny gii thiu tng quan k thut lung video t khi nim, qu trnh hot ng cng nh cu trc v chc nng ca cc thnh phn trong h thng video streaming. Nu ra cc loi nh dng tp tin video ph bin hin nay. Trong chng 1 cng cp n vn truyn tin multicast gm truyn tin IP multicast v multicast lp ng dng. Qua nghin cu, ti nhn thy: Tm quan trng ca giao thc multicast lp ng dng trong vic truyn video streaming. Cng nh cng ngh streaming video pht trin rt nhanh, cc nh nguyn cu v pht trin dng nh rt hng th trong lnh vc ny. Chng ta c th hon ton hy vng cht lng ca video streaming t c mc cht lng TV truyn thng, thm ch bng c cht lng DVD.

L Ngc Anh D09VT2

25

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

CHNG II: H THNG LUNG VIDEO QUA MNG NGANG HNG P2P
2.1 Phn tch mt s im cn tn ti ca k thut streaming truyn thng K thut streaming truyn thng da trn h thng Client - Server cung cp hiu sut tt v t l sn sng cao nu s lng khch hng c gii hn. Tuy nhin, vic trin khai v chi ph bo tr ca cc h thng ny thng rt cao. c tnh hin ti cho chi ph ca YouTube l 1 triu USD mi ngy v cc chi ph c th tng ln nhanh nu nhiu video tip tc c chuyn sang cht lng cao hn. Trong thc t, nhiu dch v lung trc tuyn hin nay u c phn gii tng i thp tit kim bng thng. Cht lng ca cc dch v lung trc tuyn thng khng th so snh c vi mng li truyn hnh truyn thng. Do qun l ti nguyn l mt vn quan trng trong vic trin khai k thut streaming trn Internet. Mt khc, kh nng x l, dung lng lu tr, lu lng ca my ch I/O c th to thnh nt tht c chai. Mt khc, s lng ln cc kt ni mng ng di cng c th dn n tc nghn lu thng. Do , h thng khng th p ng yu cu thc hin ca cc ng dng lung a phng tin quy m ln, thi gian thc. Tuy nhin, k thut IP multicast c cung cp gii quyt nhng vn ny cn s h tr t phn cng c bit v cc chi ph thit lp c s h tng v qun l l rt tn km. V bn cht, cc k thut truyn thng khng th gii quyt hiu qu nhng vn ca video streaming. Do , m hnh phn phi lung video quy m ln qua mng Internet ang ni ln. Mng P2P c chp nhn rng ri nh l mt cch gii quyt cc vn ti nguyn vi cc ng dng lung Internet nh VoD , live streaming v cung cp mt s thay th cho h thng client - server. 2.2 Mng ngang hng Peer-to-Peer 2.2.1 kh i nim Mt mng my tnh ngang hng (Peer to Peer hoc P2P) ch yu da trn sc mnh tnh ton v bng thng ca cc my tham gia trong mng hn l tp trung vo mt s lng nh cc my ch (server). Mng P2P c s dng in hnh cho vic kt ni cc nt thng qua nhng kt ni ad hoc ln. Nhng mng nh vy c ch cho nhiu mc ch s dng. Chia s file cha audio, video, data hoc mi th nh dng s, cc d liu thi gian thc, v d nh truyn ti ging ni, video streaming u c th thc hin vi cng ngh P2P. Mt mng P2P thun ty s khng c khi nim v khch (clien) v ch (server), m ch c nhng nt ngang hng thc hin c hai chc nng ca mt my ch v my khch i vi nhng nt khc trong mng. M hnh mng ny khc vi m hnh mng khch ch (server client) m vic giao tip thng l vi cc my ch trung tm. Mt v d in hnh cho vic truyn file theo m hnh khch ch l gia mt FTP Client v mt FTP Server, hai chng trnh FTP Client v FTP Server c vai tr rt
L Ngc Anh D09VT2 26

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

khc nhau, client khi to vic download/upload file cn server th tip nhn v phc v cc yu cu . 2.2.2 u th ca mng ngang hng Mc ch quan trng ca mng ngang hng l trong mng tt c cc my tham gia u ng gp ti nguyn, bao gm bng thng, lu tr, v kh nng tnh ton. Do khi cng c nhiu my tham gia v mng th kh nng tng th ca h thng mng cng ln. Ngc li, trong m hnh my khch ch, nu s lng my ch l c nh th khi s my khch tng ln th kh nng chuyn d liu t cc my ch cho mi my khch s gim xung. Tnh cht phn tn ca mng ngang hng cng gip cho mng hot ng tt khi mt s my gp s c. i vi cu trc tp trung, ch cn my ch gp s c th c h thng s ngng tr. 2.2.3 Phn loi mng ngang hng Mng ngang hng P2P c chia lm hai loi chnh: mng ngang hng thun ty v mng ngang hng lai ghp ( Hnh 2.1)

Hnh 2.1 Phn loi mng ngang hng 2.2.3.1 Mng ngang hng thun ty Mng ngang hng thun ty c chia lm 2 loi: Mng ngang hng c cu trc v mng ngang hng khng cu trc. Mng ngang hng khng cu trc: l khi cc lin kt gia cc nt mng trong mng ph c thit lp ngu nhin (tc l khng theo quy lut no). Nhng mng nh th ny d dng c xy dng v cc my mi khi mun tham gia mng c th ly cc lin kt sn c c mt my khc ang trong mng v sau dn dn t bn thn n s thm vo cc lin kt mi ca ring mnh. Khi mt my mun tm mt d liu trong mng ng ng khng cu trc, yu cu tm kim s c truyn trn c mng tm ra cng nhiu my chia s cng tt. S hiu bit v mng ca cc nt trong mng khng cu trc l rt t, mi nt ch nm bt thng tin v nhng nt
L Ngc Anh D09VT2 27

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

lin kt trc tip v mt s t cc nt khc, thng tin v nhng nt cn li hon ton thng qua Broadcast. Chnh v vy, vi nhng ng dng cn c s lin kt cht ch gia cc nt vi nhau nh multicast th mng ngang hng khng cu trc khng phi l s la chn ti u. Mng ngang hng c cu trc: Khc phc nhc im ca mng khng cu trc bng cch s dng h thng DHT (Distributed Hash Table Bng bm phn tn). H thng ny nh ngha lin kt gia cc nt mng trong mng ph theo mt thut ton c th, ng thi xc nh cht ch mi nt mng s chu trch nhim i vi mt phn d liu chia s trong mng. Vi cu trc ny, khi mt my nh tuyn thng bo, n ch cn p dng mt giao thc chung xc nh nt cn thng bo v sau lin lc trc tip n nt mng . Bi vy vic to cy multicast s din ra rt d dng v vic qun l cy cng c nhiu thun li khi cc nt u c lin kt cht ch vi nhau. Mt s mng ngang hng c cu trc ni ting bao gm Chord, CAN, Kademlia, Pastry v Tapestry. 2.2.3.2 Mng ngang hng lai ghp Trong m hnh mng ngang hng lai ghp, tn ti mt server trung gian c trch nhim iu khin hot ng ca mng. Server ny lu tr cc ch mc bao gm thng tin v cc nt m n qun l v v tr cc cp key value trn mng. Cc nt trong mng phi to lin kt vi server ny. Mt nt mun trao i thng tin vi mt nt khc th n s phi lin lc trc tip vi server, sau server s tm kim trong c s d liu v gi li a ch nt ch. Qu trnh trao i thng tin sau c din ra trc tip gia 2 nt. Vic trin khai truyn tin multicast trn mng ngang hng lai ghp gn ging nh m hnh proxy base ALM. Nhc im chnh ca n vn l chi ph cao cho cc server trung gian. ng dng in hnh cho m hnh mng ny l Napster. 2.2.4 C c vn cn xem xt trong P2P streaming Trong vi nm qua, mng P2P xut hin nh l mt phng php thun li cho vic cung cp cc ni dung a phng tin trn nn mt mng ph ln. Cc c tnh bn trong mng P2P lm cho cc m hnh P2P tr thnh mt ng c vin tim nng gii quyt cc vn khc nhau trong truyn thng a phng tin trn mng Internet. P2P Streaming l gii php tt hn v hai l do. u tin, mng P2P khng cn s h tr t cc b nh tuyn Internet v do chi ph hiu qu v n gin trin khai. Th hai, mt peer ng thi hot ng nh mt client cng nh server, do c th ti xung mt lung video v cng mt lc ti ln lung video cc peer khc xem chng trnh . Do , truyn ti P2P lm gim ng k nhu cu bng thng ca nt ngun. Mc tiu ca c ch P2P streaming l ti a ha cht lng phn phi ni dung cho cc im peer ring l . Tng hp ngun ti nguyn c sn ca cc peer v c kh nng m rng n s lng bt k cc im tham gia. Mi peer c th tip tc cung cp ni dung ph hp vi cc peer kt ni vi n trong lp ph bng cch s dng bng thng ca cc im peer ang tham gia. Tuy nhin, vic cung cp cc dch
L Ngc Anh D09VT2 28

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

v P2P streaming video cho mt s lng ln ngi xem to ra nhng thch thc cng ngh rt kh khn trn c h thng v ti nguyn mng. Trong khi cc ng dng phn phi file P2P truyn thng nhm mc tiu truyn d liu linh hot, P2P streaming tp trung vo vic phn phi hiu qu cc ni dung audio v video theo yu cu thi gian rng buc. Lung d liu c nhn, pht ngay lp tc v truyn cho cc im peer lin quan khc. V d: ng dng chia s file P2P, BitTorrent cho php cc im peer trao i on bt k ca cc ni dung c phn phi m n l khng quan trng th t. Ngc li, cc k thut nh vy l khng kh thi trong ng dng streaming. Cc tp tin video c pht trc tip trong lc n ang c ti xung. Ngoi ra, cc peer hn ch kh nng ti ln, m xut pht t thc t l Internet c thit k cho cc m hnh client server v cc ng dng. Hn na, h thng streaming chu vic rt gi tin hoc chm tr do tc nghn mng. Trong P2P streaming, tr end-to-end t ngun n ni nhn ln bi v ni dung c th phi i qua mt s ni nhn trung gian. Hnh vi ca ngi nhn l khng th on trc, h c t do tham gia v ri b bt c lc no, do loi b cc peer k tip ca h. Ngi nhn c th phi lu mt s cu trc d liu cc b v trao i thng tin trng thi vi nhau bo v cc kt ni. Cc chi ph kim sot mi im nhn p ng mc ch nh vy s nh gi cho khng s dng qu nhiu ti nguyn mng v khc phc hn ch ti nguyn mi im nhn. iu ny l quan trng i vi kh nng m rng ca h thng vi mt s lng ln cc im nhn. Vic cu trc cc nt thnh lp mt mng ph cung cp video m bo QoS. Mt khc, h thng c quy m m rng nn c th cha hng chc ngn ngi nhn ti cng mt thi im. ng thi, cc chi ph qun l lin quan hp l ngay c quy m ln. 2.3 C c phng ph p tip cn xy dng lp ph K thut streaming trong cch tip cn P2P c phn loi thnh truyn video thi gian thc (P2P live video streaming) v truyn video theo yu cu (P2P on demand video streaming). Mt s h thng P2P streaming c trin khai cung cp xem video theo yu cu hoc cc dch v truyn video trc tuyn qua Internet.

Hnh 2.2 Cc loi P2P Streaming Da trn cu trc mng che ph, h thng P2P streaming c sp xp thnh ba loi: tree-based (phng thc tip cn dng cy), mesh-based (phng thc tip cn
L Ngc Anh D09VT2 29

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

dng li) and hybrid schemes (phng thc tip cn dng n). Phng php tip cn tree-based s dng phng php y d liu phn phi ni dung. Tuy nhin, phng php tip cn mesh-based s dng trn lt d liu phn phi ni dung. 2.3.1 Phng ph p tip cn dng cy Tng t nh mt cy IP multicast c hnh thnh bi cc b nh tuyn lp mng, cc ngi dng tham gia vo mt phin video streaming c th to thnh mt cy lp ng dng c gc c bt ngun t my ch video ngun nh hnh 2.3. V nguyn tc, mi nt nhn d liu t mt nt cha, c th l nt ngun hoc mt peer. Cc h thng da trn cy thng phn phi video bng cch ch ng y d liu t mt peer ti cc nt con ca n. Mt cch tip cn chung ca P2P streaming l sp xp cc peer tham gia vo mt lp ph c cu trc cy n lung m ni dung c y i t ngun ti tt c cc peer. Ni dung c lan truyn nh mt dng chy lin tc ca thng tin t ngun xung. Mi ngi dng tham gia vo cy v tr nht nh. Cc h thng loi ny ch yu l khc nhau trong cc thut ton c s dng to ra, duy tr cu trc cy. Cho mt tp hp ca cc im peer, c rt nhiu cch kt ni cc peer. Mc tiu ca thut ton xy dng cy l ti a ha bng thng ti gc ca tt c cc nt. V cc h thng ny rt gn vi IP multicast, c gng m phng cu trc cy ca n, n c th t c di ng truyn d liu tng ng m khng chnh lch qu nhiu t cc ng dn IP multicast.

H nh 2.3 M h nh cy n Xy dng v duy tr cy c th c thc hin tp trung hoc mt cch phn tn trong h thng cy n lung. Trong hnh 2.4 & 2.5, mt my ch trung tm qun l xy dng cy v phc hi cy. Khi mt peer tham gia h thng n giao tip vi my ch trung tm. Da trn cc kt ni hin c v c tnh ca cc peer mi c tham gia vo nh v tr v im truy cp mng, my ch quyt nh v tr ca peer mi trong cy v thng bo nt cha peer mi c kt ni vo. Cc my ch trung tm c th pht hin mt peer tch ra thng qua tn hiu mt hoc phn on da trn ch s thi gian u ra. Trong c hai trng hp my ch s tnh ton li cu trc lin kt cy cho
L Ngc Anh D09VT2 30

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

s peer cn li v ch dn chng to thnh cu trc lin kt mi. i vi mt h thng streaming ln, my ch trung tm c th tr thnh im nt tht c chai. gii quyt vn ny, cc thut ton phn phi v d ZigZag c pht trin xy dng v duy tr cy streaming phn phi ni dung. Nu cc peer khng thay i mt cch thng xuyn, h thng da trn m hnh cy i hi t chi ph nh cc gi tin c chuyn tip t peer ti peer m khng cn phi thm bn tin thng bo. Tuy nhin trong mi trng t l bin ng cao, cy s thng xuyn thay i v phi xy dng li. Do , cc peer cn phi m d liu (buffer data) t nht l bng thi gian cn thit cho sa cha cy trnh khi mt gi.

Hnh 2.4 : Xy dng li cy Streaming (a) Peer 0 ri (b) M hnh cy sau khi phc hi

Hnh 2.5 Gii php tp trung cho cu trc cy v duy tr cy 2.3.2 C c h thng lung trc truyn da trn cy n lung 2.3.2.1 Giao thc NICE H thng ph bin nht s dng cch tip cn cy n lung l NICE. NICE (The Internet Cooperative Environment) c thit k ban u cho bng thng thp v cc ng dng truyn d liu vi mt s lng ln ngi dng. Giao thc sp xp cc trm cui (host) vo trong mt h thng phn cp da trn thi gian thng tin chuyn i vng quanh gia cc host hnh 2.6. Cc hot ng c bn ca giao thc l to ra v duy tr cc tuyn ng trong h thng. Mi thnh vin gi chi tit trng thi v cc thnh vin khc gn n trong h thng phn cp. V ch c kin thc hn ch v cc
L Ngc Anh D09VT2 31

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

thnh vin khc trong nhm. Cu trc phn cp cng rt quan trng cho xc nh v tr ca cc thnh vin tht bi.

Hnh 2.6 Sp xp cc host trong NICE. 2.3.2.2 Giao thc SpreadIt SpreadIt xy dng ng dng cy multicast trn cc thit lp ca khch hng. Cc nt c t chc thnh cc cp khc nhau (hnh 2.7 v hnh 2.8). i vi mi nt n mc 1+l; l = 0 , 1 , 2 , c mt nt p c gi l cha ca n, mc l, n c gi l con ca p. Tt c cc nt trong cy con c gc l p c gi l con chu ca n. Mi peer trong cy chu trch nhim vic gi cc d liu cho nt con ca mnh. Mi nt khch hng cn phi c kch hot vi mt lp peering(lp nm gia lp ng dng v lp vn chuyn). Cc lp peering ti cc nt khc nhau phi hp vi nhau thit lp v duy tr mt cy multicast. Cc ng dng (RealPlayer, Windows Media Player, etc) c c lung t cc lp peering trn cc my tnh cc b. SpreadIt s dng mt cy n phn b v nh vy rt d b tn thng do gin on mt nt tch ra.

Hnh 2.7 SpreadIt mt ng dng cy multicast xy dng trn cc Peer

L Ngc Anh D09VT2

32

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

Hnh 2.8 SpreadItKin trc phn lp ca mt Peer 2.3.2.3 Giao thc ESM ESM (End System Multicasst) l mt c s h tng cho pht thanh truyn hnh, thc hin bi i hc Carnegie Mellon. ESM cho php truyn d liu m thanh hnh nh ti mt lng ln ngi s dng. H thng ESM s dng mt cu trc lp ph da trn xy dng mt cy. Cc thng tin c phn phi mt cch truyn thng da trn cy n lung, trong bt k peer no cng ch nhn c lung tin t duy nht mt ngun. Mi nt duy tr thng tin v mt nhm nh ngu nhin ca cc thnh vin khc, cng nh cc thng tin v ng i t ngun n n. Mt nt mi tham gia pht sng bng cch lin h vi ngun v ly danh sch ngu nhin ca cc thnh vin hin ang trong nhm. Sau chn mt trong cc thnh vin lm nt cha ca n bng cch s dng thut ton la chn nt cha. tm hiu v cc thnh vin khc, mt bn tin thm d c s dng. Khi mt nt tham gia vo pht sng hoc cn thc hin thay i nt cha, n d mt tp hp ngu nhin ca cc nt n bit. Cc bn tin thm d c u tin ti cc thnh vin khng c kho st hoc c s tr thp. Hnh 2.9 cho thy mt vi d v nhim v ca ESM. Ngi nhn cui cng c th ng vai tr ca nt cha hoc nt con. Cc nt cha ng vai tr l cc thnh vin v thc hin sao chp. Cc nt con l ngi nhn trc tip d liu t nt cha. C mt my ch iu khin v mt my ch d liu c tr trong cng mt gc ngun. Bt k mt ngi nhn c th ng vai tr ca nt cha chuyn tip d liu cho nt con ca n. Mi khch hng s c hai kt ni: mt kt ni qun l v mt kt ni d liu.

L Ngc Anh D09VT2

33

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

Hnh 2.9 V d v ESM Mt li th ca ESM l n gii quyt cc vn trin khai ca IP multicast. Tuy nhin, multicasting thc hin ti my trm cui hiu nng thp. Ni chung cc trm cui khng x l c thng tin ging nh cc router. Ngoi ra, gii hn bng thng v nhu cu ca vic chuyn tip bn tin t host to host s dng kt ni unicast v do tng tr end-to-end ca qu trnh truyn tin, gp phn tng chi ph phi tr cho cch tip cn ny. l nhng l do lm cho ESM km hn so vi IP multicast. 2.3.2.4 Giao thc ZigZag ZigZag c xut bi trng i hc Central Florida v ci thin giao thc NICE. Cc thut ton xy dng cu trc v bo dng kh ging vi NICE v tt c cc thuc tnh ca giao thc NICE vn cn. ZigZag nhn vo mt h thng cc nhm v xy dng cy munlticast trn h thng phn cp ny theo mt b quy tc c gi l quy tc C (hnh 2.10). Mt nhm c mt nt cha ng u v mt nt lin kt. Nt cha chu trch nhim gim st cc thnh vin ca nhm v nt lin kt chu trch nhim truyn ti nhng ni dung cho cc thnh vin trong nhm. V vy nt cha gp vn khng nh hng n tnh lin tc dch v ca cc thnh vin khc hoc trong trng hp nt lin kt tch ra, nt cha vn cn hot ng v c th ch nh mt nt lin kt mi nhanh chng. Trong khi NICE tt c mi d liu c chuyn tip bi cc nt cha, NICE chu trch nhim chuyn tip d liu l bi nt lin kt. Cc giao thc iu khin trn ZigZag c chi ph thp. Mt my thu cn trao i thng tin iu khin ti O(LogN) my thu khc trong trng hp t nht. ZigZag c p dng tt nht cho cc ng dng lung chng hn nh my ch truyn thng mt s kin th thao di hn trc tuyn cho nhiu khch hng. N khng ph hp cho cc ng dng truyn thng trc tuyn ni nhiu ngun c mt. Hn ch chnh ca ZigZag l n khng xem xt dung lng bng thng ti ln ca peer tham gia vo giao thc. Ngoi ra, ZigZag to ra cy n lung kt ni gia cc peer, n cng c nhng vn chung ca cy n lung nh khng s dng bng thng ti ln ca l, cc nt bn trong cy d b tn thng.

L Ngc Anh D09VT2

34

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

Hnh 2.10 T chc hnh chnh ca Peer trong ZigZag 2.3.3 Phng ph p tip cn da trn cy a lung Cc gii php cy n lung c l l cch tip cn t nhin nht v n khng yu cu phc tp thut ton m ha video. Tuy nhin, mt trong nhng mi quan tm vi cch tip cn da trn cy n lung l s tht bi ca cc nt, c bit l nhng nt c v tr cao trong cy c th lm gin on vic cung cp d liu cho mt lng ln ngi dng dn n kt qu thu c km. Nu mt nt bn trong ti nguyn bng thng khng p ng phc v cc nt con ca n, cc peer trong cy s b nh hng tr cao trong tip nhn d liu hoc s khng bao gi nhn c gi tin. Cc h thng ny khng khai thc tt tt c cc ti nguyn peer c sn v c bit bng thng. V d, cc nt l chim mt phn ln cc peer trong h thng v h khng ng gp bng thng vo h thng, iu lm cc peer s dng bng thng khng hiu qu. p ng mi quan tm, cc nh nghin cu nghin cu cu trc tt hn cho vic phn phi d liu. c bit, mt trong nhng cch tip cn tr nn ph bin l phng thc tip cn trn cy a lung.

Hnh 2.11 Cy a lung trn c s Streaming Trong cch tip cn cy a lung (hnh 2.11), mt c cu xy dng cu trc cc peer tham gia trong cy a lung. Mi peer xc nh mt cy tham gia da trn lin kt bng thng truy cp. Mi peer c t nh mt nt ni b trong mt cy n lung v nt l trong cy khc m n tham gia. Khi mt peer tham gia h thng, n
L Ngc Anh D09VT2 35

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

tip xc vi nt khi ng (bootstrapping) xc nh mt nt cha trong cy. Trong cy a lung da trn h thng P2P lung trc tuyn, on video c m ha thnh nhiu lung v mi lung c truyn qua mt cy. Cht lng video nhn c ti cc peer ph thuc vo s lng lung tin m n nhn c. Khi mt nt bn trong ca mt cy tch ra, cc nt con ca n cng nh cc cy c gc l nt tch ra c phn chia li v chng tham gia li cc cy. Vic cung cp ni dung l mt c ch n gin, cc nt ni b trong mi cy ch n gin l chuyn tip bt k gi tin nhn c cho tt c cc nt con tng ng ca n. Do , thnh phn chnh ca cc lung P2P da trn phng php tip cn cy l cc thut ton xy dng cy. C hai li th quan trng cho cc gii php cy a lung. u tin, nu mt mng ngang hng b ph hoc b i, tt c cc nt con ca n mt i lung gi t cc peer, nhng n vn nhn c cc lung phn phi d liu qua cc cy khc. Do , tt c cc nt con ca n s nhn c lung video trong trng hp mt i lung gi t mt lung. Th hai, mt peer ng vai tr khc nhau nh nt ni b cng nh cc nt l trong cy khc nhau. Nu cc peer khng thay i qu thng xuyn, h thng cy a lung trc tuyn i hi t chi ph, v cc gi tin c chuyn tip t nt ti nt m khng cn thng bo thm. Tuy nhin, trong mi trng bin ng cao, cy lin tc b thay i v xy dng li. Qu trnh ny i hi ng k bn tin qun l qu trnh trn. Do , cc nt phi m d liu t nht l thi gian cn thit cy sa cha, trnh mt gi tin. 2.3.4 C c h thng lung trc truyn da trn cy a lung Vi ng dng c xy dng trn khi nim cy a lung ph bin ngy nay. V d nh SplitStream and Coopnet. y ta ch xem xt ti h thng CoopNet 2.3.4.1 CoopNet CoopNet (Cooperative Networking) kt hp cc kha cnh ca c s h tng da trn h tng mng P2P. N s dng nhiu m ha thc hin truyn ni dung trn lp x l , sau truyn ni dung trong cc lp khc nhau theo nhng con ng khc nhau. Mt my ch giu ti nguyn ng vai tr trung tm trong vic xy dng v qun l cc cy phn phi ni dung, tuy nhin bng thng cho vic gi cc lung d liu ni dung c ng gp bi tp hp cc peer (hnh 2.12). H thng xy dng nhiu cy phn phi m rng ngun v tt c ngi thu. Khi mt nt mun tham gia, n lin lc vi my ch trung tm nu p ng yu cu th mt nt cha trong cy c ch nh cho n. CoopNet h tr c lung trc tuyn cng nh cc dch v theo yu cu. Cch tip cn CoopNet l tt, y cc peer thu c ni dung cht lng thp c u tin hn. Tuy nhin, cc my ch trung tm cn phi duy tr kin thc y ca tt c cc cy phn phi, n s to ra chi ph kim sot nng trn my ch. V vy kh nng m rng ca CoopNet khng tt. Mt vn khc l cc my ch trung tm tr thnh mt im tht bi trn h thng.

L Ngc Anh D09VT2

36

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

Hnh 2.12 Streaming Media s dng ni dung CoopNet 2.4 Phng thc tip cn da trn li chng li cc ng thi t cc peer, nhiu h thng P2P streaming s dng phng php tip cn da trn li. Trong phng php tip cn da trn li, peer tham gia to thnh mt lp ph kt ni ngu nhin. Trong lp ph cc ni dung gc t ngun ban u c phn phi gia cc peer khc nhau. Mi nt c thng tin v tt c cc nt khc nhau trong h thng. Kt qu l, mi nt duy tr kt ni vi mt vi nt khc trong mng. Mi peer trao i d liu vi mt tp cc peer hng xm. Nu mt peer hng xm ri i, cc peer vn c th ti v cc video t nhng peer hng xm cn li. Trong khi , cc peer s b sung thm cc my khc vo tp hp peer hng xm ca n. Khng ging nh cc h thng cy n lung trong h thng li trn, mi peer c th nhn c d liu t nhiu peer hng xm cung cp. V vy, cc h thng truyn da trn li khe mnh chng li cc trng thi t cc peer hng xm. Nhng thch thc ln trong h thng lung trc truyn P2P da trn li l hnh thnh thng tin lng ging v lp danh mc d liu. Khi mt peer tham gia vo mng. Mt peer trong cc a ch mng (mt nt bootstrapping) theo di peer mi v cung cp mt danh sch c cha cc thng tin ca mt nhm ngu nhin cc peer ang hot ng. S dng danh sch ny, cc peer c gng bt u kt ni v nu thnh cng n bt u trao i ni dung video vi cc peer (hng xm). x l nhng peer ri khi mng khng bo trc, cc peer trong mng thng xuyn trao i vi nhau. ng thi, ty thuc vo cu trc h thng ca cc peer, mt peer khng kt ni duy nht ti mt peer lng ging, p ng vic cc peer tch ra.

Hnh 2.13 Danh sch peer t Tracker Server Hnh 2.14 P2PliveVideo Streaming L Ngc Anh D09VT2 37

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

Trong h thng da trn li, cc khi nim v lung video tr nn khng c tc dng do cu trc lin kt li. Cc khi n v d liu trong h thng li l mt on video. Cc my ch a phng tin phn chia ni dung truyn vo cc khi truyn thng nh, mi khi c mt s th t nht n. Sau , mi khi c truyn n tt c cc peer qua li (hnh 2.14). Mi khi d liu c cc con ng khc nhau ti cc peer, chng c th n ch theo mt th t khng lin tc. i ph vi vn ny khi d liu thng c thm cc b m (buffered) vo b nh v t sp xp li trc khi cung cp cho my thu, m bo pht lin tc. Ch yu c ba vn chnh ca thit k trao i d liu trong h thng li: y (push), ko (pull) v lai y-ko (Hybrid Push - Pull) hnh 2.15. Trong mt h thng li y, mt peer tch cc y cc khi ni dung nhn c cho cc peer hng xm ca n (peer m cha nhn c cc khi ni dung ). Khng c quy nh r rng mi quan h cha-con trong h thng li. Mt peer c th y m mm mt khi ni dung ti peer va c khi . N cng c th xy ra hai peer cng y cc khi nh nhau, s lm lng ph bng thng. gii quyt vn , lch trnh y khi ni dung cn phi c ln k hoch mt cch cn thn gia cc peer. V lch trnh cn phi c ti to khi cc peer n v i trong h thng.

Hnh 2.15 Trao i d liu thit k trong h thng da trn li Mt phng php cho vic truyn d liu l phng php ko. tng chnh ca phng php ko l mi peer yu cu cc on thiu t cc peer khc. Mi peer c mt nhm hng xm v nh k trao i thng tin d liu sn c (buffer maps) vi cc peer hng xm. Mt b nh m cha s th t ca cc khi hin c trong b m ca peer. Bt c khi no mt peer nhn c thng tin t cc peer khc, n hc v cc khi n khng c bit. Sau n yu cu cc khi cn thiu t cc peer trong nhm. Hn na, bt k khi u c sn ti nhiu i tc, do mng li mnh trnh tht bi khi mt nt tch ra. Tc l cc peer s s dng cc peer hng xm khc nhn c khi d liu. Mt bt li ca k thut ko l thng xuyn trao i bn m v ko cc sn phm yu cu nhiu hn tn hiu pha trn v tng tr khi ly mt khi ni dung. Phng php ko (pull) trong lp ph khng c cu trc mnh m c th lm vic tt vi tc cao nht trong mi trng P2P trong khi ch y (Push) c th lm gim hiu qu tr c thy cc nt ngi s dng. Phng php ko thun ty khng th p ng nhu cu ca cc ng dng v tr v tr tch ly ln . Lai push-pull
L Ngc Anh D09VT2 38

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

streaming c th lm gim tr v k tha cc tnh nng tt nht nh n gin v mnh m ca phng php ko thun ty. Mi nt s s dng phng php ko v sau khi nhn c khi d liu mi nt s chuyn tip khi n peer hng xm m khng c yu cu r rng t nhng hng xm. Cc lung d liu c phn loi nh cc gi c ko v y nh cc gi tin. Mt gi ca nt b ko ch khi cc gi d liu c yu cu, trong khi mt gi b y ngay sau khi nt nhn c gi . Mi nt hot ng theo ch ko thun ty trong khong thi gian u tham gia. Trong khi , cc gi tin b mt gy ra bi s khng ng tin cy ca lin kt mng hay nhng peer tht bi s c ko cng t nhng peer khc. V vy, hu ht cc gi tin nhn c s c y i. 2.4.1 C c h thng lung trc truyn ph bin da trn li Nhiu ng dng c pht trin bi cc nh nghin cu cho cc mc ch khc nhau ca P2P streaming da trn li. Anysee l mt ng dng da trn phng php y nhng tri li CoolStreaming, Chainsaw, PPLive, PPStream, and SopCast l mt v d v ng dng da trn phng php ko. GridMedia and PRIME l nhng ng dng c pht trin da trn cch tip cn s lai push-pull. 2.4.1.1 H thng AnySee AnySee l mt ng dng da trn phng php y trong h thng li trong cc ngun c phn chia da trn tr ca n. Cc cng vic c bn ca anysee l nh sau. Ban u, mt lp ph c xy dng da trn li. Tt c cc peer, vi mt nh danh duy nht, u tin kt ni vi cc nt bootstrapping v la chn mt hoc mt s peer xy dng lin kt. Mi peer do duy tr mt nhm cc peer hng xm. Pht hin mt v tr da trn thut ton c s dng ph hp vi lp ph v m hnh vt l pha di lp ph. Ban u, tt c cc ng streaming c qun l bi cc lp ph hp n duy nht d qun l vic tham gia, ri khi ca cc peer. Ngi qun l ti u ha gia cc lp ph v khm ph con ng thch hp, xy dng cc lin kt sao lu v ct t con ng c Q0S thp. Ngi qun l duy tr hai ng truyn hot ng, gm ng dn streaming hin ti v cc ng dn sao lu c tnh ton trc ca tt c cc peer trong mng. V vy, khi cc peer cht hoc ri khi mng, mt con ng mi c chn t b d phng thay th cc lin kt b hng do khi phc li kt ni ca mng. S h thng ca mt nt AnySee c th hin trong hnh 2.16. C ch AnySee thun li bi v cc peer hng xm khng t hp i yu cu khi c mt peer ra i, thay vo ngi qun l lp ph thay th mt lin kt b mt bng cch cp n cc thit lp sao lu thay th mt peer hiu qu. Do , Anysee khi phc cc kt ni ca mng rt nhanh. Mc tiu ca qun l nt quan trng l xc nh s lng yu cu m mt peer cn phi c. Video c phn chia thnh nhiu khi, mi khi c thi gian c nh 1s. Cc peer ly cc khi t cc ngun hoc peer hng xm khc v b nh cache ca chng trong b nh a phng. im yu ca Anysee l cht lng truyn ni dung khng c m bo, vic la chn mt
L Ngc Anh D09VT2 39

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

nhm cc peer ngu nhin c th khng c ngun lc cung cp cht lng truyn thng mong mun.

Hnh 2.16 S h thng ca mt nt Anysee 2.4.1.2 H thng Chainsaw Chainsaw l mt h thng li da trn phng php y m khng da trn mt cu trc mng cng nhc. Trong s ny, cc peer c thng bo v cc gi d liu mi ca cc peer hng xm. Bng cch ny, d liu trng lp c th c loi b v mt peer c th m bo nhn c tt c cc gi d liu. i vi mi peer hng xm, mt peer to ra mt danh sch cc gi mong mun, tc l mt danh sch cc gi tin d liu peer mun m trong peer hng xm c sn. Sau n s c p dng mt s chin lc chn mt hoc nhiu gi d liu t danh sch v yu cu ti peer hng xm thng qua mt bn tin yu cu. Mt peer theo di cc gi d liu yu cu t mi peer hng xm v m bo rng n khng yu cu gi tin t nhiu peer. N cng hn ch s lng yu cu ti mt peer no , m bo rng yu cu c tri rng trn tt c cc peer hng xm. Cc nt theo di cc yu cu t cc peer hng xm ca h v gi cc gi tin tng ng trong iu kin bng thng cho php. H thng khng cung cp mt c ch no thc thi vic ng gp ngun ti nguyn cng bng ca cc nt nhng Chainsaw cho php peer t xc nh r bng thng ti ln ti a ca. Chainsaw c kh nng em li hiu nng mng cao v cc chi ph CPU do mi thng bo gi. 2.4.1.3 H thng PPLive PPLive l mt ng dng P2P TV thng mi, n s dng mng li nh mt giao din mng ph da trn phng thc ko, phn phi lung ni dung trc tuyn v ni dung ghi sn. S khc bit ln PPLive vi BitTorrent l trong gi PPLive phi p ng cc thi hn pht li. Vo thng Ging nm 2008, ng dng PPLive cung cp gn 500 knh vi 1.000.000 ngi s dng trung bnh. S lng cc knh truyn hnh
L Ngc Anh D09VT2 40

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

trong thng 12 nm 2008 c bo co l tng ng nm 1775. Nn tng PPLive bao gm nhiu lp ph. Mt lp ph tng ng vi mt knh PPLive. Mi peer trong mt lp ph c xc nh bng cp (a ch, s port). Hnh 2.17 cho thy cc hot ng c bn ca mt peer PPLive. Lc u, peer PPlive ti danh sch cc knh t danh sch cc knh ca my ch thng qua giao thc http. Sau cc knh c la chn, peer thu thp mt tp hp nh ca cc peer hng xm tham gia trong cng mt lp ph bng cch truy vn ti cc my ch thnh vin thng qua giao thc UDP. Mt peer giao tip vi cc peer hng xm trong danh sch c c danh sch b sung, tp hp vi danh sch bn b hin ti ca mnh thng qua UDP. Theo cch ny, peer gi mt danh sch ca cc peer khc xem cng mt knh. c thi gian phn ng vi cc nt ri i v gii quyt nhng kh khn, gi tin cho php c hai b m: mt c qun l bi PPLive v th hai ca my thu ca ngi dng. Mt nhc im ca kin trc P2PLive l khi ng chm c tr ln. Cc hot ng ca PPStream l rt ging nh PPLive.

Hnh 2.17 Kin trc c bn PPLive 2.4.1.4 H thng DONet DONet (hoc CoolStreaing) l h thng P2P streaming li da trn phng thc ko c a ra bi trng i hc Hong Kong v Vancouver. Trong DONet tt c cc nt nh k trao i d liu thng tin sn c vi mt nhm i tc, v ly d liu c sn t mt hoc nhiu i tc, hoc cung cp d liu c sn cho cc i tc. Mt nt bao gm ba phn chnh (hnh 2.18). Mt ngi qun l thnh vin (Membership manager) gip qun l cc nt, mt ngi qun l quan h i tc (Partnership manager) trong thit lp v duy tr quan h i tc vi cc nt khc, mt lch trnh (A Scheduler) ln lch trnh vic truyn ti d liu video v xc nh khi cn c ly t i tc v ti khi ca cc i tc. CoolStreaming yu cu nt mi tham gia lin lc vi my ch gc c c mt kt ni ban u. Mi nt cng duy tr mt nhm con ca cc peer khc trong nhm. CoolStreaming s dng kh nng m rng peer, qua giao thc (SGAM) pht tn thng bo ti cc peer. Mt nt
L Ngc Anh D09VT2 41

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

CoolSreaming c th ra i. S ra i ca peer c th d dng pht hin sau mt thi gian n khng lm g v mt nt b nh hng c th nhanh chng phn ng thng qua ti lp lch trnh bng cch s dng thng tin bn b m ca cc i tc cn li. CoolStreaming cng cho php mi nt nh k thit lp quan h i tc mi vi cc nt la chn ngu nhin t danh sch nhm ca mnh. Hot ng ny s gip mi nt duy tr mt s n nh vi cc i tc trong iu kin c nt tch ra v khm ph cc i tc c cht lng tt hn, v d nh nhng ngi lin tc c bng thng ti ln cao hn v nhiu phn on c sn. CoolStreaming h tr cc loi phn mm khc nhau ca cc my thu a phng tin, chng hn nh Windows Media Player, Real Player... S dng cc thut ton lp lch v mt h thng m (buffering) mnh m, CoolStreaming t c vic pht video mt m v kh nng m rng h thng rt tt cng nh hiu sut. Tng th tc streaming v pht li lin tc ca h thng CoolStreaming l t l thun vi s lng cc peer trc tuyn ti bt k thi im no. Mt trong nhng nhc im ca DONet l thng bo cho cc peer v sau c th yu cu chia khi d liu trc trao i dn n kt qu tr ln. Tng t nh vy, do cc thut ton la chn ngu nhin, cht lng dch v c th khng c m bo. Hn na, DONet gi nh rng tt c cc peer c th hp tc trong s lp li ca cc lung, n c th c cc peer ch k trong cc h thng khng mun chia s bng thng ti ln ca peer .

Hnh 2.18 Mt s h thng chung cho mt nt DONet 2.4.1.5 SopCast SopCast l mt ng dng min ph BitTorrent- like P2PTV, sinh ra t mt d n sinh vin ti i hc Fundan Trung Quc. SOP l vit tt cho Streaming trn P2P. Trong Sopcast cc knh c th c m ha trong Windows Media Video (WMV), Video tp tin cho Realplayer (RMVB), Real Media (RM), Advanced Streaming Format (ASF), v MPEG Audio Stream Layer III (MP3). Mt khch hng c nhiu s
L Ngc Anh D09VT2 42

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

la chn knh truyn hnh, mi knh thnh lp lp ph ring ca mnh. Mi lung knh bao gm ngun cp d liu m thanh v video trc tuyn hoc vng lp hin th theo mt lch trnh nh sn. Ngi xem iu chnh vo mt knh la chn ca h v Sopcast bt u hot ng ca mnh ly lung. N cng cho php ngi s dng pht sng knh ring ca mnh. Sopcast cung cp t l tn tht khung thp. Tuy nhin, Sopcast b tr peer, tc l cc peer xem cng mt knh c th khng c ng b. Hn na, thi gian chuyn knh l rt cao.

Hnh 2.19 GridMedia Kin trc Da trn MSOMP 2.4.1.6 GridMedia GridMedia thng qua mt c ch truyn ti y - ko ly d liu t cc nt i tc. Ch ko trong lp ph khng c cu trc c th lm vic tt vi tc cao trong mi trng P2P trong khi ch y c th lm gim tr tch ly pha ngi dng. Mt my ch theo di c trin khai h tr vic xy dng cc lp ph. Khi khi ng, mt nt tham gia lin lc u tin ti RP c c mt danh sch cc phn ca cc nt c trong lp ph, c gi l qu trnh ng nhp. Sau cc nt tham gia ngu nhin s la chn mt s nt trong danh sch ny nh cc peer hng xm. GridMedia ch yu bao gm nhiu ngi gi da trn giao thc multicast lp ph (MSOMP) v nhiu ngi gi d phng da trn thut ton pht li (MSRRA). MSOMP bt ngun t my ch streaming l mt nt gc. Cc MSOMP trin khai li da trn cu trc hai lp v nhm tt c cc peer vo cm vi nhiu con ng i khc nhau t gc mi peer. Sau , vi mt hoc mt s cc nh ch huy trong mi nhm, tt c cc nt ch huy xy dng xng sng ca lp ph. MSOMP s dng cc dch v multicast IP hin c sn trong mng LAN. IP Multicast min (IMD) l mt mng li a phng ca bt k kch thc mng no h tr IP multicast. IMD c th l mt my ch duy nht, mt mng LAN. Trong mi IMD, mt peer tiu c trch nhim ph bin cc ni dung streaming vi cc peer ng nghip khc trong cng IMD. Ngay sau khi nt phn u ri khi, mt nt tiu mi s c bu thay th vai tr. MSOMP kt ni vi cc IMD bng ng hm unicast. MSOMP da trn GridMedia kin trc c th hin hnh 2.19.
L Ngc Anh D09VT2 43

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

gii quyt vn mt gi tin, MSRRA c xut ti cc peer gi v gi tin b mt bng cch s dng peer nhn d on mu mt. Trong MSRRA, mi peer nhn c gi tin truyn ti ng thi t nhiu ngi gi. Ngay sau khi c tc nghn xy ra trn mt lin kt, peer nhn s c thng bo v tnh trng tc nghn ny v sau n s thng bo cho ngi gi khc, nhng ngi s tip tc v cc gi tin b mt. Cc thut ton MSRRA hiu qu lm gim tc ng ca cc nt tht bi, tc nghn mng v cc hot ng chuyn i lin kt. 2.4.1.7 PRIME PRIME l mt kh nng m rng k thut P2P streaming ca ni dung trc tuyn da trn h thng li y - ko li. Mc tiu thit k quan trng nht ca PRIME l gim tc nghn bng thng v trnh b hin tng tht nt c chai. PRIME s dng trn ngp ni dung kt hp vic y ni dung bi nt cha vi ko ni dung yu cu ca nt con. Mi peer ng thi nhn c ni dung t tt c cc nt cha ca mnh v cung cp ni dng cho tt c cc nt con ca n. Cho cc gi d liu c sn ti nt cha, mt chng trnh lp lch trnh gi tin ti mi peer nh k xc nh mt danh sch lnh ca cc gi d liu cn c yu cu t cha.Nt cha ch n gin l cung cp cc gi tin yu cu ca mi con trong trnh t quy nh v theo t gi c xc nh bi cc c ch kim sot tc nghn. Mi phn on ca cc ni dung c gi n cc peer c nhn tham gia trong hai giai on: giai on khuch tn v trn ngp giai on. Trong giai on khuch tn, mi peer nhn c bt k ca mt phn on mi t nt cha ca n mc cao hn. V vy, cc mnh ca mt phn on mi c to ra ang dn dn ko theo cc ng nghip cc cp khc nhau. Trong giai on lt, mi peer nhn c thp hn. Cc cha c gi l trn ngp cc nt cha. Mi phn ca bt k phn on mi c lan ta thng qua mt khuch tn c bit cy con trong giai on khuch tn ca phn khc . Sau , cc phn c sn c trao i gia cc ng nghip trong cy tng, khuch tn khc nhau thng qua cc li trn ngp trong giai on trn ngp ca phn khc ny. Cc ng dng ca hai giai on khc nhau cho phn phi ni dung dn n hiu qu s dng ngun lc sn c cha kh nng m rng v cng gim thiu ni dung nt c chai. Nhng bt li ca PRIME l nu ni dung nt c chai xy ra, cc nt phi ch i lu tm ra n v d liu cn thit ca h sau khi mt vi giai on lt, khi d liu c sn trong khu vc ca mnh. Do , khng c s m bo cho mt mc hp l ca lung trc tuyn cht lng. Hn na, cc thut ton khng xem xt hnh vi ca cc h thng P2P trong s hin din ca mt thng ng.

L Ngc Anh D09VT2

44

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

Hnh 2.20 Hai lp li/ cy che ph trong mng lai 2.4.1.8 HyPO HyPo l mt lp ph lai P2P cho truyn thng a phng tin trc truyn. Ti u ha cc lp ph bng cch t chc peer vi cc phm vi c bng thng tng t trong bt k khu vc a l no trong mt lp ph li v to thnh mt lp ph cy bng cch chn cc peer c n nh. Hnh 2.20 minh ha mt li / cy che ph hai lp trong HyPO. Ty thuc vo c ch ti u ha cy, trong cc peer c mt bng thng ln s c gn vi nt ngun trong cc lp ph cy, v phn b u trong cc cy vi cc nhnh vi mt chiu su tng t. Do , vic ti u ha cy lm gim su trung bnh ca cy, do nng cao kh nng m rng. Li trong HyPO khng phi l mt kt ni b tr t cc peer trong li, thnh vin lun lun cung cp d liu cho li cho n khi n tr thnh mt thnh vin cy. Tuy nhin, tt c cc th tc ca HyPO rt t da trn mt my ch theo di, mt khong thi gian lin tc c th xy ra nu my ch b li. Hn na, HyPO khng cp n cch lm sao d liu c phn b trong lp ph li ca n. 2.4.1.9 mTreebone mTreebone l mt thit k cy li phi hp thc y c li v cu trc cy. tng chnh ca mTreebone l xc nh mt nhm cc nt n nh xy dng mt cy da trn xng sng, cc nt ny c gi l treebone vi hu ht cc d liu b y trn xng sng ny. Cc nt bn vng cng vi nhng nt khc, c t chc thnh mt lp ph li b tr, to iu kin cho treebone ph hp ng lc ca mt nt v khai thc hon ton bng thng gia cc nt lp ph. Cc nt khng n nh khc c gn vo xng sng nh vng bn ngoi. Hnh 2.21 cho thy mt m hnh mTreebone. Trong s ny, kt ni li c gi ch khi c mt nt ring bit b nh hng bi s ra i ca nt cha hay nt cha tht bi. Vic duy tr treebone v ti u ha ch xy ra ti cc nt treebone v khng c thm chi ph cho cc peer vng ngoi xng sng. Thng thng, cht lng truyn l tt nht cho cc nt treebone do s n nh tt ca cc con ng cung cp d liu ca n t ngun. Thch thc chnh l chng ta cn phi xc nh tp hp cc nt lp ph n nh v v tr ca nt ti cc a im thch hp trong cy. Mt yu cu nh vy c th gy xung t vi bng thng v chm tr trong xy dng cy. Mt pht sinh khc khi xem xt v s n
L Ngc Anh D09VT2 45

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

nh ca mTreebone l ph thuc vo cc nt treebone, l cc nt s li trong treebone trong khong thi gian bao lu. Mt khc, CliqueStream l mt lp ph lai tng t nh mTreebone khai thc cc thuc tnh ca mt nhm lp ph P2P (hnh 2.22). ClipueStream tm ra mt hay nhiu nt bn vng c bng thng cao nht trong mi nhm v giao cho cc nt vai tr chuyn tip ni dung c bit. duy tr hiu qu truyn ti, mt cy phn phi ni dung c xy dng trn cc nt bn vng s dng cu trc trong nn nh tuyn c bn v ni dung s c y qua chng. Cc nt t n nh trong mt nhm sau tham gia vo vic ph bin ni dung v ko ni dung to ra mt li xung quanh cc nt bn vng.

Hnh 2.21 Khung mTreebone (a) mt lp ph lai (b) x l trng thi nt

Hnh 2.22 Cu trc trc tuyn trong CiqueStream Lai ko y P2P treaming lp ph ni ln nh mt gii php thay th cho cc phng php truyn thng nh l cy v li. K t khi thit k h thng lai lm n gin ha vic xy dng lp ph v cc quy trnh bo dng v ng thi vn gi c hiu qu ca mng v t c kim sot tt cc nt qu ti. 2.5 Video theo yu cu trn P2P VoD (Video on Demand) hin c t ra mt s vn nh tnh kh thi ca giao thc multicast, my ch hng v chi ph trin khai bo ng cc thit b nh tuyn
L Ngc Anh D09VT2 46

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

lp ph cao. Tuy nhin, video streaming da trn P2P cung cp mt kin trc thay th cho cc dch v video theo yu cu. Trong mt h thng VoD P2P, tt c cc peer l host c kt ni Internet, trong peer lu tr v cc lung video do khch hng ngh. Chi ph ca cc peer truy cp Internet s c chu bi khch hng ch khng phi bi cc nh cung cp dch v VoD. Bi v c mt ngun cung cp phong ph ca cc peer cung cp ngun ti nguyn cha c s dng nh bng thng v lu tr, da trn kin trc P2P nn c chi ph t hn so vi cc gii php truyn thng clientserver v gii php CDN. p dng k thut lung trc tuyn P2P vo lung VoD khng phi l mt cng vic d v nhiu l do. Nh h thng lung trc truyn P2P, h thng P2P - VoD cng cung cp ni dung bng lung. Tuy nhin, cc peer c th xem cc gi khc nhau ca mt on video cng mt lc, do lm yu i kh nng gip ln nhau. H thng VoD c kh nng cho php ngi dng bt u xem mt on video sau khi ch i mt thi gian, trong khi vn tip tc ti video v. Mc d, tr end-to-end ca lung trc truyn ngn nhng vn gy kh khn cho ngi s dng. Do , mt cy ngn bt ngun ti my ch video v ko di trn peer khng phi l iu mong mun trong truyn ti VoD. Ngi s dng s c th xem video ti mt thi gian ty , khng ging nh trong truyn hnh trc tip h cn phi ng b ha thi gian xem. Ngi s dng cng s c th thc hin cc hot ng kim sot nh tua li, li v pha trc ..vv trn video. V d, mt peer c th chn xem mt lung VoD khi QoS ca h thng gim, nhng cc peer khc c th khng lm iu tng t cho mt lung v n khng c ty chn xem li. Nu QoS ca cc lung video gim, s c nhiu cc peer ri h. iu ny cho thy tm quan trng ca mt giao thc phc hi trong mt h thng lung VoD. Cc giao thc kt ni li cc peer b b ri, do khng c mt mt ni dung v khng tr lu. Mt yu cu quan trng ca mt dch v VoD l kh nng m rng. Mt h thng VoD cho php mt peer mi tham gia h thng nhanh. Thi gian tham gia ngn, yu cu tham gia ca cc peer n h thng cc thi im khc nhau. D kin h thng phi truyn ti cc video cho tt c cc peer m khng lm cho my ch tr thnh mt nt c chai. H thng VOD P2P thng yu cu ngi dng ng gp dung lng lu tr v cc h thng ny cn kch thc b m rt ln p ng cc yu cu a dng t cc peer khc nhau. Khng gian lu tr ny thng l 1 GB trong PPLive. C hiu lc sau khi ngi dng ci t PPLive v chy h thng ln u tin, ngi dng c th nhn thy mt loi file cha bit 1 GB tn ti trong b nh my. Nh h thng video streaming, h thng VoD P2P thng c phn loi da trn cy v h thng da trn li. 2.5.1 H thng VoD da trn dng cy Nhiu ngi dng s dng mng che ph dng cy c ng b v nhn ni dung theo th t cc my ch s gi i. Vn chnh trong h thng VoD da trn
L Ngc Anh D09VT2 47

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

cy l vic thit k cy v cc th tc cho ngi dng tham gia vo h thng. P2Cast v P2VoD l nhng v d ca h thng VoD da trn cy. P2Cast l mt m hnh v li (patching) ban u cho h thng VoD. chng trnh xut h tr s dng dch v VoD c ngun gc IP multicast. P2Cast gii quyt hai vn k thut quan trng nh xy dng mt lp ph thch hp cho cc tuyn v cung cp mt lung tin lin tc pht li khi mt khch hng ra khi h thng. S lng khch hng n mt ngng nht nh to thnh mt phin. i vi mi phin my ch cng vi cc khch hng P2Cast to thnh mt cy a lung lp ng dng trn mng unicast. Cc khch hng trong P2Cast c th chuyn tip cc lung video cho cc khch hng. Mi khch hng tch cc gp phn bng thng v khng gian lu tr cho h thng ng thi tn dng cc ngun ti nguyn ti cc khch hng khc. Ton b video c truyn trc tip trn cy a lung lp ng dng, n c th c chia s gia cc khch hng. i vi khch hng tham gia mun hn cc khch hng u tin trong phin giao dch v do b l mt on ban u ca video, on thiu ny c th c ly t my ch hoc my khch hng khc c lu tr on ban u. P2Cast c th phc v nhiu khch hng so vi dch v unicast client-server truyn thng. Cc chng trnh phc hi trong P2Cast cho php cc ng nghip nhn d liu t my ch trc tip khi cc nt cha tch ra. Tuy nhin, iu ny lm tng khi lng cng vic ca my ch. P2VoD l mt m hnh video theo yu cu dng cy m n c gng gii quyt cc vn ca vic kt ni nhanh, cung cp nhanh chng v phc hi tht bi cc b, x l hiu qu cc yu cu khng ng b ca khch hng v cung cp chi ph qun l nh so vi P2Cast. Mi khch hng trong P2VoD c mt b m FIFO kch thc thay i lu tr cc ni dung gn y nht ca lung video nhn c. Tn ti nhng khch hng trong P2VoD c th chuyn tip cc lung video ti mt khch hng mi min l h bng thng u ra v vn gi khi u tin ca tp tin video trong b m. M hnh b nh m cho php mt nhm cc khch hng, n vi h thng ti thi im khc nhau, lu tr cc ni dung video ging nhau trong tin t ca cc b m ca n. Nhm nh vy hnh thnh mt phin. Khi mt thnh vin ca mt phin ri h thng, bt k thnh vin cn li ca phin c th cung cp video m khng c bin ng ti cc peer con b b ri ca cc thnh vin ri i vi iu kin bng thng u ra quy nh l . Trong P2VoD, mt kt ni lung c gi nh l tc bit khng i, bng vi tc pht li ca video. Qu trnh phc hi trong VoD l phc tp hn. Ngoi ra, P2VoD khng xem xt cc bng thng khng ng nht ca cc peer. B nh m v chuyn tip l mt cch tip cn da trn cy, l ni m mt khch hng VoD thng da trn ni dung c lu trong b m ca cc peer cha ca n. Trong m hnh ny, cc b nh tuyn khng thc hin chc nng multicast. Do , cc host cui chu trch nhim cho vic lu tr v phn b ca lung tin a phng tin. Cc host cui c th l cc my khch hng hoc cc proxy ca n v cc h
L Ngc Anh D09VT2 48

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

thng ny duy tr cc i tng truyn thng trong b nh cc b tm thi ca h. Nu mt khch hng yu cu cc i tng truyn thng v sau, my ch gc c th chuyn tip cc yu cu ti cc host cui. Ostream tn dng kh nng m ca host cui bng cch s dng b nh cache v phng php lu tr v chuyn tip. M hnh s dng mt thut ton cy m rng cho cc peer xy dng mt lp ph cho truyn thng trc tuyn. ostream lm gim s thiu s thiu hiu qu ca topo nh tr lin kt v ko di c gii thiu bng cch s dng multicast lp ng dng.

Hnh 2.23 Cu trc DirectStream Mt khung lm vic c gi l DirectStream cho php khch hng tn dng nhng li ch ca khong thi gian b nh m v dch v video theo yu cu vi s h tr hot ng VCR . DirectStream bao gm mt my ch ch dn, my ch ni dung v khch hng. My ch ch dn hot ng nh mt im trung tm hnh chnh. N duy tr mt c s d liu theo di ca tt c cc my ch v khch hng tham gia trong DirectStream v gip khch hng mi xc nh cc dch v cn thit. Cc my ch ni dung cung cp cc chc nng tng t nh trong m hnh client server truyn thng lu tr ni dung trong kho lu tr ca n v phc v yu cu ca khch hng, min l bng thng c sn. Do khch hng trong DirectStream c chc nng nh nt P2P. Mt peer lu tr mt ca s chuyn ng ca mt ni dung c nhn c mi nht v phc v nhng peer n mun bng cch lin tc chuyn tip cc ni dung c lu tr. Mt tp hp cc khch hng hot ng trong mt lp ph P2P streaming c thnh lp c gi l mt nhm. Cc nhm trong DirectStream pht trin theo thi gian v mi khch hng trong mt nhm chia s lung ging nhau. Qu trnh tm kim dch v cho mt yu cu mi bao gm bn bc nh c ch ra trong hnh 2.23. u tin cc khch hng mi s gi mt yu cu n my ch ch dn yu cu video bt u t v tr. Cc my ch ch dn sau nhn vo c s d liu ca mnh v tr v mt danh sch cc nt ng c vin, bao gm c my ch d liu v khch hng c ni dung phc v yu cu ny. Khch hng mi xc nh t cc nt ly cc lung s dng cho thut ton la chn cha QoS. S dng thut ton
L Ngc Anh D09VT2 49

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

ny, mt khch hng la chn mt nt cha c bng thng. Cc khch hng mi lin h vi nt ng vin c chn v yu cu chuyn tip lung. Sau khi kt ni c thit lp, khch hng mi gi tn hiu tr li my ch ch dn v ng k chnh n vo c s d liu. DirectStream gim ng k khi lng cng vic t ra trn my ch. Mt li th l quy m ca n cng nh s ph bin ca video tng ngay c khi khch hng tham gia khng hp tc chia s. DirectStream c hai nhc im, qun l tp trung a ra mt im n ca s tht bi. Khi nhiu nhm cao cp khc nhau tht bi, mt peer c th nhanh thiu b m ca n. Trong h thng VoD da trn cy, cc peer trn lp trn lun lun ng mt vai tr quan trng trong mng che ph ton b. S ra i ca n s dn n s bin ng lp mng thp hn. Hn na, mi peer ch c mt nh cung cp d liu, iu s gy ra khng hiu qu s dng bng thng c sn trong mt mng khng ng nht v mng cmi trng nng ng. ng thi, trong b nh cache v da trn h thng chuyn tip, nu cha nhy n mt im no trong on video, n bt u nhn d liu v khng quan tm ti nt con v nhng nt cn phi tm kim cha mi. 2.5.2 H thng VoD da trn li Trong h thng VoD da trn li, khng c cu trc lin kt c th c to ra. Cc peer trong mng kt ni vi mt s peer cha nhn cc gi tin video. H thng VoD da trn li c giao thc trn lp ph, d dng thit k v linh hot hn cho tc cc khi ni dung v do n c ph bin hn. Hin P2P da trn h thng li c chng minh l rt tt cho phn phi ni dung video quy m ln vi t ti nguyn my ch. Tuy nhin, trong h thng VoD kh khn trong thc t l ngi dng mun nhn c cc khi tun t xem video trong khi ti v. Ngoi ra, trong dch v VoD ngi s dng c th quan tm ti cc phn khc nhau ca on video v c th cnh tranh ti nguyn ca ngi dng khc. Qua , thch thc chnh ca h thng l m bo rng ngi dng c th bt u xem video ti bt k thi im no, vi thi gian ch nh v tc pht li cao. BitTorrent (BT) l mt trong nhng k thut da trn li phn phi khi lng ln cc ni dung trn Internet. N l mt giao thc chia s tp tin m rng m cn kt hp vi c ch truyn d liu trn lt. C mt s hn ch ca k thut BT ban u trong vic cung cp video streaming. Trong BT, cc tp tin c phn on trn khong trng (space). Mc d c ch la chn on mc nh ca BitTorrent l rt hiu qu trong vic gim thiu xc sut cho cc on ming him v cung cp cc on him cho cc peer, n khng tht vng trong thi gian lu lng tc nghn. L do l vi thi gian d liu nhy cm th mi on s phi nhn trong mt khong thi gian nht nh. Yu t ny khng c xem xt trong c ch la chn on ban u ca BT v do vy n khng th cung cp dch v phn phi nhy cm thi gian, bi v cc on c yu cu da trn s him c v khng theo thi hn ca n. Do , c
L Ngc Anh D09VT2 50

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

ch la chn on hin ti cn sa i h tr dch v thi gian nhy cm nh VoD. BASS v BiToS l cc v d ca BitTorrent da trn h thng P2P VoD dng li.

Hnh 2.24 BASS: (a) Tng quan h thng, (b)Mu khch hng BitTorrent h tr h thng streaming (BASS) m rng h thng BitTorrent hin ti cung cp mt dch v gn Video-on-Demand. Bi v BASS s dng s h tr ca BT cho cc lung, n s dng cc dch v ca mt my ch bn ngoi m c th lu c ton b video ca cc nh sn xu v m bo rng ngi s dng c th pht li video m khng gp s thay i cht lng. S thay i duy nht ca BitTorrent cho thy l n khng nn ti v bt c d liu no trc thi im playback. N c php s dng on him nht u tin v chnh sch n ming tr ming (tit for tat). Trong chnh on him u tin, khch hng yu cu mt phn da trn s lng bn sao n thy c sn v chn mt ci l ph bin nht. T my ch truyn thng, BASS ti cc phn trong trt t, b qua cc phn m c ti bi BitTorrent, hoc ang trong qu trnh c ti v v d kin s hon thnh trc thi hn pht. Tng quan v h thng ca BASS c a ra trong hnh 2.24. D BASS lm gim ti ti cc my ch, thit k ca h thng vn l my ch theo nh hng v do cc yu cu bng thng ti cc my ch tng tuyn tnh vi s lng ngi dng.

Hnh 2.25 Phng ph p tip cn BiToS

L Ngc Anh D09VT2

51

n tt nghip i hc

Chng II: H thng lung video qua mng ngang hng P2P

H thng BiToS cng da trn BitTorrent. tng chnh l phn chia cc khi ang thiu thnh hai tp hp: tp hp u tin cao v tp hp cn li v yu cu vi cc khi xc sut cao hn t tp hp u tin cao hn (hnh 2.25). Tp hp u tin cao hn, c cha tt c cc phn kh gn c ti to. V vy, peer mong mun ti v nhng phn sm hn. Tri ngc vi tp hp cn li, trong c cha cc phn m s khng cn n trong tng lai gn. Sau khi ngi dng bt u, b m ca ngi dng yu cu nhng phn cn thit t cc phn m cc peer nhn. Trong BiToS, trng tm chnh c a ra cho vic lp lch cn thn ca cc khi video. Cc phn m b l thi hn pht li ca n c gim xung n gin. Do vy, iu ny c th dn n suy gim cht lng pht li video. Ngoi ra do tnh cht bt i xng ca cc kt ni Internet v khng ng nht ca cc peer, h thng khng th m bo rng cc on video c yu cu lun lun c sn pht li ng thi gian yu cu. 2.6 Kt lun chng II Chng 2 trnh by khi qut v khi nim mng ngang hng P2P, u nhc im ca mng ngang hng. Bn cnh cn cp n vic phn loi mng ngang hng. Qua thy mng ngang hng rt n nh v d m rng; tn dng ti a ti nguyn ng gp ca cc nt tham gia mng; mng ngang hng d ci t; chi ph thit b thp, trin khai mt h thng mng kh d dng. Ni dung chnh chng 2 trnh by cc h thng P2P streaming, c th phn chia thnh h thng P2P live Streaming v P2P VoD. Ty theo cch tip cn, h thng P2P live streaming c th c chia thnh dng cy hoc dng li. H thng P2P VoD cng c th chia thnh dng cy v dng li. Tuy nhin, h thng P2P streaming cng bc l nhiu nhc im cn phi xem xt, trong quan trng nht l tr lung video.

L Ngc Anh D09VT2

52

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

CHNG III: NG DNG LUNG VIDEO STREAMING QUA MNG PASTRY


3.1 Gii thiu v Pastry Gn y cc ng dng Internet trong mng ngang hng c ph bin mt cch rng ri thng qua cc ng dng chia s file nh Napster, Gnutella v FreeNet. Trong khi kh nhiu s ch u tp trung vo cc vn bn quyn c a ra bi cc ng dng c th th cc h thng P2P li a nhiu kha cnh v vn k thut nh kim sot phn cp, t t chc v kh nng m rng. Cc h thng P2P c m t nh mt h thng phn phi, trong tt c cc nt u c nhim v v nng lc ging nhau, ng thi tt c cc thng tin truyn thng l i xng. Hin nay c kh nhiu d n nhm xy dng cc ng dng P2P. Mt trog nhng vn quan trng trong vic xy dng ny l nhm cung cp cc thut ton hiu qu cho v tr i tng v qu trnh nh tuyn trong mng. Pastry l mt trong nhng gii php c a ra. Pastry c kh nng chng chu li, kh nng m rng v ng tin cy. Hn na, Pastry cn c c tnh nh tuyn cc b kh tt. Pastry c thit k nh mt cht nn chung cho vic xy dng mt lot cc ng dng mng ngang hng trn Internet nh chia s file ton cu, lu tr file, truyn thng nhm v cc h thng t tn. Mt s ng dng c xy dng trn inh ca Pastry cho n nay bao gm mt tin ch lu tr lin tc chung, c gi l PAST v mt h thng c kh nng m rng, l Scribe. Cn li cc ng dng khc ang c pht trin. Pastry cung cp cc kh nng sau y: u tin mi nt trong mng pastry s c mt nh danh duy nht (NodeId) trong mt khng gian nh danh 128 bit vng trn. Khi c mt thng ip v mt kha 128 bit dng s, mt nt pastry s hiu qu trong vic nh tuyn thng ip ti mt nt vi nodeid c s gn nht vi kha, trong s tt c cc nt pastry hin ang sng. S lng chuyn tip cc bc trong mng bao ph pastry l O(logN), trong khi kch thc ca bng nh tuyn c duy tr trong mi nt Pastry ch l O(logN) (trong N l s nt Pastry sng trong mng bao ph). Ti mi nt Pastry dc theo ng nh tuyn m mt tin nhn c, ng dng s c thng bo v c th thc hin cc tnh ton ng dng c th c lin quan n tin nhn. Th hai, mi nt Pastry s tin hnh theo di L hng xm trc tip ca n trong khng gian nodeid (c gi l tp l) v thng bo cho cc ng dng ca cc nt mi n, nt ra v nt phc hi trong tp l. Th ba, pastry a vo ti khon cc b trong Internet c bn, n tm cch gim thiu khong cch truyn i thng ip, theo mt h mt xp x v hng ging nh tr lnh ping. Pastry hon ton l phi tp trung, c kh nng m rng v t t chc. Bi vy n s t ng thch nghi vi s ra i, n v s tht bi ca cc nt. ng dng P2P xy dng trn pastry c th s dng kh nng ca mnh bng nhiu cch, bao gm:
L Ngc Anh D09VT2 53

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

nh x i tng ng dng ti cc nt Pastry: Cc i tng ng dng c th c phn cng thnh cc nh danh ngu nhin ng u, duy nht ( cc ObjId) v c nh x ti k (k 1), cc nt vi nodeId c s gn nht vi objId. i lng k phn nh mc mong mun nhn rng cc ng dng cho cc i tng. Cch chn them cc i tng: Cc i tng ng dng c th c th c them vo bng cch inh tuyn mt thong ip Pastry s dng ObjId nh l kha (key). Qu trnh truy cp cc i tng: Cc i tng ng dng c th c th c tra cu, lin lc hoc thu hi bng cch nh tuyn mt thng ip Pastry c s dng ObjId nh l kha. Theo nh ngha, thong ip ny c m bo n mt nt c kh nng duy tr mt bn sao ca i tng c yu cu, tr khi tt c k nt vi cc nodeId gn nht vi ObjId u tht bi Tnh a dng: Vic phn cng cc nodeId l ngu nhin v khng th b hng bi mt s tn cng no . Nh vy, vi xc sut cao, cc nt vi cc nodeId lin k c tnh a dng c v v tr a l , thm quyn, quyn s hu v vic nh km cc tp tin trong mngiu ny gim thiu xc sut tht bi ng thi ca tt c k nt trong vic duy tr mt bn sao i tng. Kh nng cn bng ti: C nodeId v ObjId u c phn b ngu nhin v ng u trong khng gian nh danh Pastry 128bit. Kt qu ny to nn mt s cn bng tt u tin nhm lu tr cc yu cu v truy vn ti trng gia cc nt Pastry cng nh trong mng Internet c bn. Hiu qu v kh nng m rng vic ph bin thng tin: Cc ng dng c th thc hin multicast mt cch hiu qu bng cch s dng chuyn tip ng dn ngc dc theo cy c hnh thnh bi cc nh tuyn t cc client ti nt c nodeId gn vi ObjId nht. Tnh cht cc b ca mng Pastry m bo rng cc kt qu multicast trn cy l kh hiu qu, tc l d liu c hiu qu trong vic cung cp v s dng ngun ti nguyn Internet c bn. Pastry l mt giao thc phn phi d liu v nh tuyn lp ng dng trong cc ng dng mng ngang hang c cu trc. ng nh nh ngha ca n, Pastry c 2 nhim v chnh l phn phi d liu trong mt mng ngang hang v tm kim d liu trong mng da vo kha tm kim. H thng Pastry l mt h thng phn tn c kh nng t cu hnh v c tnh n nh cao, kh nng chng chu li tt, ng thi n cng c kh nng m rng v ng dng cho nhng dch v ln. Pastry s dng giao thc DHT ly nh danh cc nt tham gia vo h thng mng. Vi di a ch ln th giao thc DHT qu thc rt ph hp vi h thng mng ngang hang, khng ngoi tr i vi Pastry. Tuy nhin iu th v ca Pastry nm bng nh tuyn s c m t di y.

L Ngc Anh D09VT2

54

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

Hnh 3.1 Bng nh tuyn ca nt 10233102 trong Pastry Nt v d liu trong mng Pastry c nh danh bi mt gi tr 128bit (nodeId v ObjId). Mi d liu lu tr trong mng c bm bi mt hm bm, t thu c mt gi tr gi l kha v d liu ny c lu tr ti nt qu l dy cc kha c cha gi tr kha ny ( gi tr kha thu c khi bm d liu). Mi nt trong mng s lu tr mt bng nh tuyn (routing table) mt tp cc hng xm (neighborhood set) v mt tp namespace. Pastry dng cc d liu ny qun l v duy tr s n nh ca mng, ng thi phc v cho vic tm kim d liu. hnh 3.1 l bng nh tuyn ca nodeId 10233102. Da vo bng nh tuyn ny, nt 10233102 c th gi d liu n cho nt khc. V d 10233102 mun gi thng ip m ti cho nt 33321220. u tin n s tm trong cc nt hng xm trong bng nh tuyn, nu c s gi n lun. Nu khng tm thy n s tm trong Routing Table v so snh cc k t ban u ca nt cn gi n 33321220 vi cc ct trong Routing Table. C th l nt 33321220 c k t u l 3: n s tm trong Routing Table ti hng 1 ct 3 v tm c nt 31203203. Do ngay t k t u ca nt cn gi khc nt gi nn qu trnh tm kim dng li. Nt 1023312 s gi n nt 31203203 vi yu cu s gi thng ip m n nt 33321220. Qu trnh ny tip tc xy ra cho n khi n c nt cn gi.

L Ngc Anh D09VT2

55

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

Hnh 3.2 Nt 10233102 gi thng ip m n nt 33321220 Cc nt nh k gi cc gi tin keep-alive cho cc nt bng hng xm ca n v nu nh mt nt no khng nhn c gi keep-alive ca mt nt bng xm trong tp hng xm ca n trong mt thi gian nht nh th n s xem nh nt hng xm ri khi mng v t ng update thng tin. 3.2 Qu tr nh truyn tin multicast trong nhm Scribe Scribe l c s h tng cho vic truyn tin multicast lp ng dng da trn giao thc Pastry. Cng chnh v th m n tha hng c nhng c tnh ca mt giao thc mng ngang hng c cu trc v ng thi mang nhng c im ny vo trong vic truyn thng ip multicast lp ng dng. Ging nh Pastry, Scribe l m hnh phn quyn hon ton v n c kh nng xy dng, duy tr mng, pht tn thng bo mt cch c t chc v tin cy. ng thi c tnh tng thch cao vi s lng nhm, s thnh vin trong nhm ln cng nh khi c nhiu ti nguyn trn mng. Scribe s xy dng mt cy multicast bng cch gi th tc join giao thc Pastry mi khi mt nt c yu cu ng nhp vo nhm truyn tin multicast. V nh kh nng t cu hnh ca Pastry m vn qun l nt, nt li cng nh ra vo ca nt tr nn d dng. ng thi, Scribe s dng giao thc Pastry pht tn thng bo multicast. Scribe t chc theo nhm, tc l hp nhng nt c cng nhu cu nhn d liu multicast vo mt nhm. V mt logic th cc nt trong nhm s c quan h vi nhau theo hnh cy (s gii thch k phn sau). Bt k mt nt no trong mng cng c th thc hin c 3 thao tc: Mt l to ra 1 nhm (group), hai l join vo mt
L Ngc Anh D09VT2 56

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

nhm c t trc (tr thnh 1 nt trong cy multicast) v ba l truyn tin multicast ti tt c cc nt c trong nhm. Scribe l mt m hnh cung cp mt cch n lc ti a trong vic truyn tin multicast, n c th qun l v duy tr c nhiu nhm cng mt lc, cc nhm c s lng thnh vin ln cng nh c nhiu ti nguyn trong mng. 3.2.1 Chi tit gii thut M hnh M hnh thc thi Scribe l mt mng Pastry trong cc my c ci t chng trnh ng dng ca Scribe. Chng trnh ng dng ny s cung cp cho cc my ny hai phng thc l forward (c gi khi mt thng ip nh tuyn qua mt nt) v deliver (c gi khi thng ip n mt nt m c nodeId gn vi key nht hoc ni dung thng ip chnh l a ch ca nt ). Cc thng ip trong Scribe c 4 kiu l: JOIN (xin tham gia vo mt nhm), CREATE (to mt nhm mi), LEAVE (ri khi nhm), MULTICAST (truyn thng ip multicast). - Qun l nhm: Mi nhm truyn multicast c mt nh danh groupId duy nht. Scribe node (tc l nt trong mng c ci chng trnh ng dng Scribe) c Id gn vi Id ca nhm (groupId) nht c gi l im gp v n cng chnh l gc ca cy multicast tng ng vi groupId ny lun). - To nhm: Mt nt Scribe no mun khi to mt nhm th cc bc thc hin s l: B1: Nt Scribe dng Pastry nh tuyn thng ip router (CREATE , groupId). B2: Giao thc Pastry s gi thng ip ny ti im cui l mt nt c nodeId gn vi groupId nht. V nt ny s c xem nh l gc ca nhm mi to ra. B3: H thng s kim tra an ton, cc thng tin v chng thc. Nu khng c vn g th s thm nhm mi vo danh sch nhm bit trong mng. Trong vic to nhm, bc quan trng nht chnh l bc kim tra an ton v chng thc thng tin, v iu ny c nh hng rt ln ti s an ton ca ton mng ni chung ch khng ch ring s an ton ca nhm multicast. - Qun l thnh vin: Mt nhm v phng din logic l mt cy multicast c gc l im gp, mi khi c mt nt mi c join vo nhm th n s tr thnh mt thnh vin ca nhm cng nh tr thnh mt thnh phn ca cy multicast, v th phi c c ch hp l t chc, qun l cc thnh vin ca nhm. Nu mt nt Scribe l mt phn ca nhm th v phng din cy multicast th n l mt forwarder. Mi mt forwarder duy tr mt bng gi l children table m mi mc ca bng ny s gm 2 trng : a ch IP ca mt nt con no ca n (IP Adds) v nodeId tng ng ca nt con .
L Ngc Anh D09VT2 57

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

3.2.2 Qu tr nh gia nhp nhm (join group): Khi mt nt mun join vo mt nhm no , n s thc hin cc bc sau: Gi thng ip JOIN vi groupId ca nhm cn tham gia lm key: route (JOIN, groupId). Giao thc Pastry s nh tuyn n ti im gp. - Nu nt trung gian trong qu trnh truyn thng ip l mt forwarder (mt thnh phn ca nhm ang nh tham gia vo) th n gin ch l thm nt cn tham gia vo lm mt nt con ca nt forwarder ny. - Nu nt trung gian khng phi l mt forwarder ca nhm cn tham gia vo th thc hin cc bc: + To mt children table cho nt trung gian v thm thng tin ca nt cn tham gia vo bng ny. + Gi thng ip JOIN ca nt trung gian ti im gp ( lc ny thay cho vic thc hin tham gia nt ban u, ta i tham gia nt trung gian vo nhm). V c thc hin quy nh th ny ta s c c mt danh sch cc nt mi tham gia vo nhm thay v ch mt nt nh ban u. d hiu, ta xt v d sau: Mt nhm c im gp l A c nodeId = 1100 (nh hnh v di).

Hnh 3.3 Qu trnh 1 nt gia nhp vo nhm Nt B c nodeId l 0111 mun tham gia vo nhm c A l gc, n s gi gi tin route (JOIN,x) vi x l groupId ca nhm ny, giao thc Pastry s nh tuyn gi tin ti nt D c nodeId l 1001. Nhng nt D khng phi l mt thnh phn ca nhm ny cho nn D s to ra mt children table ca n v thm vo mc (122.45.1.23 ; 0111). Ti theo D s gi gi tin yu cu tham gia vo nhm c gc A : route (JOIN ,x). Tip tc giao thc Pastry li nh tuyn n ti nt E v E cng khng phi thnh vin ca nhm ny. V th E cng to ra mt children table ca n v thm mc (172.16.2.13; 1001). V sau E gi gi tin route (JOIN,x). Gi tin ny tip tc c nh tuyn v ti A v A l mt thnh phn ca nhm cho nn y A s thm mc
L Ngc Anh D09VT2 58

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

(10.10.1.123;1101) vo children table ca n. Kt qu l ta s c thm 3 thnh phn mi ca nhm l B, D v E. 3.2.3 Qu tr nh ri nhm (leave group) Khi mt nt no mun ri khi nhm th n s ghi mt cch cc b rng n ri khi nhm (tc l ch mt mnh n bit l n ri khi mng). Sau nu bng children table ca nt ny l rng (tc l n khng c con trong cy multicast) th n s gi thng ip LEAVE ti cha ca n trong cy multicast. Thng ip ny s c quy trong cy multicast cho ti khi n ti mt nt m nt c con ri khi nh trong trng hp n khng c con no c. Sau cc con ca n s xem nh n b li v thc thi theo c ch sa li (s trnh by di). Vi cch gia nhp v ri khi nhm nh th ny v vi c tnh phn phi ngu nhin ca Pastry th cy multicast s c xy dng mt cch ng u theo ngha l khng mt nt no trong cy mutlicast, ngay c nt gc phi chu qu nhiu kt ni ti cc nt khc. Vic ny gip cho Scribe c kh nng m rng v kch thc cng mh v kh nng, tc l c khi tng s lng nt trong nhm hay tng cc gi tin multicast gi n mng th Scribe vn c th m ng c. 3.2.4 Truyn tin multicast ti mng Khi mt nt no mun truyn multicast ti cc im trong mt nhm no th n s gi thng ip multicast ti im gp (route (MULTICAST,rootId). Sau khi im gp nhn c thng ip ny n s gi tr li nt kia IP ca n (rootIP), sau nt ny s truyn thng tin mun gi ti im gp. im gp ny s sao chp gi tin multicast ny v gi cho cc con ca n trong cy multicast ( nu c ). Cc im con ny khi nhn c d liu cng li tip tc sao chp d liu v gi ti cc con ca n trong cy ( nu c ). C lp i lp li nh vy v ch dng li vic ny khi d liu ti cc nt l nt l ca cy.

Hnh 3.4 Truyn tin multicast trong nhm Scribe Gi s nh hnh v trn, Sender l nt cn gi d liu cho cy multicast c gc l 1100. N s gi gi tin route (MULTICAST, 1100). Nt 1100 nhn c gi tin v
L Ngc Anh D09VT2 59

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

tr li cho sender a ch IP ca n. T lc ny sender giao tip vi nt gc ny thng qua IP (by gi l quan h trong giao thc TCP/IP ch khng lin quan ti Pastry hay P2P). Sender gi d liu cho nt gc 1100. Nt ny s to ra mt bn sao d liu v gi cho con ca n l 1101. Nt 1101 nhn c d liu t root, n cng s to ra mt bn sao v gi cho 1001 l con ca n. Nt 1001 li sao chp d liu v gi cho 0111 v 0100 l thnh vin trong children table ca n. Khi cc nt 0100 v 0111 nhn c d liu, do n l l ca cy multicast nn n khng lm g na. Trong vn truyn d liu multicast ny c mt im th v l khi sender mun gi d liu multicast ti nhm ca n li phi xin v nhn IP ca nt gc ri sau giao tip vi nt ny da vo IP m khng s dng giao thc Pastry gi d liu. n gin l vic nh tuyn cng nh vic gi thng tin qua Pastry l mt vic lm rt tn thi gian v tai nguyn mng, m bnh thng mt sender khng ch gi mt gi tin multicast ti mng m n gi mt s hoc nhiu gi tin. Do vic sender lu IP ca nt root v gi gi tin trc tip s tit kim c thi gian cng nh ti nguyn mng. Tuy nhin nu nt gc b li hoc b ri khi mng th sender phi tm li IP ca nt root mi v tip tc truyn thng tin. 3.2.5 Sa cy multicast V Scribe lm vic trong mi trng mng, do mun duy tr c s n nh ca nhm th cn phi c cc c ch hp l gii quyt cc vn thng gp phi trong mng ngang hng. Phn ny s i su vo vic lm sao sa cha mt cy multicast khi mt nt b ri khi mng. Trong Scribe, nt cha s nh k gi cc gi tin heartbeat ti nt con ca n nhm thng bo s tn ti ca mnh trong cy. Nu nt con khng nhn c gi tin heartbeat do cha n gi ti trong mt thi gian no , n s xem nh nt cha ca n b li. V n s t ng tm mt nt cha khc thay th, bng cch gi thng ip JOIN vi key l groupId ca nhm hin ti (qu trnh ny ging nh qu trnh gia nhp vo nhm).

Hnh 3.5 Qu trnh t sa cymulticast


L Ngc Anh D09VT2 60

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

Gi s nh hnh v trn, ban u ta c cy multicast vi gc l nt 1100, trong cy nt 1001 c cha l nt 1101. Khi nt 1001 khng nhn c heartbeat ca 1101 trong mt khong thi gian no , n s xem nh 1101 b li v n s t ng gi gi tin route (JOIN,groupId). Tip theo ging nh trong qu trnh gia nhp nhm. Cy multicast s c xy dng li v by gi th nt 1001 nhn mt nt mi l 1111 l cha mi ca n (nh hnh v). Trong trng hp nt gc b li th cc con ca n cng chy gii thut nh trn. Khi gii thut Pastry s t chn ra mt nt gc mi c nodetId gn nht (tnh theo hin thi) vi groupId v nhm s li c duy tr nh bnh thng. V kh nng chng li cao nh th ny, Scribe lun c tnh sn sng cao v chng chu li tt, cho d c nhiu nt li cng mt lc th sau mt thi gian ngn cy multicast li c xy dng li v n nh nh trc. 3.3 Ci thin Scribe bng cu trc Splitstream Hin nay, c nhng nghin cu xy dng cy multicast dnh cho truyn video streaming trn mng ngang hng c cu trc nh Splitstream. Splitstream c xy dng da trn nn tng Pastry, Scribe v thm vo mt s gii php hn ch tnh trng qu ti ti mt s nt tham gia mng 3.3.1 Gii thiu SplitStream SplitStream l mt h thng cy a lung xut trong nm 2003 ca trung tm nghin cu ca Microsoft. SplitStream c thit k khc phc ti trng (load) chuyn tip khng n nh trong h thng multicast thng thng da trn a cy. tng chnh ca SplitStream l phn chia cc lung vo cc khi c lp khng ging nhau v mi khi c truyn multicast s dng mt cy ring bit. m bo rng cc ti trng c chuyn tip c th c lan truyn trn tt c cc peer tham gia, mt mng li cy c xy dng trong mt nt l mt nt ni b trong nhiu nht l mt cy v l mt nt l trong tt c cc cy khc. Mt tp hp cc cy nh vy c gi l interior node - disjoint. Hnh 3.6 minh ha cch SplitStream cn bng ti c chia thnh hai ng v gi tin c multicast trong hai cy ring bit. Mi peer, xa so vi ngun, nhn c c hai lung tin. Mi peer l mt nt bn trong ch c mt cy v l chuyn tip cc khi ni dung n hai nt con. Khi mt nt b qu ti nhn c yu cu t nt con, n hoc l t chi hoc chp nhn nt con v t chi mt nt con hin ti ca mnh, nt con b t chi l km hp dn hn so vi nt con mi. Mt nt s c mong mun nhiu hn nu nodeId ca n gn hn vi nt cha ca n. SplitStream xy dng cc cy multicast cho cc lung trong khi vn quan tm nhng hn ch bng thng trong v bng thng bn ngoi ca cc peer. N cung cp kh nng phc hi tht bi cc lin kt nt ra i khng bo trc v cy multicast c sa cha. Mt trong nhng vn chnh vi SplitStream l tc ng ca cc nt
L Ngc Anh D09VT2 61

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

vi bng thng khng ng nht v hiu qu ca n. Mt vn khc l trong mt interior node - disjoint, cc nt nhn gi tin ring bit vi tr khc nhau v d nh cc nt c t trong khong cch khc nhau t gc ca cy. iu ny l khng mong mun cho mt ng dng lung truyn thng trc tuyn, trong vic i hi thi gian thc chnh xc. Thm vn khc l tng cng quy m h thng cy c su ln hn v cc nt c t trong khong cch a dng t ngun.

Hnh 3.6 Mt v d n gin minh ha cch tip cn ca SplitStream 3.3.2 C ch xy dng lung trong SplitStream Splitstream c th c xem nh l vic chn la cc cy Scribe to nn cy multicast a lung. Vic la chn cc cy Scribe s d dng to nn cy mulitcast a lung vi tnh cht: 1 nt l nt trong ca 1 lung s l nt l trong cc lung cn li.

Hnh 3.7 Splitstream F lung Vic xy dng cc lung kh n gin. Nh trn hnh 3.7, vi khng gian Pastry c nh a ch cc nt gm F k t. Splitstream s chn ra cc lung c tn l 0x, 1x, , Fx cc nt sau khi gia nhp vo cy multicast a lung c th m bo. Nt c Id bt u l 0x s l nt trong ca cy multicast stripeId 0x v l nt l ca tt c
L Ngc Anh D09VT2 62

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

cc lung cn li. Tng t nt c Id bt u l 1x s l nt trong ca cy multicast stripeId 1x v l l ca tt c cc lung cn li. Tuy nhin, Splitstream s gp cc vn ti cc my (peer) tham gia nu ch n thun la chn cc cy Scribe truyn cc lung vo th l cha p ng tnh cht multicast. - Khng gii hn c bng thng i ra ca 1 peer do nh cu join ca cc peer khc: khi 1 peer vt qu bng thng gii hn i ra th cc peer khc vn mun gia nhp vo lung ca cc peer ny. Nu vn duy tr c ch nh cy Scribe th s c mt s peer tht s khng nhn c d liu t 1 vi lung do nt cha ca n khng gi d liu thc s n cho n. Splitstream s dng c ch mi gii quyt vn ti cc nt m bng thng i ra b vt qu gii hn. C ch ny bao gm: -B1 : Xc nh nt cha:

H nh 3.8 X c nh nt cha khi bng thng i ra vt qu gii hn Trong v d trn nt vi Id l 080* b limit outdegree (bng thng i ra vt qu gii hn) th nhn c yu cu join vo ca nt vi Id 001* lung 0800. Nt 080* s xem xt tt c cc nt con ca n loi i 1 nt con. Hnh 3.8 (1) (2) l trng hp c nt con 9* nhn c nt 080* lm cha trong lung 1800 khc vi lung 0800. Nt 080* s nhn c nt 001* lm con v loi b nt 9*. Sau nt 085* li yu cu join vo nt 080*. Hnh 3.8 (3) (4) l trng hp cc nt con u nhn 080* l cha trong lung 0800, xt n Id ca cc nt con. Nt 001* l nt c Id vi s k t tnh t tri sang phi khc vi lung 0800 nht. Nt 001* s tr thnh nt orphan v nt 085* c nhn lm nt con.

L Ngc Anh D09VT2

63

n tt nghip i hc

Chng III: ng dng lung video streaming qua mng Pastry

- B2: Nu sau bc 1 vn c nt orphan (tc l nt cha tm c nt cha) s tin hnh bc ny. Nt orphan s gi unicast n SCG (Spare Capacity Group) tm c nt cha. SCG l tp hp tt c cc nt m bng thng i ra cha vt qu gii hn. Vi c ch truyn tin unicast, nt orphan s gi thng ip tm nt c lung m bng thng i ra cha vt qu gii hn nhn n lm nt cha. u im: Xy dng cy multicast a lung kh n gin da vo kt cu sn c ca Pastry v Scribe. Khi mng n nh v vic phn chia nh danh l kh u th cc nt trong h thng chu qu ti tng ng nhau. Thm vo l cc c ch tm nt cha nhm m bo cc nt trong mng khng b qu ti. Nhc im: Khng m bo c chnh lch tr cc lung nhn c ti cc nt l nh, do vic to cy Scribe mang tnh ngu nhin da ch yu vo kt cu bn di ca Pastry. 3.4 Kt lun chng III Chng ny nhm gii thiu v Pastry, nn tng xy dng ca giao thc Scribe. ng thi m t qu trnh gia nhp, ri nhm, truyn tin multicast ti mng v qu trnh sa cy multicast trong Scribe. T a ra c cc u nhc im ca giao thc Scribe trong vic truyn tin multicast lp ng dng so vi IP multicast. Gii thiu k thut SplitStream qua p dng vo giao thc Scribe nhm khc phc nhng nhc im ca giao thc Scribe, to mt h thng cy multicast a lung.

L Ngc Anh D09VT2

64

n tt nghip i hc

kt lun n

KT LUN N
Trn th gii, cc ng dng mng ngang hng ni chung v multicast trn mng ngang hng ang c nghin cu v pht trin mt cch mnh m. N s v ang dn thay th cc m hnh mng truyn thng nh m hnh khch-ch hay IP multicast. Trong kha lun ny trnh by mt cch ngn gn v nghin cu multicast lp ng dng cho truyn video thi gian thc trong mng ngang hng P2P, c th l ci thin giao thc Scribe. Tuy nhin vic trin khai multicast lp ng dng vn cha thc s p ng c cc yu cu ca P2P video streaming thi gian thc, v d nh s ra vo ca cc nt, tr ln. Hn na cc gii php ny cn cha xt n vn cc nt khng ng gp. Vi nhng kt qu t c v nhng mt cn tn ti, sau y l mt vi hng pht trin tip theo: Khc phc nhng nhc im nu trn. S dng phn mm OverSim so snh nh gi hiu nng gia Scribe v SplitStream. Nghin cu ci thin QoS khi truyn video streaming qua mng P2P. Mt ln na em xin chn thnh cm n c gio V Th Thy H hng dn em, cng cc thy c b mn tn tnh gip em trong thi gian hc tp ti trng em c kin thc c th hon thnh n ny.

L Ngc Anh D09VT2

65

n tt nghip i hc

Ti liu tham kho

TI LIU THAM KHO


Ti liu ting Vit: 1. Bi th Lan Hng: Lun vn thc s Phng php multicast tng ng dng da trn c ch ko y cho truyn video thi gian thc trn mng P2P. 2. Nguyn Vn Minh: Lun vn tt nghip Truyn tin multicast a lung thi gian thc trn mng ngang hng c cu trc. 3. Nguyn Ngc Anh, Topology Optimization for DTH-based Application Layer Multicast, Trng i hc Cng Ngh, 2012. 4. ThS. V Th Thy H, TS. L Nht Thng, bi bonh tuyn trong mng ngang
hng th h mi.

Ti liu ting Anh: 1. Antony Rowstron and Peter Druschel: Pastry: Scalable, deccentralized object location and routing for lagre scale peer to peer systems. 2. Bin Rong, Video Streaming over the Internet using Application Layer Multicast, RMIT University, 2008. 3. Chung-Yan Chen, Yu-Wei Chen, Design and Analysis of Streaming for P2P, Graduate Institute of Information and Logistics Management, National Taipei University of Technology, 2013. 4. Luca Abeni, Csaba Kiraly, Renato Lo Cigno, Scheduling P2P Multimedia Streams: Can we achieve performance and robustness?, 2009 IEEE. 5. L. Abeni, C. Kiraly, R. Lo Cigno, Achiving performance and robustness in P2P streaming systems, University of Trento, Italy, Tech. Rep. TR-DISI-09041, 2009. 6. Indrani Gupta, Ken Binman, Prakash Linga, Al Demers, Robbert van Renesse: Peer to Peer Networks: Kelips. 7. Xuemin Shen, Heather Yu, John Buford, Mursalin Akon, Handbook of Peerto-Peer, Springer 2009.

L Ngc Anh D09VT2

66