Quantum & r2q

Let's assume we have 2 classes with the same parent :

Parent : ceil = rate = 100
class 1 : rate = 40 and ceil = 100
class 2 : rate = 20 and ceil = 100

(the used numbers are just theoretical to explain how it works)

Both classes are sending as much as they can. First, they are allowed to send enough packets to fulfill the rate even if they have different prio's. 
But the parent has some remaining bandwidth : 100 - 40 - 20 = 40. The remaining bandwidth is distributed according to the quantums. Each class can send "quantum" bytes at a turn.

Quantum is calculated as rate (in bytes) / r2q. r2q is by default 10 and can be overruled if you create an htb qdisc. Quantum can be overruled if you create an htb class. Quantum should be bigger then MTU (1500) so you can send the maximum packet in 1 turn and smaller then 60000 (hard coded in htb qdisc to prevent class starvation and too long delays). 
Errors on the quantum will not affect functionality, only precision. They are also logged via syslog so they can eat a lot of file space.

Packets that are sent when the class is allowed to send, are still matched against rate/ceil/burst/cburst. So a big quantum will not create bursts if you don't allow it with the burs/cburst parameters.

Counting packets with quantum can be strange. If we have a low rate class (rate = 5kbit), default quantum = 5000 / 10 = 500 bytes. But most packets are more then 500 bytes. Htb version 1 and 2 uses DRR, so a packet larger then 1000 bytes will be sent and it will remember how much it sent and wait until the packet is paid back before another packet is send. So if you send 1000 byte, next time the class is polled, you will not be allowed to send. 
Htb3 uses the WRR scheduler. When a packet with size > quantum is sent, it will be sent and an error that the quantum is too small will be logged. But there is no pay back. The WRR scheduler is faster then the DRR scheduler. So make sure quantum is bigger then the default packet size. For 15 kbyte/s and default r2q, quantum is 1500 and this is exactly the maximum packet size. If you want to tune htb for rates smaller then 15 kbyte/s, you can manually set the r2q and/or quantum.

An example 
The parent rate is 30 and it has 3 child classes c1, c2 and c3. The rate of the 3 classes is 10. Quantum of class2 = 1 and quantum of class3 = 2. Class 1 sends 4, so it gets 4. C2 and c3 are sending as much as they can so c2 and c3 get 10 (the rate is always satisfied). The parent still has 6 to distribute between c2 and c3. It will distributed according the quantums, so c2 gets 2 and c3 gets 4.

class rate traffic quantum bandwidth
c1 10 4 ? 4
c2 10 +++ 1 10+2=12
c3 10 +++ 2 10+4=14

Quantum & r2q的更多相关文章

  1. 【转载】linux下使用 TC 对服务器进行流量控制

    tc 介绍 在linux中,tc 有二种控制方法 CBQ 和 HTB.HTB 是设计用来替换 CBQ 的.HTB比CBQ更加灵活,但是CPU 开销也更大,通常高速的链路会使用CBQ,一般而言HTB使用 ...

  2. linux下使用 TC 对服务器进行流量控制

    tc 介绍 在linux中,tc 有二种控制方法 CBQ 和 HTB.HTB 是设计用来替换 CBQ 的.HTB比CBQ更加灵活,但是CPU 开销也更大,通常高速的链路会使用CBQ,一般而言HTB使用 ...

  3. TC HTB r2q

    HTB: quantum of class 10001 is big. Consider r2q change. 根据HTB的官方文档显示,quantum是在可以“借”的情况下,一次可以“借”多少,并 ...

  4. quantum sets

    the principles of quantum mechanics by p.a.m.dirac.

  5. Quantum Bogo sort浅谈

    1.普通的猴子排序(bogo sort) 猴子排序百科 en.wikipedia.org/wiki/Bogosort 不停的随机打乱序列,然后检查,直到排好序 复杂度O(n*n!) while not ...

  6. Openstack Quantum project 更名为 Neuron

    因为与磁带备份厂商Quantum商标冲突: The OpenStack Foundation has changed the name of its networking project from Q ...

  7. resmgr:cpu quantum 等待事件 top 1

    早上看昨天现场的报告,发现晚上七八点,resmgr:cpu quantum 等待事件排在i第一位,如下: 该事件是和资源管理相关的,如果启用资源管理计划,就可能遇到这个问题. 所以常规的解决方案是禁用 ...

  8. quantum theory

    the principles of quantum mechanics by p.a.m.dirac.

  9. 预见未来丨机器学习:未来十年研究热点 量子机器学习(Quantum ML) 量子计算机利用量子相干和量子纠缠等效应来处理信息

    微软研究院AI头条 https://mp.weixin.qq.com/s/SAz5eiSOLhsdz7nlSJ1xdA 预见未来丨机器学习:未来十年研究热点 机器学习组 微软研究院AI头条 昨天 编者 ...

随机推荐

  1. 简单分析Java的HashMap.entrySet()的实现

    关于Java的HashMap.entrySet(),文档是这样描述的:这个方法返回一个Set,这个Set是HashMap的视图,对Map的操作会在Set上反映出来,反过来也是.原文是 Returns ...

  2. Qt 制作安装包

    Qt 制作在线.离线 安装包 见如下文档

  3. 【vmware vcp 5.1】安装及配置及笔记散记

    ESXi的几个命令技巧: ------------------------------------------------- alt-f1: 进入console alt-f2: 返回DCUI alt- ...

  4. 用PDB库调试Python程序

    Python自带的pdb库,发现用pdb来调试程序还是很方便的,当然了,什么远程调试,多线程之类,pdb是搞不定的. 用pdb调试有多种方式可选: 1. 命令行启动目标程序,加上-m参数,这样调用my ...

  5. $geoNear

    怎么使用mongoose的geoNear 2014-11-26 15:05:20|  分类: mongodb |  标签:mongoose  |举报|字号 订阅     下载LOFTER我的照片书   ...

  6. UITextView添加一个placeholder功能

    控件UITextField有个placeholder属性,UITextField和UITextView使用方法基本类似,有两个小区别:1.UITextField单行输入,而UITextView可以多行 ...

  7. jsp福利哟

    Servlet与JSP九大内置对象的关系 JSP对象 怎样获得 out->response.getWriter request ->Service方法中的req参数 response -& ...

  8. VMware-workstation-full-10.0.1-1379776 CN

    从V10版本开始,VMware Workstation 官方自带简体中文了,以后大家不需要汉化啦! 今天,VMware Workstation 10.0.1正式发布,版本号为Build 1379776 ...

  9. 发布Restful服务时出现IIS 指定了身份验证方案错误时的解决方案(IIS specified authentication schemes)

    发布RESTful服务,当访问.svc文件时出现如下错误时: IIS 指定了身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持一种身份验 ...

  10. goldengate 12c对oracle DB的改进

    1. 现在可使用Oracle Universal Installer,即安装时有图形化界面,同时会自动安装java runtime environment,不过个人认为,还是ZIP安装包方便,解压即用 ...