Home Database Mysql Tutorial Quantum & r2q

Quantum & r2q

Jun 07, 2016 pm 03:20 PM
amp let quantum

Let's assume we have 2 classes with the same parent : Parent : ceil = rate = 100class 1 : rate = 40 and ceil = 100class 2 : rate = 20 and ceil = 100 (the used numbers are just theoretical to explain how it works) Both classes are sending a

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
Copy after login
(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
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Let's talk about the differences between var, let and const (code example) Let's talk about the differences between var, let and const (code example) Jan 06, 2023 pm 04:25 PM

This article brings you relevant knowledge about JavaScript. It mainly introduces the differences between var, let and const, as well as the relationship between ECMAScript and JavaScript. Interested friends can take a look at it. I hope Helpful to everyone.

What coin is AMP? What coin is AMP? Feb 24, 2024 pm 09:16 PM

What is AMP Coin? The AMP token was created by the Synereo team in 2015 as the main trading currency of the Synereo platform. AMP token aims to provide users with a better digital economic experience through multiple functions and uses. Purpose of AMP Token The AMP Token has multiple roles and functions in the Synereo platform. First, as part of the platform’s cryptocurrency reward system, users are able to earn AMP rewards by sharing and promoting content, a mechanism that encourages users to participate more actively in the platform’s activities. AMP tokens can also be used to promote and distribute content on the Synereo platform. Users can increase the visibility of their content on the platform by using AMP tokens to attract more viewers to view and share

NIST finalizes three post-quantum cryptography standards to better protect the Internet, cryptocurrency, and communications NIST finalizes three post-quantum cryptography standards to better protect the Internet, cryptocurrency, and communications Aug 15, 2024 pm 03:50 PM

The US National Institute of Standards and Technology (NIST) has finalized three post-quantum cryptography standards after nearly a decade of work. This move is in preparation for the ability of emerging quantum computers to crack public-key cryptosy

The differences and characteristics of let, var and const: What do they mean? The differences and characteristics of let, var and const: What do they mean? Feb 23, 2024 pm 12:36 PM

The differences and characteristics of let, var and const: What do they mean? In JavaScript, let, var, and const are keywords used to declare variables. Each of them has different differences and characteristics. let: The let keyword was introduced in ES6, which allows us to declare a block-scoped variable. Block-level scope means that the variable is only visible in the block where it is declared and will not be promoted to the function scope. Example code: functionexampleFunctio

What does let var const mean? What does let var const mean? Nov 14, 2023 pm 03:00 PM

llet, var, and const represent block scope variables, function scope variables, and constants respectively. Detailed introduction: 1. let, used to declare a variable in a block scope. A variable declared using let cannot be accessed before it is declared. This is the so-called temporary dead zone; 2. var, used to declare the key to a variable. Word, the declared variable is in function scope or global scope and is not restricted by block-level scope; 3. const, used to declare a constant. Once assigned, the variable cannot be reassigned. The value is after declaration. Cannot be modified etc.

How to use let in es6 How to use let in es6 Jan 12, 2023 pm 07:10 PM

In es6, the let keyword is used to declare variables; however, the declared variables are only valid within the code block where the let command is located. Let does not cause "variable promotion", so variables must be used after they are declared, otherwise an error will be reported. As long as the let command exists in the block-level scope, the variables declared by it are "binding" to this area and are no longer affected by external influences.

Distinguish the different characteristics of var, let and const Distinguish the different characteristics of var, let and const Feb 19, 2024 pm 05:24 PM

To understand the different characteristics of var, let, and const, you need specific code examples. In JavaScript, there are many ways to declare variables, the most common of which include using the var, let, and const keywords. Although they are both used to declare variables, they have different characteristics regarding scope and mutability. The differences between them are explained below with specific code examples. var keyword Let’s first look at the usage of var keyword. It is the earliest introduced way to declare variables, with global scope and

Study the characteristics and uses of let, var and const Study the characteristics and uses of let, var and const Feb 26, 2024 am 08:51 AM

Understand the essence of let, var and const: To explore their respective meanings and practical applications, specific code examples are required. In JavaScript, we often encounter three keywords: let, var and const. They are both used to declare variables, but there are some important differences between them. This article will delve into the nature of these three keywords and illustrate their differences and usage in practical applications through specific code examples. Letlet is a block-level scope declaration of variables introduced in ES6.

See all articles