Confer - Virginia Techpeople.cs.vt.edu/~irchen/6204/paper/broadcast.pdf · arian t index fanouts,...

Preview:

Citation preview

OrganizationofBroadcastData

Source:[2]:S.Acharya,etal.\Broadcastdisks:datamanagementfor

asymmetriccommunicationenvironments,"ACM

SIGMODInternational

ConferenceonManagementofData(SIGMOD1995),1995.

1

ExpectedDelayforVariousAccessProbabilities

AccessProbability

ExpectedDelay

(inbroadcastunits)

A

B

C

Flat(a)

Skewed(b)

Multi-disk(c)

0.333

0.333

0.333

1.50

1.75

1.67

0.50

0.25

0.25

1.50

1.63

1.50

0.75

0.125

0.125

1.50

1.44

1.25

0.90

0.05

0.05

1.50

1.33

1.10

1.0

0.0

0.0

1.50

1.25

1.00

2

BroadcastProgramGeneration

BroadcastProgramGeneration

(Forsimplicity,assumethatdataitemsare\pages",thatis,theyareofa

uniform,�xedlength.)

1.Orderthepagesfromhottest(mostpopular)tocoldest.

2.Partitionthelistofpagesintomultiplerange,whereeachrangecontains

pageswithsimilaraccessprobabilities.Theserangesarereferredtoasdisk.

3.Choosetherelativefrequencyofbroadcastforeachofthedisks.Theonly

restrictionontherelativefrequenciesisthattheymustbeintegers.For

examplegiventwodisks,disk1couldbebroadcastthreetimesforevery

twotimesthatdisk2isbroadcast,thus,relfreq(1)=3,andrelfreq(2)=2.

(Nextpagetocontinue�

�)

3

BroadcastProgramGeneration(con't)

4.Spliteachdiskintoanumberofsmallerunits.Theseunitsarecalled

chunks(Cijreferstothejth

chunkindiski).First,calculatemaxchunks

astheLeastCommonMultiple(LCM)oftherelativefrequencies.Then,

spliteachdiskiintonumberchunks(i)=maxchunks/relfreq(i)chunks.In

thepreviousexample,numberchunks(1)wouldbe2,whilenumberchunks(2)

wouldbe3.

5.Createthebroadcastprogrambyinterleavingthechunksofeachdiskinthe

followingmanner:

(Nextpagetocontinue�

�)

4

BroadcastProgramGeneration(con't)

01

fori=0tomaxchunks�

1

02

forj=1tonum

disks

03

k=im

od

num

chunks(j)

04

BroadcastchunkCj;k

05

endfor

06

endfor

5

Deriving a Server Broadcast Program

C1,1 C2,1 C3,1 C1,1 C2,2 C3,2 C1,1 C2,1 C3,3 C1,1 C2,2 C3,4

1 2 4 5 1 3 6 7 1 2 8 9 1 3 1011

1 2 3 4 5 6 7 8 9 1011C1,1 C2,1 C2,2 C3,1 C3,2 C3,3 C3,4

1 2 3 4 5 6 7 8 9 1011

T1

2 3 4 5 6 7 8 9 10111

Major Cycle

Minor Cycle

Tracks

TT2 3

COLDHOT

Chunks

Database (pages)

Broadcast Disk program6

OrganizationofBroadcastData

Source:M.S.Chen,K.L.WuandP.S.Yu,\Indexedsequentialdata

broadcastinginawirelesscomputingenvironment,"17thIEEE

InternationalConferenceonDistributedComputingSystems.1997,pp.

124-131.

7

IndexBroadcasting:

�Toachieveenergysaving

�Whenapalmtopisactivelylisteningtoachannel,itCPUmustbein

anactivemodetoexaminedatapacketssoastodetermineifthey

matchtheprede�nedpatterns.

�Therefore,toachieveenergysavingitishighlydesirabletoletthe

palmtopsstayinthedozemodemostofthetimeandonlycometothe

activemodewhenitisnecessary.8

IndexBroadcasting:

(a) an example index tree

I

a2a1 a3

R1 R2 R3 R4 R5 R6 R7 R8 R9

I a1 R1 R2 R3 a2 R4 R5 R6 a3 R7 R8 R9

(b) index probing scenario to datarecord R5

9

�Wheredoesthesystemarrangetheindex?

{Thesystembroadcaststheindexandbroadcastdatainachannel.

{Thesystembroadcaststheindexandbroadcastdataintwo

di�erentchannels.

�Here,weonlydiscussedtheformercase,i.e.,theindexandbroadcast

dataareinthesamechannel.

10

�Themainarchitectureofindexdesigninthissubsection.

{Designanindextreewhichcanminimizetheaveragecostofindex

probes.Twocasesareconsidered:onefor�xedindexfanoutsand

theotherforvariantindexfanouts.

�Forthecaseof�xedindexfanouts,inlightsofHu�mancode,CF

(constantfanout)isderivedfortheoptimalindextree

constructionthatminimizestheaveragenumberofindexprobes.

�Forthecaseofvariantindexfanouts,VF(variantfanout)is

derivedandshowsthattheaveragecostofindexprobescanbe

reducednotonlybyemployinganimbalancedindextreethatis

designedinaccordancewithdataaccessskew,butalsoby

exploitingvariantfanoutsforindexnotes.

11

ImbalancedIndexTreeConstructionforFixedFanouts

Theaccessprobabilityforeachdatarecordandthenumberofindex

probesrequiredtoreacheacheachrecordbyTBd

=3andTId

=3 .

Datarecord

R1

R2

R3

R4

R5

R6

R7

R8

R9

Pr(Ri )

0.4

0.4

0.05

0.05

0.02

0.02

0.02

0.02

0.02

Ipb (Ri )inTBd

=3

2

2

2

2

2

2

2

2

2

Ipb (Ri )inTId

=3

1

1

2

3

3

3

3

3

3

12

AlogrithmCF:Useaccessfrequenciestobuildanindextreewitha�xed

fanoutd.

Step1:Initially,wehaveaforestofnsubtrees,eachofwhichisasingle

node.

Step2:Attachthedsubtreeswiththesmallestlabelstoanewnode.

Labeltheresultingsubtreeswiththesumofalllabelsfromitsd

subtrees.

Step3:n=n�d+1.(Then,nisthenumberofremainingsubtrees.)If

n=1stopelsegotoStep2.

Theorem

1:Givena�xedindexfanout,theaveragenumberofindex

probes,i.e., P1�i�nPr(Ri )Ipb (Ri ),isminimizedbyusingtheindextree

constructedbyalgorithmCF.

13

Illustration of an imbalanced index tree

(a) an index tree built by CF

I

a1

I R1 R2 a1 R3 a2 R4 R5 R6 a3 R7 R8 R9

(b) a corresponding data broadcastsequence

R1 R2

a2

R4 R5 R6

a3

R7 R8 R9

R3

0.4 0.4 0.2

0.05

.05 .02 .02 .02 .02 .02

0.060.09

14

�Denotethecostofprobingfromanindexaiasf(ai ).Then,the

averagecostoflocatingarecordbyprobingindexescanbe

expressedas:

X1�i�n (P

r(Ri )�

Xaj 2Path(Ri )

f(aj ))

�Theindexprobecostrequiredtoreacheachrecordbydi�erentindex

treebuiltbyCF

Datarecord

R1

R2

R3

R4

R5

R6

R7

R8

R9

Pr(Ri)

0.4

0.4

0.05

0.05

0.02

0.02

0.02

0.02

0.02

Paj2

Path(Ri)d(aj)inTId

=2

2

4

8

8

10

10

10

12

12

Paj2

Path(Ri)d(aj)inTId

=3

3

3

6

9

9

9

9

9

9

Paj2

Path(Ri)d(aj)inTId

=4

3

3

7

7

7

11

11

11

11

15

An index tree T Id=2 built by algorithm CF

I

a1

R1

R2

a2

0.4

0.4

0.06

0.2

R4

.05

R5

.02 R6

.02

R8

.02

R9

.02

R3

.05

0.6

a3

0.11

a4

0.09

a5

a7

R7

.02

a6

0.04

0.04

16

An index tree T Id=4 built by algorithm CF

I

a1

R1 R2

a2

R7

0.4 0.4 0.2

0.08

R4

.05

R5

.02

R6

.02 .02

R8

.02

R9

.02

R3

.0517

ImbalancedIndexTreeConstructionforVariantFanouts

�Basically,algorithmVFisgreedyinnatureandbuildstheindextree

inatopdownmanners

�VFstartswithattachingalldatarecordstotherootnode.Then,

aftersomeevaluation,VFgroupsnodeswithsmallaccessfrequencies

andmovesthemtoonelevellowersoastominimizetheaverageindex

probecost.

18

Illustration of VF idea

r

h1 h2

r

hxh1 h2

hm

hi

hmhi+2hi+1

19

Lemma:Supposethatnoderhasm

childnodes,h1 ,h2 ,���,hm,which

aresortedaccordingtodescendingorderofPr(hj ),1�j�m,i.e.,

Pr(hj )�Pr(hk )i�j�k.Then,theadvantagecostofindexprobescan

bereducedbygroupingnodeshi+1 ,hi+2 ,���,hm

andattachingthem

underanewchildnodeifandonlyif

(m�i�1)X1

�j�i P

r(hj )>

Xi+1�j�m

Pr(hj )

20

AlogrithmVF:

Step1:AssumethatR1 ,R2 ,���,Rn

havebeensortedaccordingto

descendingorderofPr(Rj ).

Step2:Partition(R1 ;R2 ;���;Rn).

Step3:Reporttheresultingindextree.

21

ProcedurePartition(h1 ;h2 ;���;hm):

1.Lety(i)=(m�i�1) P1�j�iPr(hj )�P

i+1�j�m

Pr(hj ).Determine

i �suchthaty(i �)=max8i2f1;m�2g fy(i)g.

2.Ify(i �)�0thenreturn.

3.Attachnodeshi�

+1 ,hi�

+2 ,���,hm

underanewindexnodehxinthe

indextree.

4.Partition(hi�

+1 ;hi�

+2 ;���;hm).(h1 ,h2 ,���,hi�

+1 )accordingto

descendingorderofPr(hj ),1�j�i �+1.

5.Partition(h1 ;h2 ;���;hi�

+1 ).

6.Return.

22

Example:

WeuseanexampletoillustratealgorithmVF.

Datarecord

R1

R2

R3

R4

R5

R6

R7

R8

R9

R10

R11

Pr(Ri)

0.28

0.2

0.2

0.2

0.04

0.04

0.02

0.005

0.005

0.005

0.005

23

Illustration of VF

(a)

a1

(b)

a2

a1

.48

.12

.52

I

R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11

I

R1 R2 R3 R4

R5 R6 R7 R8 R9 R10 R11

I

R1 R2

R3 R4

(c)

a2

a1

.52

I

R1 R2 R3 R4

a3

(d)

24

�Determinethesetofnodestobegroupedtogetherin(a),where

m

=11.

i

1

2

3

4

5

6

7

8

9

(10�

i)

X1<j<i Pr(hj)

9*0.28

8*0.48

7*0.68

6*0.88

5*0.92

4*0.96

3*0.98

2*0.985

0.99

X

i+1<j<11Pr(hj)

0.72

0.52

0.32

0.12

0.08

0.04

0.02

0.015

0.01

y(i)

1.8

3.32

4.44

5.16

4.52

3.8

2.92

1.955

0.98

�Determinethesetofnodestobegroupedtogetherin(b),where

m

=5.

i

1

2

3

(4�

i) P1<j<iPr(hj)

3*0.28

2*0.48

0.68

Pi+1<j<5Pr(hj)

0.72

0.52

0.32

y(i)

0.12

0.44

0.32

25

Illustration of VF { Further Partitions of Nodes Under Index a1

(a)

a4

(b)

a1

R5 R6 R7 R8 R9 R10 R11

R5

R6 R7 R8 R9 R10 R11

(c)

.08

a1

a4

R5

R6 R7

R8 R9 R10 R11

.08

a1

a5.02

26

Illustration of VF { the Resulting Index Tree

.48

a2.52

I

R1 R2R3 R4

a3

a4

R5

R6 R7

R8 R9 R10 R11

.08

a1

a5.02

.12

27

Interleaving the broadcasting sequence with index nodes

I a3 R1 R2 a2 R3 R4 a1 R5 a4 R6 R7 a5 R8 R9 R10 R11

R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11

I, a3 a2 a1 a4 a5

(a)

(b)

28