congestion control v1 - webcms3 · tcp’s congestion control responds to these packet drops and...

Post on 22-May-2020

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

LabExercise4CongestionControl&BufferBloatObjectives:

• LearnaboutTCPcongestioncontrol• LearnaboutthedynamicsofTCPandthebufferbloatprobleminhomenetworks

Marks:Thisexerciseisworth12marks.Allanswerswillbemarked.

Deadline:Beforeyourscheduledlabnextweek.Soyougetoneweektoworkonthislab.Forexample,ifyougototheMonday18:00lab,thenyoursubmissionisdueat17:59onthefollowingMonday.Youcansubmitasmanytimesasyouwishbeforethedeadline.Alatersubmissionwilloverridetheearliersubmission,somakesureyousubmit thecorrect file.Donot leaveuntil the lastmoment tosubmit,as theremaybetechnicalorcommunicationserrorandyouwillnothavetimetorectifyit.

LatePenalty:Latepenaltywillbeappliedasfollows:

• 1dayafterdeadline:20%reduction• 2daysafterdeadline:40%reduction• 3daysafterdeadline:60%reduction• 4ormoredayslate:NOTaccepted

Note that theabovepenalty isapplied toyour finalmark.Forexample, if yousubmityour labwork2dayslateandyourscoreonthelabis8,thenyourfinalmarkwillbe8-3.2(40%penalty)=4.8.

SubmissionInstructions:SubmitaPDFdocument lab4.pdfwithanswers toallquestions forallexercises. Includeall supportingdocumentssuchasgraphs.Createatararchiveofallfilescalledlab4.tar.Submitthearchiveusinggive.Clickonthesubmissionlinkatthetopofthepage.Maxfilesizeforsubmissionis3MB.

OriginalWorkOnly:You are strongly encouraged to discuss the questionswith other students in your lab.However, eachstudentmustsubmithisorherownwork.Youmayrefertothereferencematerialandalsoconductyourownresearchtoanswerthequestions.

NOTE:PLEASEREMEMBERTOMOUNTYOURCSEHOMEDIRECTORY INTHEVMANDTOSAVEYOURWORKINYOURHOMEDIRECTORYBEFOREQUITING.

Notation: Intheexamplesbelow,wehaveusedthe$signtorepresentLinuxcommandsthatshouldbe typed at the shell prompt, mininet> to show Mininet commands that should be typed atMininet’sCLI(commandlineinterface),and#toshowLinuxcommandsthataretypedatarootshellprompt. The actual prompt may look quite different on your computer (e.g. it may contain thecomputer'shostname,oryourusername,orthecurrentdirectoryname).Thecommandsthatyouaresupposedtotypeareinthisboldfont.

2

Several studentshave reported that themn tooldoesnothaveaccess to themounted folder.Notethat,sincemnrunwithsudo,thesshfscommandthatyouusetomountyourhomedirectoryshouldalsoberunwithsudo.Toavoidtypingsudowitheachcommand,werecommendthatyourunsudo–simmediatelyafter logging in to theVM.Youwill then remain in superusermode for the restof thesessionandwillnolongerneedtotypesudobeforemnorothercommands.

Exercise1:ParkingLotIn thisexercise,youwillbuildacustomtopologyand learnaboutTCPcongestioncontrol. InparticularyouwilllearnabouttheTCPsawtoothbehaviour(i.e.AIMD)andseehowTCPworkstosharebandwidthacrossmultipleflows1.

TCP’s congestion control helps prevent congestion collapse in networks. Congestion collapse occurswhen packets use a large amount of bandwidth in one section of the network but are dropped at adownstream link. Thismeans thenetwork is congested at thedownstream link and the sendersmustreduce their sending rate for packets to not be dropped. TCP’s congestion control responds to thesepacketdropsandenablesacongestedsectionofthenetworktorecover.YoumayrefertotheWeek6lecturenotesand/orthetextbook(Section3.6)forfurtherelaboration.

To explore congestion control, you will create the topology shown in Figure 1 which consists of Nswitchesandhostsfordifferentvaluesof𝑁(𝑁 = 1, 2, 3, 4, 5)andasinglereceivernode.Allhostswilltransmitdatatothesinglereceiver.Thebandwidthofalllinksis10Mbpsandtheone-waydelayis1ms.Once the topology is established, an iperf server is set up on the receiver and iperf clients areinstantiatedoneachhost.TheiperfclientsgeneratesimultaneousTCPRenoflowsusingiperf,fromeachof thehosts (senders) to the lonereceiver,andrecordtheachievedthroughput.Aprovidedscriptwillplotthetimeseriesofthroughputvs.timeforeachsender,foreachexperiment(N = 1, 2, 3, 4, 5).

Figure1Parkinglottopology.

Followthefollowingstepsforrunningthisexercise:

1. Logintoyourmountedhomedirectoryandmakeanewfoldernamedlab4exercise1andchangetothedirectory.Thendownloadtheexercisecodeandopenthearchivebytyping:

1ThisexerciseisbasedonAssignment4inCS6250,GeorgiaTechSpring2014.

# wget http://www.cse.unsw.edu.au/~cs3331/16s1/Labs/lab4exercise1.tgz # tar -xvf lab4exercise1.tgz

3

2. Changethedirectorytolab4exercise1.Nowopentheparkinglot.pyfileinaneditor.Thecodeiscompleteand ready to runbutyouare stronglyurged to readandunderstand it. Inparticularpay close attention to the ParkingLotTopo class, which creates the topology and therun_parkinglot_expt function, which generates long-lived TCP flows between the senders andthereceiverusing iperfandmonitors the throughputofeach flow.Remember thatall senderstransmit to thesingle receivernode.Moreover,eachsender is continuously transmittingdata,e.g.avideostreamingsession.

3. Youcantestthatthecodeworkscorrectlybytyping:

Forthe<link_bandwidth>usethevalue10(i.e.10Mbps)andtrydifferentvaluesof<n>(1,2,3,..).Theothercommandlineargumentsareoptional.Youcanusethedefaultvaluesspecifiedintheprogram(e.g.60secondsfortheexperimentduration).Theprogramwillgenerateanumberoflogfiles(bwm.txt,iperf_server.txt,tcp_probe.txt,iperf_h1.txt)inadirectorycalledresults.

NOTE:Ifyouencounterthefollowingerror:

thenitmeanstermcolorisnotinstalled.Typethefollowingtoinstall:

Ifyouencounterthefollowingerror:

thenitmeansbwm-ngisnotinstalled.Typethefollowingtoinstall:

4. Whenyouareconfidentthateverythingisfunctioningcorrectly,runparkinglot-sweep.sh:

This script will repeat the parking lot experiment for different values of N from 1 to 5. Eachexperimentwillrunfor30seconds.Youwillneedtowaitforsometimeforittocomplete.Itwillalsogenerateanumberoflogfilesandplots.Thesefileswillbegeneratedinadirectorycalledparkinglot-Date/Time (e.g. parkinglot-Apr25-16:44). Note that on some installations thedate/timemaybeinUSPDTtimeformat.

5. YoucanviewthelogfilesandplotsbyrunningthedefaultPythonwebserveronyourmachineand navigating to http://MininetVMIP:8000/ using a browser, where MininetVMIP is the IPaddressoftheMininetVM(e.g.192.168.56.101).Typethefollowingcommandtoruntheserver:

# sudo python parkinglot.py --bw <link_bandwidth> -n <n>

ImportError: no module named termcolor

# sudo apt-get install python-pip # sudo pip install termcolor

Exception: Could not find bwm-ng – make sure that it is installed and in your $PATH

# sudo apt-get install bwm-ng

# sudo ./parkinglot-sweep.sh

# python -m SimpleHTTPServer

4

Youwill findanumberof sub-directorieswithin theparkinglot-Date/Timedirectorynamedn1,n2…n5.Youshouldexaminethecwnd.pnggraph,whichplotsthecongestionwindowevolutionfor each individual flow (in different colours) and also the cumulativewindow evolution. Youshouldalsoexaminetherate.pngplot,whichshowsthebandwidthattheswitch-hostinterface(e.g.s1-eth2)foreachswitchinthetopology.Youdonothavetorelyonthewebservertoviewtheplots.Youcannavigatethesub-directorystructurewiththeparkinglot-Date/Timedirectoryandviewthe*.pngfiles(e.g.usinggimpwhichyoucaninstallbytypingsudoapt-getinstallgimp).

Question1:Completetheabovestepsforthisexercise,submityourcwnd.pngandrate.pngplotfiles,foreachofN=1,2,3,4,and5(youcouldrenamethesefilesascwnd_n1.png,rate_n1.png,cwnd_n2.png,etc).

Question2:Examinethecwndplotfor𝑁 = 1.Whyisthe"additiveincrease"partofthesawtoothlinecurvedandnotstraight?

Question3:Now,examinethecwndplotsforothervaluesofN.AsNincreases,shouldthecumulativecwndsawtoothshowhigherorlowervariance?Why?

Question4:Inyouropinion,whatshouldeachhost’sbandwidthsharebe?Inyourrateplots(rate.png)forvariousvaluesofN,whatbandwidthsharedoeseachhostget? IfallhostsusedUDPinstead,whatsharewouldeachhostget?

Question5: If oneof thehosts startedmore thanoneTCP flow (simultaneously) to the receiver,howwoulditaffectotherflows?WhatifthathostusedUDPinsteadofmultipleTCPflows(andtheremaininghostscontinuewithoneTCPflow)?

Onceyouaredone,closethewebsever(CTRL-C)andcleanupmininet.

RemembertosaveyourworkinyourCSEhomedirectorybeforemovingforward.

Exercise2:BufferBloatIn thisexercisewewill study thedynamicsofTCP ina typicalhomenetwork.Figure2showsa typicalhomenetworkwithaHomeRouterconnectedtoanendhost.TheHomeRouterisconnectedviaCableorDSLtoahead-endrouterattheInternetserviceprovider’soffice.Wewillstudywhathappenswhenwedownloaddatafromaremoteservertotheendhostinthishomenetwork2.

Figure2Ahomenetworktopology.

2ThisexerciseisbasedonAssignment5inCS6250,GeorgiaTechSpring2014.

5

Inarealnetworkitishardtomeasurecwnd(becauseit’sprivatetotheserver)andthebufferoccupancy(becauseit’sprivatetotherouter).Tomakeourmeasurementtaskeasier,wewillemulatethenetworkinMininet.

Thegoalsoftheexerciseareto:

• Reviewthedynamicsofcwndandbufferoccupancyina“real”network.• Learnwhylargerouterbufferscanleadtopoorperformanceinhomenetworks.Thisproblemis

oftencalled“BufferBloat.”Readuponthishere:https://en.wikipedia.org/wiki/Bufferbloat.

Part1:Simulateashort-livedTCPconnection

ThetopologyforthisexerciseisshowninFigure3.

Figure3ThenetworktopologyforExercise2.

Logintoyourmountedhomedirectory.Thendownloadtheexercisecodearchiveandextractthefilesbytyping:

Allrequiredcodeforthisexerciseisprovidedforyou.However,youarestronglyencouragedtoreadandunderstandthecode(e.g.,bufferbloat.py).

Changethedirectorytolab4exercise2andruntheMininetemulator:

AfterMininetCLIisrunning,youcanmeasuretheRTTfromh1toh2withthecommand:

Question 6: What is the average RTT? Next, measure how long it takes to download a web page(index.html)fromh1.Usethefollowingcommandandreportthetime.AswillbeobviousfromtheresulttheunderlyingTCPconnectionoverwhichthewebpageisdownloadedisofafairlyshortduration.

# wget http://www.cse.unsw.edu.au/~cs3331/16s1/Labs/lab4exercise2.tgz # tar -xvf lab4exercise2.tgz

# cd lab4exercise2/# sudo ./run.sh

mininet> h1 ping -c 10 h2

6

Onapieceofpaper,sketchhowyouthinkcwndevolvesovertimeath1(recallthath1istheserverthatisservingthewebpage) for thisTCPconnection(i.e. for transmittingthewebpage).MarkmultiplesofRTT(youmeasuredtheRTTabove)onthex-axis.Don'tworryifyouareunsureofthebehavior,wewillbegraphingtheactualcwnd,somakeyourbestguess.

Part2:Interactionbetweenalong-livedandshort-livedTCPconnection

Wewillnowstudyhowthedynamicsofa long-lived flow (whichenters thecongestionavoidance, i.e.AIMDphase)differfromashort-livedflow(whichneverleavesslow-start).Fortheshortflowwewillusethewebdownloadas in Part 1.A real-world exampleof a long-lived flow couldbe a streaming videosession,wherein;a largevideofile isbeingstreamedfromh1toh2.Onecangeneratelong-livedflowsusingtheiperfcommand.Wehavecompiledtheseoperationsinascript,whichyoucanrunasfollows:

Theiperfflowwillkeeprunningforever,i.e.,untilyouexit.Youcanexaminethethroughputofthislong-livedTCPflowfromh1toh2byrunning:

YoucanquitviewingthroughputbypressingCTRL-C.Beforeweobservetheeffectofthelong-livedflowon the short-lived flow, sketch how you think cwnd evolves over time at h1 for the long-lived flow.Remember the long-lived flow has entered the AIMD phase unlike the slow start phase of the webrequest.Youmightfinditusefultousepingtomeasurehowthedelayevolvesovertime,nowthattheiperfflowisrunning:

mininet> h2 wget http://10.0.0.1

mininet> h1 ./iperf.sh

mininet> h2 tail -f ./iperf-recv.txt

mininet> h1 ping -c 100 h2

7

Question7:ReporttheRTTstatistics.CanyouexplainwhytheRTTmeasurementisdifferentfromyouranswertoQuestion6?

Nowtoseehowourlong-livediperfflowaffectsourwebpagedownload,downloadthewebpageagainwhileiperfisrunninginparallel.

Question8:Reporthow long it takes todownloadthewebpage fromh1usingabovecommand.Whydoesthewebpagetakesomuchlongertodownload?

Part3:Measuringtherealcwndandbufferoccupancyvalues

Nextwewillexaminetheevolutionofthecwndandbufferoccupancyvaluesfortheaboveexperiment(whichwillberunagain).Wehaveprovidedyouwithscriptstodoso.StopandrestartMininetandthenstarttheprovidedmonitorscript.Thenre-runtheaboveexperimentasfollows.

In another terminal, go to lab4exercise2 directory and type the following giving a name for yourexperiment.

Don’tworry ifyousee“ERROR:Moduletcp_probedoesnotexist in/proc/modules”, it justmeansthismoduleisnotpreviouslyloaded.Next,startthelong-livedflow(inthefirstterminalwhichwillhavethemininetCLIrunning):

Waitforapproximately70secondsandrunthefollowingcommandfortheshort-livedflow:

Wait for the wget to complete, and then stop the python monitor script (in the other terminal) byfollowingtheinstructionsattheprompt(i.e.PressEnterkeytostopthemonitor).Thecwndvaluesaresavedinexperiment1_tcpprobe.txtandthebufferoccupancyinexperiment1_sw0-qlen.txt.

PlottheTCPcwndandqueueoccupancyfromtheoutputfile,usingthefollowingcommand:

mininet> h2 wget http://10.0.0.1

mininet> exit# sudo ./run.sh

# ./monitor.sh experiment1

mininet> h1 ./iperf.sh

mininet> h2 wget http://10.0.0.1

8

The script hosts a web server on the machine and you can access it by navigating tohttp://MininetVMIP:8888usingabrowser,whereMininetVMIP is the IPaddressof theMininetVM. Ifyouareunabletoseethecwnd,ensureyouranwgetafteryoustartedthemonitor.shscript.

Youcanfindthepngfilesfortheplotinthelab4exercise2directory(typels*.png).

Note:IfyougetanerrorstatingthatthematplotlibmodulecannotbefoundtheninstallitinyourVMbytypingthefollowing:

Iferrorpersiststhentrythefollowingandthenreruntheaboveinstall:

Ifyouareregeneratingplots(i.e.youarerunningtheplotfigurescriptagain),youmayencounterafileaccesspermissionerror for thepng files. If so, then simplydeleteall existingpng files (rm*.png) andexecutetheplotfigurescriptagain.Thisshouldfixit.

Question9:Submittheplotsgeneratedinthisexperimentandbrieflyexplainyourobservationsforeachplot(inyourlabreport).

Atthispoint,youmayhaverealizedthatthebufferintherouterissolargethatwhenitfillsupwithiperfpackets,itdelaystheshortwgetflow.Nextwe’lllookattwowaystoovercomethisproblem.

ExitfromthemonitorscriptbytypingCTRL-C.Alsoexitfrommininet.

Part4:Approach1-Maketherouterbuffersmaller

The firstmethod to speed up the short-lived flow in the presence of the long-lived one follows fromrealizingthatthebufferistoolarge:maketherouterbuffersmallerandreduceitfrom100packetsto20packets.Todothis,stopanyrunningMininetinstancesandstartMininetagain.Nowrunfollowingscriptwhichcreates thesametopologyasbeforebut this timeconfiguresa20-packetbuffer (cf.100-packetbufferinpreviousexperiment)intherouter:

First repeatthesteps inPart2.MeasuretheRTTwithoutanytraffic in thenetwork.Alsomeasurethetimefordownloadingthewebpage.

# sudo ./plot_figures.sh experiment1

# sudo apt-get install python-matplotlib

# sudo apt-get build-dep python-matplotlib

# sudo ./run-minq.sh

9

Next,initiatethelong-livedflow:

MeasuretheRTTandthendownloadthewebpageagain.

Question10.Recordtheobservationsfromtheabovestepsandexplainthedelayresults.ContrastwiththeresultsfromPart2.

NowrepeatthestepsinPart3.

StopandrestartMininet.

First,runthemonitorscriptinanotherterminal:

Next,startthelong-livedflow(inthefirstterminalwhichwillhavethemininetCLIrunning):

Waitforapproximately70secondsandrunthefollowingcommandfortheshort-livedflow:

Waitforthewgettocomplete,andthenstopthepythonmonitorscript.Thecwndvaluesaresavedinexperiment2_tcpprobe.txtandthebufferoccupancyinexperiment2_sw0-qlen.txt.

Sketchwhatyouthinkthecwnd(forbothflows)andqueueoccupancywillbelikeinthiscase.

mininet> h1 ping -c 10 h2 mininet> h2 wget http://10.0.0.1

mininet> h1 ./iperf.sh

mininet> h1 ping -c 100 h2 mininet> h2 wget http://10.0.0.1

mininet> exit# sudo ./run-minq.sh

# ./monitor.sh experiment2

mininet> h1 ./iperf.sh

mininet> h2 wget http://10.0.0.1

10

Nowconfirmyoursketchbyplottingthefiguresforcwndandqueueoccupancy:

NavigatetothewebserverasoutlinedinPart3toexaminetheplots.

Question11:Reportthetimeinsecondsrequiredforwgettodownloadthepage.Whydoesreducingthequeuesizereducethedownloadtimeforwget?

Question 12: Submit the plots generated in this experiment and briefly explain your observations foreachplot.Comparetheseplotswiththeplotsyouobtainedinthepreviousexperiment(Part3).

Part5:Approach2-UsingDifferentqueues

Thebufferbloatproblemseemstobecausedbythefactthatpacketsfromtheshort-livedflowarestuckbehindalotofpacketsfromthelong-livedflow.Whatifwemaintainaseparatequeueforeachflow,i.e.the iperf and wget traffic are directed into different queues? For this experiment, we configure theroutersuchthattheiperfandwget(alsoping)packetsarebufferedinseparatequeuesintherouter.Thescheduler implements fair queuing so that when both queues are busy, each flow will receiveapproximatelyhalfofthebottlenecklinkrate.

StartMininetagain,butthistimewewillcreatetwoqueues,oneforeachtypeoftraffic.

Then repeat all the steps for Part 2. Youdonot have to repeat the steps in Part 3 (i.e. generationofgraphs)

# sudo ./plot_figures_minq.sh experiment2

# sudo ./run-diff.sh

11

FirstmeasuretheRTTwhenthereisnotraffic.Andalsomeasurethedelaytodownloadthewebpage:

Next,initiatethelong-livedflow:

MeasuretheRTTandthendownloadthewebpageagain.

Question13.Recordtheobservationsfromtheabovestepsandexplainthedelayresults.Contrastwiththeresultswiththepreviousexperiments.Explainyourobservations.

RemembertosaveyourworkinyourCSEhomedirectory.

UsefulResourcesThe underlyingmechanism for thesemultiple queues is traffic control in Linux. You'll seemultiple tccommands in tc_cmd_diff.sh which sets up a filtering mechanism for the iperf traffic. For moreinformationontctakealookatthemanpageandexaminefollowinglinks:

• tc-Linuxmanpage:http://linux.die.net/man/8/tc• http://linux-ip.net/articles/Traffic-Control-HOWTO/

mininet> h1 ping -c 10 h2 mininet> h2 wget http://10.0.0.1

mininet> h1 ./iperf.sh

mininet> h1 ping -c 100 h2 mininet> h2 wget http://10.0.0.1

top related