Tải bản đầy đủ - 0 (trang)
Chapter 6. Reducing Congestion and Driving Faster on the Local (Network) Roadway

Chapter 6. Reducing Congestion and Driving Faster on the Local (Network) Roadway

Tải bản đầy đủ - 0trang

AnothermoreobviouswaytomakeaLANsupportmoretraffic

istosendthetrafficmorequickly.Thischapterendswithsome

coverageoftheversionsofEthernetthatsimplyrunfasterthan

theoriginal10MbpsEthernetspecifications.







ReducingCongestionbyOpeningUpMore

LanesonEachLAN

Whenyou'reusingahub,onlyonedevicecantransmitdataat

anyonepointintime.Withaswitch,multipledevicescan

transmitatthesametime,increasingtheamountofdatathat

canbesentovertheLAN.Allyouhavetodoisreplacethe

antiquatedhubwithaLANswitch.

Whyisthistrue?Well,staytunedthat'swhatmostofthefirst

sectionofthischapterisabout!First,I'llexplainwhyhubsonly

allowonedevicetosendatapointintime;thenI'llexplainhow

aswitchovercomesthatproblem.



Hubs:AOne-LaneRoad

Toappreciatethepotentialtrafficcongestionproblemswhen

usinganEthernethub,youneedtoreviewacoupleofkey

facts.First,considerthelogicusedbyahub:

Hub:WhenIreceiveanelectricalsignal,Irepeatitoutall

ports,excepttheportinwhichthesignalwasreceived.

That'showahuboperates.NowaddtothatthelogicthatNICs

useinthePCsthatareattachedtothehub.ThosePCsuse

carriersensemultipleaccesscollisiondetect(CSMA/CD)logic,

thefirstpartofwhichisasfollows:

PC:Listenbeforesending.Ifyou'recurrentlyreceivinga

frame,waituntilitisfinishedbeforeyoutrytosendyour

frame.

Withthesetwofactscombined,anytimeadevicesendsa



frame,allotherdevicesreceivetheframe.Thatmeansthat

thoseotherdeviceschoosenottosendatthesametime.

Figure6-1illustratesthepoint.



Figure6-1.BettyWaitingonFred'sFrameThat

WasSenttoBarney



Asseeninthefigure,Fred'sframeispassingoverthecableto

thehub,andthehubrepeatstheframeoutallother

portsincludingtheoneconnectedtoBetty.DuetoCSMA/CD

logicwhichisusefullogicbecauseitpreventscollisionsBetty

mustwaiteventhoughshesimplywantstosendaframeto

Wilma.It'slikepavingabeautifulwideroadandonlyhaving

onelane,soeveryonemustwaituntilonecarfinishesdriving

pastbeforethenextcarcanusetheroad.



Switches:HowtoCreateDozensofLanesonthe

LAN

LANswitchesprovidethesamecablingadvantagethathubsdo,



whileprovidingsignificantperformanceimprovements.For

example,youcanrunasinglecablefromeachdevicetothe

wiringclosetandconnectthosecablestoaswitchinsteadofa

hub.Yougetmuchbettercablemanagement.

Toappreciatewhyswitchesperformbetterthanhubs,youneed

toconsiderthelogicthataswitchusesandcompareittothe

logicthatahubuses.AswitchallowseverydeviceontheLAN

tocommunicatewitheveryotherdevicethesameresultas

whenusingahubbutusingdifferentlogic,whichissummarized

asfollows:

Whenreceivingaframe,examinethedestinationEthernet

address.Forwardtheframeouttheoneportandonlythat

portthroughwhichthataddresscanbereached.

So,incomparisontoahub,aswitchdoesnotsimplyrepeatthe

electricalsignaloutallotherports.Instead,aswitchforwards

framesselectivelyonlyforwardingtheframewhereitreally

needstogo.Switchlogicactuallyexaminesthecontentsofthe

EthernetframeandfindsthedestinationEthernetMACaddress

tomakeanintelligentdecision.Figure6-2illustratesthelogic,

withFredsendingtoBarney.



Figure6-2.SwitchLogicforFred'sFrameSentto

Barney



Figure6-2showsthesamePCsandcablesaswereinFigure61,butFigure6-2showsaswitchinsteadofahub.Infact,in

reallife,youcandothatsamething:Simplyreplaceahubwith

aswitch,andusethesamecables.Theswitchstillusesa

twistedpairfortransmissionandanotherforreceivingtrafficin

eachcable.ItusesthesamepinoutsintheRJ-45connector.

Theswitchreceivesonpins1and2andtransmitsonpins3and

6,justlikeahubmeaningthatyouneedastraight-through

cablebetweentheswitchandeachcomputer.So,thephysical

detailscanremainthesame.

Thedifferencebetweenswitchesandhubsliesinhowthey

choosetoforwardtraffic.Tomakeaforwardingdecision,a

switchusesatablethatliststheMACaddressesinthenetwork.

AsshowninFigure6-2,thetabletellstheswitchwhere

Barney'sMACaddress,0200.2222.2222,sitsinthenetwork.

So,whentheswitchreceivesaframewhosedestinationis

0200.2222.2222,theswitchforwardstheframeoutportE1and

portE1only.Thistablecanbecalledmanythings;inthisbook,



I'llrefertoitaseithertheswitchingtableortheMAC

addresstable.

YoucanthinkoftheMACaddresstableasaroadsignandthe

switchasanintersection.Theswitchlooksattheroadsignand

comparesittothedestinationoftheframe(destinationMAC

address).Theroadsigngivesthedirectionswhichturn,or

switchport,totakesotheswitchcanforwardtheframe

appropriately.

LANswitchinglogicimprovesLANperformanceinpartbecause

theframeisnotrepeatedtoeverycomputerthatisattachedto

theswitch.NoticethatunlikeFigure6-1,BettyandWilmado

notreceivetheframeinFigure6-2.BettystillusesCSMA/CD

logic,whichbeginswiththe"Listenfirst,andwaitifyouare

currentlyreceivingaframe"logic.However,becauseBettyis

notreceivingaframe,ifshehadaframetosendtoWilma,she

couldindeedsend,asshowninFigure6-3.



Figure6-3.FredSendingtoBarney,WhileBetty

SendstoWilma



[Viewfullsizeimage]



ThisexampleshowstwodevicesFredandBettysendingaframe

atthesametime.Withahub,onlyonedevicecouldsendata

time.Withtwodevicessendingatthesametime,thecapacity

oftheLANtoforwardframesdoubles!

TheoriginalEthernetspecificationsdefinea10-Mbps

transmissionrate.InFigure6-3,twoseparatetransmissions

occur,eachat10Mbps.Inonewayofthinking,thisLANhas20

Mbpsofcapacitybecauseitallowstwoconcurrenttransmissions

at10Mbps.Nowimagineaswitchwith24ports,withthe

deviceonport1sendingtothedeviceonport2;thedeviceon

port3sendingtothedeviceonport4;andsoon.All12ofthe

odd-numberedportsaresendingframesinthiscase,sothis

switchsupports12x10Mbps,or120Mbps,ofcapacity.

Byusingaswitchinsteadofahub,multipledevicescansendat

thesametime,vastlyincreasingoveralltrafficcapacity.



ThePerfectRoadway:NoWrecksAllowed!

Inreallife,itwouldbegreatifsomehowyoucoulddriveyour

carasfastasyoulike,neverhavetostopattrafficlights,get

whereyouaregoingeasily,andneverhaveawreck.Italmost

soundslikesomethingoutofabadsciencefictionmovie,but

withswitches,theequivalentdoesoccuryoucancreateaworld

withoutcollisions.

Withtheswitchlogicyouhavelearnedaboutsofar,multiple

devicescansend,buttheexamplehadtheguys(Fredand

Barney)talkingandthegals(BettyandWilma)talking.Whatif

everyonewantedtotalk(send)toFredatthesametime?

Figure6-4showsthepotentialproblem.



Figure6-4.PotentialCollisionWhenForwarding

MultipleFramesontotheSamePair



Withwhatyou'velearnedaboutswitchessofar,theswitch

wouldtrytoforwardallthreeframes,whichwouldcausea

collision.However,toavoidsendingallthreeframesatthe

sametime,theswitchusesbuffers.Buffersconsistofmemory

insidetheswitchthatisusedtostoreframestemporarily.The

switchsendsoneframe,anditkeepstheothertwoframesin

buffers.Aftertheswitchfinishessendingthefirstframe,itgets

oneoftheframesfromthebuffersandsendsit.Finally,the

switchgrabsthethirdframefromthebufferandsendsit.By

doingso,theswitchusuallyavoidscausingacollision.Figure65illustratesthesamelogic.



Figure6-5.SwitchAvoidsCollisionsbyBuffering

theFrames



So,thelitanyofswitchlogicnowreadslikethis:

Whenreceivingaframe,examinethedestinationEthernet

address.Forwardtheframeouttheoneportandonlythat

portthroughwhichthataddresscanbereached.

Ifmultipleframesneedtobesentoutthesameport,send

oneframeandbuffertherest,sendingthemwhentheport

becomesavailable.

Bybufferingframes,switchesdonotcreatecollisions.The

originalframesmakeitacrosstheLANwithminimalbuffering

delay.Forinstance,ifthosethreeframeswereeach1250bytes

long,itwouldonlytake3milliseconds(.003seconds)forall

threetobesentoverthecablefromtheswitchtoFred.If

collisionshadoccurred,eachframewouldhavetakenlongerto

reachFred,andboththecollisionandthetimetakentoresend

theframescouldhavepreventedotherusertrafficfrom

crossingtheLAN.So,thebufferingofframesdefinitely

improvesLANperformance.



UsingFullDuplex:MakingtheStreetsTwoWay

Thenetworkinterfacecards(NICs)inthecomputersinthis

chapterstilluseCSMA/CDlogic.Inmostcases,becausethe

switchforwardsframesonlyouttherightdestinationport,most

ofthePCssimplyweren'treceivingframesthemajorityofthe

time.WithCSMA/CD,ifyouarenotreceivingaframe,it'sokay

foryoutogoaheadandsend.Theswitchavoidscollisionsby

bufferingtheframeiftheoutputportisbusy.

However,thereisstillonecaseforwhichacomputerNIC,using

CSMA/CD,believesitshouldnotsend.That'swhentheNICis

actuallyreceivingaframe.ImaginethatFredissendinganother

frametoBarney,asinFigure6-6.Barneywantstosenda

frame.(Inthiscase,BarneywantstosendaframetoFred,but

thedestinationdoesnotreallymatterinthisscenario.)



Figure6-6.BarneyWaitingtoSend,WhenFred

SendstoBarney



WithBarney'sCSMA/CDlogicenabled,hemustwaitbefore

sendingaframe.However,physically,thereisasinglecable

betweenBarneyandtheswitch.Nocollisionscanoccuronthat



cablebecauseBarneysendsonthepairusingpins1and2,and

theswitchsendstoBarneyonthepairusingpins3and6.And

youalreadyknowthattheswitchwillbufferanyframes,rather

thancauseacollision,sothereistrulynodangerofacollision.

Inthisparticularcase,Barneychoosesnottosendtheframeto

FredbecausehisCSMA/CDlogictellsBarneytowait.Butif

Barneysenttheframe,hewouldn'tcauseacollision.The

solution:Barney'sNICmustsuspenditsCSMA/CDlogic.By

disablingCSCMA/CDlogic,Barneycansendandreceiveatthe

sameinstantintimeasreceivingtheframefromFred.The

abilitytosendandreceiveatthesametimeiscalledfull

duplex.(TheCSMA/CDimposedrestrictionofonlysendingor

onlyreceivingatonepointintimeiscalledhalfduplex.)

Figure6-7showstheresultwithfullduplexenabledonboth

BarneyandFred.



Figure6-7.BarneyandFredSendingand

ReceivingattheSameTimeFullDuplex



Thissectionstartedbymakingananalogythatahubwaslikea

one-laneroad,andthatyouhadtowaituntiltheothercar

passedbeforeyoucouldusetheroad.Withswitchesandfull

duplexenabled,theLANworkslikeyouhaveatwo-laneroad

betweentheswitchandeachdevice,plusanothertwo-lane

roadbetweeneachportontheswitch.Theswitchplaystraffic



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 6. Reducing Congestion and Driving Faster on the Local (Network) Roadway

Tải bản đầy đủ ngay(0 tr)

×