QoS onRouterOS withTokenBucket
RouterOS v6.35
ValensRiyadi(Citraweb)@valensriyadi
MUM-KH-2017PhnomPenh
ValensRiyadi• MikroTik CertifiedEngineer
(MTCNA,MTCWE,MTCRE,MTCTCE,MTCUME,MTCINE)
• MikroTik CertifiedTrainersince2004,CertifiedConsultant,andAcademyCoordinator
• CEOforCitranet (WISP)andCitraweb (Mikrotik DistributorandSystemDeveloper)
• ManagerforIDNIC(IndonesiaNationalInternetRegistry)2009-2015
• ExpertonCyberCrime,DigitalForensic,ITforDisasterRelief,LiveStreaming
• Proudmemberof“RoutedWorld”community
2QoS onMulticore – Mikrotik Indonesia
MikroTik TrainingCenter• ThefirstMikroTik TrainingCenterinAsiaPasific since2004,morethen5500participants(237classes).
• Mikrotik AcademyCoordinator.
QospadaRouterOSv6 4
QoS onRouterOS
• MikroTik RouterOS isoneofthemostadvancedbandwidthmanagement,comparedtoanyotherbrand.
• Why?– AdvancedHTBconfiguration– Doublelimitation+Burst– Alotofoptionandparameterà packet-mark• Grouping,protocol,layer7,connectionsize,trafficdetection,etc
Token Bucket– Mikrotik Indonesia 7
Burst
Amechanismtobeabletoprovideadditionalbandwidthtoaparticularclientif:• Clientnotalwaysonmax-limit• Additionalbandwidthstillavailableonrelatedparentandinterface
Token Bucket– Mikrotik Indonesia 8
Happycustomer
TokenBucket– MikrotikIndonesia 9
Burstwillsignificantlyimprovecustomerexperience
astheyfeeltheconnectionisfast
TokenBucket
• SinceRouterOS v6.35,MikroTik introduceTokenBucket.
• It’sbeenontheRouterOS engineforlongtime,butit’shiddenandstaticallysetto0.1.
• ConceptofTokenBucketalsoimplementedonLinux.
• Itworkslikeburstfeature,butmuchsimpler.
TokenBucket– MikrotikIndonesia 10
TokenBucketAlgoritm
TokenBucket– MikrotikIndonesia 12http://wiki.mikrotik.com/wiki/Manual:HTB-Token_Bucket_Algorithm
Bucket
• Bucketcapacity isbucketsizeratio comparedtomax-limit.
• Example:–Max-limit=5Mbps– Bucketsizeration=3(max10)– Bucketcapacity=5*3=15Mbit
• Whenthecalculationstart,bucketisalwaysconsideredfulloftoken.
TokenBucket– MikrotikIndonesia 13
Tokenrate
TokenBucket– MikrotikIndonesia 14
token-rate=max-limit
iflimit-atonchild>max-limitonparent
token-rate=limit-at
ifburstisactiveandallowed
token-rate=burst-limit
TokenBucketAlgoritmIftraffic=token-rate AlltrafficwillbedeliveredIftraffic<token-rate Alltrafficwillbedelivered,and
tokenwillbeaddedtothebucket,asmuchasthedifferences
Iftraffic>token-rate Trafficwillbedelivered,andtokenwillbetakenfromthebucket,asmuchasthedifferences.Iftokenisnotenough/bucketisempty,trafficwillbedeliveredastoken-rate.
TokenBucket– MikrotikIndonesia 15
TokenBucketExample
• Max-limit=20M,Bucket-size=10àBucket-capacity=20*10=200Mbit
• Routerwilldeliveredadditional(aftertoken-rate)200Mbittrafficwithoutanylimitation.
• 30Mbpswillbedeliveredin…….seconds:
200/(30– 20)=200/10=20secondsTokenBucket– MikrotikIndonesia 16
BucketCapacity /(- )Actual
SpeedTokenRate
40Mbpswillbedeliveredin…….seconds:Second(s) Traffic TokenDeducted/
SpeedExceedTokenleftat
bucketSpeed
Delivered
0 0 200Mbit
1 40Mbps 20Mbit 180Mbit 40Mbps
2 40Mbps 20Mbit 160Mbit 40Mbps
3 40Mbps 20Mbit 140Mbit 40Mbps
4 40Mbps 20Mbit 120Mbit 40Mbps
5 40Mbps 20Mbit 100Mbit 40Mbps
6 40Mbps 20Mbit 80Mbit 40Mbps
7 40Mbps 20Mbit 60Mbit 40Mbps
8 40Mbps 20Mbit 40Mbit 40Mbps
9 40Mbps 20Mbit 20Mbit 40Mbps
10 40Mbps 20Mbit 0 40Mbps
11 40Mbps 0 0 20MbpsTokenBucket– MikrotikIndonesia 17
TokenBucketExample
• Afterthebucketempty,trafficwillbelimitedtotoken-rate(20M)
• Andifclientutilizelowerthentoken-rate,forexampleonly15Mbps,bucketwillbefulloftokensafter…..seconds:
200/(20– 15)=200/5=40secondsTokenBucket– MikrotikIndonesia 18
BucketCapacity /(- )Token
RateActualSpeed
Howaboutburst?
• Inburstcalculation,routerhavetorememberspeedperqueueinthelast(burst-time)seconds.
• Intoken-bucket,onlytoken-rateandnumberoftokensinbucketwillbeconsidered.
• Inhighloadapplication,tokenbucketmightbemoreefficent thenburst.Really?
TokenBucket– MikrotikIndonesia 19
Comparation
• Istokenbucketreallymoreefficientthenburstsystem?
• It’sreallydifficulttotest:– CPUloadisnotonlyrelatedwithqueueconfiguration,butthesizeoftrafficdeliveredbyrouter
– Queueisveryefficient.500+simplequeuewith500mbpsonlymake1%CPUload.
TokenBucket– MikrotikIndonesia 20
Conclusions
• TokenBucketisalternativestoburstsystem• Differenceofefficiencybetweenbothsystemisstillverysmall.
Token Bucket– Mikrotik Indonesia 33
ThankyouCommentsandsuggestions:
Token Bucket– Mikrotik Indonesia 34
Thislicenseletsothersremix,tweak,andbuilduponyourworkevenforcommercialpurposes,aslongastheycredityouandlicensetheirnewcreationsundertheidenticalterms.Thislicenseisoftencomparedto“copyleft”freeandopensourcesoftwarelicenses.Allnewworksbasedonyourswillcarrythesamelicense,soanyderivativeswillalsoallowcommercialuse.
Top Related