the network simulator ns2 · 2013-03-17 · • ns2 does not adopt the dynamic calendar...
TRANSCRIPT
![Page 1: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/1.jpg)
TheNetworkSimulatorNS2
h8p://www.ce.uniroma2.it/courses/MMI/
h8p://www.uniroma2.it/dida?ca/MMI
EmilianoCasalicchio‐[email protected]
![Page 2: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/2.jpg)
Agenda
• Conce?fondamentali• EvenFeScheduler• Archite8ura• Esempio
• NodieRouFng• Workloadelivellodiapplicazione
• Generaziondedelletopologiedirete
EmilianoCasalicchio‐[email protected]
![Page 3: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/3.jpg)
Documentazione
• Questalezioneèbasatasulmaterialeseguente• h8p://www.isi.edu/nsnam/ns/
– MarcGreis'stutorial– "NSforBeginners"byAltmanandJimenez– NsManual– “NSbyExample”byJ.ChungandM.Claypoolh8p://nile.wpi.edu/NS/– Variepresentazionietutorial“nsworkshopsandpresentaFons”
• Tcl/tk,h8p://www.tcl.tk/• Otcl,h8p://bmrc.berkeley.edu/research/cmt/cmtdoc/otcl/index.html• Altrichetroveretenelseguito…
EmilianoCasalicchio‐[email protected]
![Page 4: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/4.jpg)
Installazioneh8p://www.isi.edu/nsnam/ns/ns‐build.html
All‐in‐one(Consigliata–Linux/Windows/Mac):UlFmaversione(Jun17,2009)h"p://sourceforge.net/projects/nsnam/files/allinone/ns‐allinone‐2.34/
– Tclrelease8.4.18(requiredcomponent)– Tkrelease8.4.18(requiredcomponent)– Otclrelease1.13(requiredcomponent)– TclCLrelease1.19(requiredcomponent)– Nsrelease2.33(requiredcomponent)– Namrelease1.13(opFonalcomponent)– Xgraphversion12(opFonalcomponent)– CWebversion3.4g(opFonalcomponent)– SGBversion1.0(?)(opFonalcomponent,buildssgblibforallUNIXtype
plaiorms)– Gt‐itmgt‐itmandsgb2ns1.1(opFonalcomponent)– Zlibversion1.2.3(opFonal,butrequiredshouldNambeused)
Oppure…InstallazioneeconfigurazioneseparatadeisingolicomponenA
EmilianoCasalicchio‐[email protected]
![Page 5: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/5.jpg)
Cos’èNS2• Discrete‐eventsimulator
– Sviluppatoall’UCBerkeley• SimulazionealivellodipaccheEo• ModellazionedallivelloDataLinkalivelloApplicazione
– protocollilivelloMAC(persimulazioniLAN)– AlgoritmidirouFng:Dijkstra,etc…– MeccanismidigesFonedellecodedeirouter:DropTail,RandomEarly
DetecFon/Drop(RED)e(Class‐BasedQueueing)CBQ– Protocollidirete:TCP,UPD(overIPeIPv6)– SorgenFditraffico:FTP,Telnet,Web,CBReVBR,
• Opensource(vastacomunitàdisviluppatoriedutenF)• Basatosu
– C++persimulaFonengineemodelli– Tcl/OTcl(ObjectToolCommandLanguage)perconfigurazionescenarie
logicadisimulazione
EmilianoCasalicchio‐[email protected]
![Page 6: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/6.jpg)
Vistautente:conce?fondamentali
• Otclpersetupedesecuzionesimulazione– inizializzazioneeventscheduler,– SetuptopologiauFlizzando“networkobject”e“plumbingfuncFon”– Specificareinizioefinegenerazionetraffico(evenF)
• Evento=(packetID,ScheduleTime,ObjPointer)– L’ObjèunnetworkobjectchegesFràilpacche8o
• L’EventScheduler– ManFeneiltemposimulato– Estrae(fire)tu?glievenF(pacche?)cheoccorronoaltempotinvocandoirelaFvi
componenFdirete(networkobject/component)– Loschedulerèsinglethread(noproblemilocking/compeFzionerisorse)
• IcomponenFdiretecomunicanoscambiandosipacche?EmilianoCasalicchio‐[email protected]
![Page 7: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/7.jpg)
Agenda
• Introduzione• EvenFeScheduler• Archite8ura• Esempio
• RouFng• Workloadelivellodiapplicazione
• Generaziondedelletopologiedirete
EmilianoCasalicchio‐[email protected]
![Page 8: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/8.jpg)
Stru8uradaFEvent• ungenericoeventocomprendegeneralmenteunfiringFmeeunafunzione
manipolatrice(de8a“handler”)• LaclassedenominataHandlerconFenesemplicementeunafunzionevirtuale,che
quindidovràesserespecializzatatramiteleclassidaessaderivate
EmilianoCasalicchio‐[email protected]
![Page 9: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/9.jpg)
EventScheduler
EmilianoCasalicchio‐[email protected]
A seconda di come gestisco la coda ho diverse prestazioni, e.g 1) massimizzare il numero di eventi che riesco a processare nell’unità di
tempo (reale), e quindi aumentare la velocità della simulazione 2) massimizzare la quantità di eventi che riesco a gestire,
indipendentemente dalla loro velocità di processamento (dimensione della coda!!), per aumentare la dimensione dei sistemi che riesco a simulare
3) 1) e 2) strettamente correlati
![Page 10: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/10.jpg)
SchedulerinNS‐2
• Listscheduler
• Heapscheduler
• Calendarscheduler(default)
• Real‐Fmescheduler
• “All made the same task with different performances”
EmilianoCasalicchio‐[email protected]
Es: set ns [new Simulator] $ns use-scheduler Heap
![Page 11: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/11.jpg)
ListScheduler
• Thelistscheduler(Scheduler/List../ns‐2/scheduler.cc)implementstheschedulerusingasimplelinked‐liststructure
• ThelistiskeptinAme‐order(earliesttolatest),– soeventinserFonanddeleFonrequirescanningthelisttofindtheappropriate
entry
• ChoosingthenexteventforexecuFonrequirestrimmingthefirstentryofftheheadofthelist– ThisimplementaFonpreserveseventexecuFoninaFIFOmannerforsimultaneous
events.
EmilianoCasalicchio‐[email protected]
![Page 12: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/12.jpg)
HeapScheduler
• Theheapscheduler(Scheduler/Heap../ns‐2/scheduler.cc)implementstheschedulerusingaheapstructure.
• Aheapisaspecializedtree‐baseddatastructurethatsaFsfiestheheapproperty:ifBisachildnodeofA,thenkey(A)≥key(B).
• Thisstructureissuperiortotheliststructureforalargenumberofevents,asinserFonanddeleFonFmesareinO(logn)fornevents.
EmilianoCasalicchio‐[email protected]
![Page 13: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/13.jpg)
Calendarscheduler• Thecalendarqueuescheduler(Scheduler/Calendar../ns‐2/scheduler.cc)
usesadatastructureanalogoustoaone‐yeardeskcalendar,inwhicheventsonthesamemonth/dayofmulFpleyearscanberecordedinoneday.
• TheoriginalimplementaFonofCalendarqueuesinnsv2wascontributedbyDavidWetherall.– AnewimplementaFonfromXi(2005)h8p://netlab.caltech.edu/projects/
ns2tcplinux/ns2patch/
• TheoriginalNS‐2.28usesaCalendarQueuetoimplementthepriorityqueue,whichstorethefutureeventsinthesimulaFon.
EmilianoCasalicchio‐[email protected]
![Page 14: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/14.jpg)
OriginalCalendarscheduler• Thecalendarqueuestoresevents
intoanarrayofbuckets.– Abucketcorrespondstoa"day"
inarealcalendar.
– AbucketcanholdmulFpleevents,asyoucanwritedownmulFplenotesineachdayinarealcalendar.
– Thewholebucketarraycorrespondstoa"year".Ifeventsinthesame"day"butindifferent"years"sharethesamebucket.
– Whenaneweventisinserted,wecancalculatetherightbucketinO(1)andinserttheeventintothisbucketvialinearsearch.
– Thesizeofthearraymaybedoubledifthenumberofeventsgrowslarger,orhalvedifthenumberofeventsgrowssmaller.EmilianoCasalicchio‐
R. Brown. 1988. Calendar queues: a fast 0(1) priority queue implementation for the simulation event set problem. Commun. ACM 31, 10 (October 1988), 1220-1227.
![Page 15: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/15.jpg)
OriginalCalendarscheduler• Theefficiencyofthecalendarqueueseemstodependonthewidthof
eachbucket.– Ifthewidthofabucketistoolong,manyeventsmaybeputintoonebucket
wherelinearsearchhappenswhenaneweventisinserted
– Ifthewidthofabucketistoosmall,mostoftheeventsinthebucketsareofdifferentyearsandthereisalargeoverheadfordequeue(linearsearchoverthecalendardays).
EmilianoCasalicchio‐[email protected]
![Page 16: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/16.jpg)
OriginalCalendarscheduler• TheopFmalsoluFonforbucketwidth,istheaverageintervalbetweenadjacentevents.
• Tocalculatetheaverageintervalbetweenadjacentevents,onehastotraversethewholequeueandcalculatetheaverageintervals.
• NS‐2calculatestheaverageintervalbetweenadjacentevents:
1)pickupthefullestbucket(withlargestnumberofevents),
2)calculatetheaverageintervalinthatbucket,assuggestedinDynamicCalendarQueue
3)setbucketsize=averageinterval*4.(4isprobablytheheurisFcnumberthatkeeptheinqueueanddequeuecomplexitybalanced)
• Steps1‐3mayresultinawidthvaluemuchlargerthanthesuggestedopFmialvalue.
• Ifinthefullestbuckettherearesomeeventsindifferent"years"andmostoftheeventsareclusteredwithin"seconds”
– eachbucketwillhaveawidthinunitof"years"and
– mostoftheevents(clusteredwithinseconds)willgointoafewbucketsof"years".
• NS2doesnotadopttheDynamicCalendarQueue'sresizetriggeringalgorithm.
– Oncethebucketwidthissettobeavalue,itwon'tchangeunlessthebucketnumberneedstobechanged(bysignificantchangeonnumberofeventsinthequeue)
EmilianoCasalicchio‐[email protected]
JongSuk Ahn, SeungHyun Oh. "Dynamic Calendar Queue,"
![Page 17: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/17.jpg)
SpeedingupNS‐2scheduler• AnewimplementaFonfromXi(2005)
– h8p://netlab.caltech.edu/projects/ns2tcplinux/ns2patch/
• ThreechangestotheoriginalCalendarScheduler:
1)TheesFmaFonofthebucket_size:Thepatches1matesthebucket_sizebytheaverageintervalofdequeuedeventsinthepastwindow.Thisisclosertotherealdistribu1onunlesstheeventarrivalpaAernsignificantlychanges.
2)SNOOPyCalendarQueuedynamicadjustmentisimplementedtoreacttothechangeofeventarrivalpaAern.
3)Forthe"insert"funcFon,theoriginalcodetraversesfromtheheadtothetail.Thepatchtraversesfromthetailtothehead,whichmaytraverselessnodesifeventsareoReninsertedtotheendofthepriorityqueue.
EmilianoCasalicchio‐[email protected]
Kah Leong Tan, Li-Jin Thng, "SNOOPy Calendar Queue", Proceedings of the 32nd conference on Winter simulation, Orlando, Florida, Pages: 487 - 495, 2000,
![Page 18: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/18.jpg)
Confrontodiprestazionitraschedulers
EmilianoCasalicchio‐[email protected]
Xi (2005) http://netlab.caltech.edu/projects/ns2tcplinux/ns2patch/
![Page 19: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/19.jpg)
RealTimescheduler
• Thereal‐Fmescheduler(classScheduler/RealTime)a8emptstosynchronizetheexecuFonofeventswithreal‐Fme.– Itiscurrentlyimplementedasasubclassofthelistscheduler.
• Thereal‐FmecapabilityisusedtointroduceanNSsimulatednetworkintoareal‐worldtopologytoexperimentwitheasily‐configurednetworktopologies,cross‐traffic,etc.– ThisonlyworksforrelaFvelyslownetworktrafficdatarates,asthe
simulatormustbeabletokeeppacewiththereal‐worldpacketarrivalrate,andthissynchronizaFonisnotpresentlyenforced.
EmilianoCasalicchio‐[email protected]
![Page 20: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/20.jpg)
TimePrecision• Precisionoftheschedulerclockcanbedefinedasthesmallest
Ame‐scaleofthesimulatorthatcanbecorrectlyrepresented.
• Theclockvariablefornsisrepresentedbyadouble.– AspertheIEEEstdforfloaFngnumbers,adouble,consisFngof64bits
mustallocatethefollowingbitsbetweenitssign,exponentandmanFssafields:sign=1bitexponent=11bitmanFssa=52bit
– AnyfloaFngnumbercanberepresentedintheformX*2nwhereXisthemanFssaandnistheexponent.
• ThustheprecisionofFmeclockinnscanbedefinedas– 1/(252)=2.2204e‐16sec.
EmilianoCasalicchio‐[email protected]
![Page 21: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/21.jpg)
Agenda
• Conce?fondamentali• EvenFeScheduler• Archite8ura• Esempio
• RouFng• Workloadelivellodiapplicazione
• Generaziondedelletopologiedirete
EmilianoCasalicchio‐[email protected]
![Page 22: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/22.jpg)
Archite8ura• C++usatoperprocessareIpache?:
– SchedulereNetworkcomponentsscri?inC++
– Veloce,de8agliato,controllocompleto
• Otclusatoperilcontrollo,– setupdellasimulazione,configurazione,azionioccasionali
– Rapidodascrivereemodificare
• C++eOTclcondividonolastessagerarchiadiclassi.– Corrispodenza(OTcllinkage‐TclCL)traogge?C++eOtcl
C++obj–TclCL–Otclobj
– Solopergliogge?chemodellanonetworkcomponent
EmilianoCasalicchio‐[email protected]
Tcl
OTcl
TclCL
ns‐2
EventScheduler
NetworkComponents
C/C++
![Page 23: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/23.jpg)
Archite8ura:Overview
• Thesimulatorsupports– AclasshierarchyinC++,and
– AsimilarclasshierarchywithintheOtclinterpreter
• Thetwohierarchiesarecloselyrelatedtoeachother;fromtheuser’sperspecFve,thereisaone‐to‐onecorrespondence
– TherootofthishierarchyistheclassTclObject• Userscreatenewsimulatorobjectsthroughtheinterpreter
– TheseobjectsareinstanFatedwithintheinterpreter,andarecloselymirroredbyacorrespondingobjectinthecompiledhierarchy.TheinterpretedclasshierarchyisautomaFcallyestablishedthroughmethodsdefinedintheclassTclClass.
– UserinstanFatedobjectsaremirroredthroughmethodsdefinedintheclassTclObject.
– ThereareotherhierarchiesintheC++codeandOTclscripts;theseotherhierarchiesarenotmirroredinthemannerofTclObject.
EmilianoCasalicchio‐[email protected]
![Page 24: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/24.jpg)
Classiprincipali• TclObjectisthebaseclassformostoftheotherclassesintheinterpreted
andcompiledhierarchies.• EveryobjectintheclassTclObjectiscreatedbytheuserfromwithintheinterpreter.
• Anequivalentshadowobjectiscreatedinthecompiledhierarchy.Thetwoobjectsarecloselyassociatedwitheachother.
• TheclassTclClasscontainsthemechanismsthatperformthisshadowing.
– TclClassisapurevirtualclass.• ClassesderivedfromthisbaseclassprovidetwofuncFons:constructtheinterpretedclasshierarchytomirrorthecompiledclasshierarchy;and
• providemethodstoinstanFatenewTclObjects.
• EachsuchderivedclassisassociatedwithaparFcularcompiledclassinthecompiledclasshierarchy,andcaninstanFatenewobjectsintheassociatedclass.
EmilianoCasalicchio‐[email protected]
![Page 25: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/25.jpg)
Agenda
• Introduzione• EvenFeScheduler• Archite8ura• Esempio
• NodieRouFng• Workloadelivellodiapplicazione
• Generaziondedelletopologiedirete
EmilianoCasalicchio‐[email protected]
![Page 26: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/26.jpg)
NodeandRouFng
Unicast‐ $nsrtprototype
(type:StaFc,Session,DistanceVector,cost,mulF‐path)MulFcast‐ $nsmulFcast(righta}erset$ns[newScheduler])‐ $nsmrtprototype
(type:CtrMcast,DM,ST,BST)EmilianoCasalicchio‐[email protected]
![Page 28: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/28.jpg)
Tracing
• $nstrace‐allfileor• $nsnamtrace‐allfile
• $nscreate‐trace{typefilesrcdst}EmilianoCasalicchio‐
![Page 31: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/31.jpg)
Agenda
• Conce?fondamentali• EvenFeScheduler• Archite8ura• Esempio
• RouFng• Workloadelivellodiapplicazione
• Generaziondedelletopologiedirete
EmilianoCasalicchio‐[email protected]
![Page 32: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/32.jpg)
Basictclproc test { a b } { set c [expr $a + $b] set d [expr [expr $a - $b] * $c] for {set k 0} {$k < 10} {incr k} {
if {$k < 5} { puts “k < 5, pow = [expr pow($d, $k)]” } else { puts “k >= 5, mod = [expr $d % $k]” } } }
test 43 27
%oppure
set aa 43 set bb 27 Test $aa $bb
Output
EmilianoCasalicchio‐[email protected]
![Page 33: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/33.jpg)
HelloWorld‐InteracFveMode
swallow 71% ns % set ns [new Simulator] _o3
% $ns at 1 “puts \“Hello World!\”” 1
% $ns at 1.5 “exit” 2 % $ns run Hello World! swallow 72%
EmilianoCasalicchio‐[email protected]
![Page 34: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/34.jpg)
HelloWorld‐BatchMode
simple.tcl set ns [new Simulator] $ns at 1 “puts \“Hello World!\”” $ns at 1.5 “exit” $ns run
swallow 74% ns simple.tcl Hello World!
swallow 75%
EmilianoCasalicchio‐[email protected]
![Page 36: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/36.jpg)
InstancesimulaFonobject• setns[newSimulator]:generatesanNSsimulatorobject
instance,andassignsittovariablens.ToinstaFateaSimulatorobjectmeans:– IniFalizethepacketformat
– Createascheduler(defaultiscalendarscheduler)– Selectthedefaultaddressformat
• The"Simulator"objecthasmemberfuncFonsto:– Createcompoundobjectssuchasnodesandlinks
– Connectnetworkcomponentobjectscreated
– Setnetworkcomponentparameters(mostlyforcompoundobjects)
– CreateconnecFonsbetweenagents– SpecifyNAMdisplayopFons
• The"Simulator"objectmemberfuncFonimplementaFonsarelocatedinthe"ns‐2/tcl/lib/ns‐lib.tcl"file.
EmilianoCasalicchio‐[email protected]
![Page 37: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/37.jpg)
NAMsetup
• $nscolorfidcolor:– istosetcolorofthepacketsforaflowspecifiedbytheflowid(fid).– isfortheNAMdisplay,andhasnoeffectontheactualsimulaFon.
• $nsnamtrace‐allfile‐descriptor:– tellsthesimulatortorecordsimulaFontracesinNAMinputformat.
– givesthefilenamethatthetracewillbewri8entolaterbythecommand$nsflush‐trace.
– Similarly,thememberfuncFontrace‐allisforrecordingthesimulaFontraceinageneralformat.
EmilianoCasalicchio‐[email protected]
![Page 38: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/38.jpg)
Networkobjectsetup
• procfinish{}:– funcFonthatspecifypost‐simulaFonprocesses– iscalleda}erthesimulaFonisoverbythecommand$nsat5.0"finish”
• setn0[$nsnode]:– createsanode.AnodeinNSiscompoundobjectmadeofaddressandportclassifiers
– UserscancreateanodebyseparatelycreaFnganaddressandaportclassifierobjectsandconnecFngthemtogether.
– Toseehowanodeiscreated,lookatthefiles:"ns‐2/tcl/libs/ns‐lib.tcl"and"ns‐2/tcl/libs/ns‐node.tcl".
EmilianoCasalicchio‐[email protected]
![Page 39: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/39.jpg)
• $nsduplex‐linknode1node2bandwidthdelayqueue‐type:– createstwosimplexlinksofspecifiedbandwidthanddelay,andconnectsthetwospecifiednodes.
– InNS,theoutputqueueofanodeisimplementedasapartofalink,thereforeusersshouldspecifythequeue‐typewhencreaFnglinks.
– IntheabovesimulaFonscript,DropTailqueueisused.– Linksourcecodescanbefoundin"ns‐2/tcl/libs/ns‐lib.tcl"and"ns‐2/tcl/libs/ns‐link.tcl"files.
– theusercaninserterrormodulesinalinkcomponenttosimulatealossylink EmilianoCasalicchio‐
![Page 40: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/40.jpg)
• $nsqueue‐limitnode1node2number:– setsthequeuelimitofthetwosimplexlinksthatconnectnode1andnode2tothenumberspecified.
– takealookat"ns‐2/tcl/libs/ns‐lib.tcl"and"ns‐2/tcl/libs/ns‐link.tcl",orNSdocumentaFonformoreinformaFon.
• $nsduplex‐link‐opnode1node2...:– EffecttheNAManimaFonshowingflowsofpackets– Toseetheeffectsoftheselines,userscancommenttheselinesoutandtrythesimulaFon.
EmilianoCasalicchio‐[email protected]
![Page 41: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/41.jpg)
SetupTrafficAgents• settcp[newAgent/TCP]:
– createsaTCPagent.Butingeneral,userscancreateanyagentortrafficsourcesinthisway.
– Agentsandtrafficsourcesareinfactbasicobjects(notcompoundobjects),mostlyimplementedinC++andlinkedtoOTcl.Therefore,therearenospecificSimulatorobjectmemberfuncFonsthatcreatetheseobjectinstances.
– Tocreateagentsortrafficsources,ausershouldknowtheclassnamestheseobjects(Agent/TCP,Agnet/TCPSink,ApplicaFon/FTPandsoon).
– ThisinformaFoncanbefoundintheNSdocumentaFonorpartlyinthisdocumentaFon.Butoneshortcutistolookatthe"ns‐2/tcl/libs/ns‐default.tcl"file.Thisfilecontainsthedefaultconfigurableparametervaluese?ngsforavailablenetworkobjects. EmilianoCasalicchio‐
![Page 42: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/42.jpg)
• $nsaEach‐agentnodeagent:– a8achesanagentobjectcreatedtoanodeobject.Actually,whatthisfuncFondoesiscallthea8achmemberfuncFonofspecifiednode,whicha8achesthegivenagenttoitself.Therefore,ausercandothesamethingby,forexample,$n0a8ach$tcp.Similarly,eachagentobjecthasamemberfuncFona8ach‐agentthata8achesatrafficsourceobjecttoitself.
• $nsconnectagent1agent2:– toestablishalogicalnetworkconnecFonbetweentwoagents.ThislineestablishesanetworkconnecFonbyse?ngthedesFnaFonaddresstoeachothers'networkandportaddresspair.EmilianoCasalicchio‐
![Page 43: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/43.jpg)
Scenariosetup
• $nsat1me"string":– makesthescheduler(scheduler_isthevariablethatpointstheschedulerobjectcreatedby[newScheduler]commandatthebeginningofthescript)toscheduletheexecuFonofthespecifiedstringatgivensimulaFonFme.
– Forexample,$nsat0.1"$cbrstart"willmaketheschedulercallastartmemberfuncFonoftheCBRtrafficsourceobject,whichstartstheCBRtotransmitdata.
– InNS,usuallyatrafficsourcedoesnottransmitactualdata,butitnoAfiestheunderlyingagentthatithassomeamountofdatatotransmit,andtheagent,justknowinghowmuchofthedatatotransfer,createspacketsandsendsthem.
EmilianoCasalicchio‐[email protected]
![Page 44: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/44.jpg)
Agenda
• Introduzione• EvenFeScheduler• Archite8ura• Esempio
• NodieRouFng• GenerazionedelWorkload
• Generaziondedelletopologiedirete
EmilianoCasalicchio‐[email protected]
![Page 45: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/45.jpg)
ApplicaFon• App.toAgent:systemcall
– send– sendmsg– close– listen
• AgenttoApp.:upcall– recv– resume
• innsthereisnoactualdatabeingpassedbetweenapplicaAons
EmilianoCasalicchio‐[email protected]
![Page 46: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/46.jpg)
TypeofapplicaFon
• H8pApp• ApplicaFon/
– TcpApp– FTP– Telnet
• ApplicaFon/Traffic/*– ExponenFalOn/Off– ParetoOn/Off– CBR– Traffictrace EmilianoCasalicchio‐
![Page 47: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/47.jpg)
ExponenFalOn/Off• AnExponenFalOn/OffobjectisembodiedintheOTclclassApplicaFon/
Traffic/ExponenFal.
• Themembervariablesthatparameterizethisobjectare:– packetSize_theconstantsizeofthepacketsgenerated– burst_Fme_theaverage“on”Fmeforthegenerator
– idle_Fme_theaverage“off”Fmeforthegenerator
– rate_thesendingrateduring“on”Fmes
• AnewExponenFalOn/Offtrafficgeneratorcanbecreatedandparameterizedasfollows:
EmilianoCasalicchio‐[email protected]
![Page 48: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/48.jpg)
ParetoOn/Off• AParetoOn/OffobjectisembodiedintheOTclclass
ApplicaFon/Traffic/Pareto.
• Themembervariablesthatparameterizethisobjectare:– packetSize_theconstantsizeofthepacketsgenerated– burst_Fme_theaverage"on"Fmeforthegenerator
– idle_Fme_theaverage"off"Fmeforthegenerator
– rate_thesendingrateduring"on"Fmes– shape_the"shape"parameterusedbytheparetodistribuFon
• AnewParetoOn/Offtrafficgeneratorcanbecreatedasfollows:
EmilianoCasalicchio‐[email protected]
![Page 49: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/49.jpg)
CBR• ACBRobjectisembodiedintheOTclclassApplicaFon/Traffic/
CBR.
• Themembervariablesthatparameterizethisobjectare:– rate_thesendingrate– interval_(OpFonal)intervalbetweenpackets– packetSize_theconstantsizeofthepacketsgenerated– random_flagindicaFngwhetherornottointroducerandom“noise”
inthescheduleddepartureFmes(defaultisoff)
– maxpkts_themaximumnumberofpacketstosend
EmilianoCasalicchio‐[email protected]
![Page 50: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/50.jpg)
TrafficTrace• ATrafficTraceobjectisinstanFatedbytheOTclclassApplicaFon/Traffic/Trace.
– TheassociatedclassTracefileisusedtoenablemulFpleTraffic/Traceobjectstobeassociatedwithasingletracefile.
– TheTraffic/Traceclassusesthemethoda8ach‐tracefiletoassociateaTraffic/TraceobjectwithaparFcularTracefileobject.
– ThemethodfilenameoftheTracefileclassassociatesatracefilewiththeTracefileobject.
• ThefollowingexampleshowshowtocreatetwoAp‐plicaFon/Traffic/Traceobjects,eachassociatedwiththesametracefile(called"example‐trace"inthisexample).
• ToavoidsynchronizaFonofthetrafficgenerated,randomstarFngplaceswithinthetracefilearechosenforeachTraffic/Traceobject.
EmilianoCasalicchio‐[email protected]
![Page 51: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/51.jpg)
EmilianoCasalicchio‐[email protected]
Webtraffic(Webcachemodel)
• Therearethreemajorclassesrelatedtowebcache,asitisintherealworld:– client(browser),– server,and– cache
![Page 52: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/52.jpg)
WebPageandPagePool• WebPage
– name,size,modificaFonFme,age
• PagePool– Math
• onepage,whosesizecanbegeneratedbyagivenrandomvariable.
• PagemodificaAonsequenceandrequestsequencearegeneratedusingtwogivenrandomvariables.
– CompMath• introducesacompoundpagemodel.
• acompoundpage=mainpage+severalcomponentobjects.
• Allcomponentobjectshavethesamesize;
– ProxyTrace• [<serverID><URL_ID><PageSize><AccessCount>]
– WebTraffic(togeneratetrafficonlyandnotheaderinfo)
EmilianoCasalicchio‐[email protected]
![Page 54: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/54.jpg)
Internettopologies• ToeffecFvelyengineertheInternet,crucialissuessuchasthelargescale
structureofitsunderlyingphysicaltopology,– itsFmeevoluFonandthecontribuFonofitsindividualcomponentstoitsoverallfuncFonneed
tobewellunderstood.• DuringthedesignphaseofanInternet‐basedtechnology,extensive
simulaFonsareusuallyperformedtoassessitsfeasibility,intermsofefficiencyandperformance.
• Ingeneral,InternetstudiesandsimulaAonsassumecertaintopologicalproperAesorusesyntheAcallygeneratedtopologies.
• IfsuchstudiesaretogiveaccurateguidanceastoInternet‐widebehavioroftheprotocolsandalgorithmsbeingstudied,thechosentopologiesmustexhibitfundamentalproperAesorinvariantsempiricallyfoundintheactualextantstructureoftheInternet.Otherwise,correctconclusionscannotbedrawn.
EmilianoCasalicchio‐[email protected]
![Page 55: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/55.jpg)
BRITEtopologygenerator
• BRITE:BostonuniversityRepresentaFveInternetTopologygEnerator
• h8p://www.cs.bu.edu/brite/
• Routertopologymodel
• AStopologymodel
• Hierarchical– Top‐downtopology model
– Bo8om‐uptopologymodelEmilianoCasalicchio‐
![Page 56: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/56.jpg)
RouterWaxman• BasicallyreferstoageneraFonmodelforarandomtopologyusing
Waxman'sprobabilitymodelforinterconnecFngthenodesofthetopology,whichisgivenby:
P(u,v)=a*e‐d/(b*L)
where0<a,b<=1,
distheEuclideandistancefromnodeutonodev,andListhemaximumdistancebetweenanytwonodes.
EmilianoCasalicchio‐[email protected]
![Page 57: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/57.jpg)
RouteBarabasi‐Alberttopology• RouterBarabasiAlbertmodelthatimplementsamodelproposedbyBarabási
andAlbert
• Thismodelsuggeststwopossiblecausesfortheemergenceofapowerlawinthefrequencyofoutdegreesinnetworktopologies:incrementalgrowthandpreferenFalconnecFvity.– IncrementalgrowthreferstogrowingnetworksthatareformedbytheconFnual
addiFonofnewnodes,andthusthegradualincreaseinthesizeofthenetwork.– PreferenAalconnecAvityreferstothetendencyofanewnodetoconnectto
exisFngnodesthatarehighlyconnectedorpopular.
• RouterBarabasiAlbertinterconnectsthenodesaccordingtotheincrementalgrowthapproach.Whenanodeijoinsthenetwork,theprobabilitythatitconnectstoanodejalreadybelongingtothenetworkisgivenby:
P(i,j)=di/S
wherediisthedegreeofthetargetnodeandSisthesumofoutdegreesofallnodesthatpreviouslyjoinedthenetwork.
EmilianoCasalicchio‐[email protected]
![Page 58: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/58.jpg)
AS‐leveltopology• TheprovidedAS‐levelmodelsareverysimilartothemodels
providedforgeneraFngrouter‐leveltopologies.
• Themaindifferencebetweentheserouter‐levelandAS‐levelmodelsisthefactthatASmodelsplaceASnodesintheplaneandthesehavethecapabilityofcontainingassociatedtopologies.
• NotethatthisdoesnotmeanthattherearenoAS‐levelandrouter‐levelmodelsthatdiffersubstanFallyfromeachother.TheideaofseparaFngrouter‐levelfromAS‐levelfromthebeginningistoallowfortheflexibilityofdevelopingindependentmodelsforeachscenario.
• ThetwoAS‐levelmodelsprovidedwiththeiniFaldistribuFonofBRITEareWaxmanandBarabasiAlbert
EmilianoCasalicchio‐[email protected]
![Page 59: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/59.jpg)
Top‐downtopology• Top‐downmeansthatBRITEgeneratesfirstanAS‐leveltopology(1)according
tooneoftheavailableflatAS‐levelmodels(e.g.Waxman,ImportedFile,etc.).
• Next,foreachnodeintheAS‐leveltopologyBRITEwillgeneratearouter‐leveltopology(2)usingadifferentgeneraFonmodelfromtheavailableflatmodelsthatcanbeusedattherouter‐level.
• (3)BRITEusesanedgeconnecFonmechanismtointerconnectrouter‐leveltopologiesasdictatedbytheconnecFvityoftheAS‐leveltopology.
– PerformingthisinterconnecFonofrouter‐leveltopologiesinarepresentaFvewayisanopenresearchquesFon.
EmilianoCasalicchio‐[email protected]
![Page 60: The Network Simulator NS2 · 2013-03-17 · • NS2 does not adopt the Dynamic Calendar Queue's resize triggering algorithm. – Once the bucket width is set to be a value, it won't](https://reader031.vdocuments.us/reader031/viewer/2022042012/5e72e2da9d29a72d05569464/html5/thumbnails/60.jpg)
EmilianoCasalicchio‐[email protected]