Article View: org.kernel.vger.lartc
Article #1htb use pfifo as leaf qdisc has a burst speed which is double of limit rate
From: 袁建鹏
Date: Wed, 05 Jun 2024 07:17
Date: Wed, 05 Jun 2024 07:17
41 lines
5815 bytes
5815 bytes
Hi, lartc gurus
I have a home router, and want to use HTB to limit the upload speed of a user.
I connect my phone to router via wifi, got an ip 192.168.10.28 via DHCP
I limit the upload speed to 500KB/s, here is my config
# tc qdisc show dev eth0.4
qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 18 direct_qlen 1000
qdisc pfifo 11d: parent 1:1d limit 1000p
# tc class show dev eth0.4
class htb 1:1d root leaf 11d: prio rate 4Mbit ceil 4Mbit burst 4800b cburst 4800b
# tc filter show dev eth0.4
filter parent 1: protocol ip pref 1 flow
filter parent 1: protocol ip pref 1 flow handle 0x1 map keys nfct-src and 0x000000ff baseclass 1:1
I test upload speed of phone using app, e.g. speedtest5g, or other similar app, the result double the limit.
if I change the leaf qdisc to fq_codel, then the limit is quite accurate.
# tc qdisc del dev eth0.4 handle 11d: parent 1:1d pfifo
# tc qdisc add dev eth0.4 handle 11d: parent 1:1d fq_codel
after read lots of documents and source code, I guess the reason:
qdisc has no traffic shaping when enqueue. so when the queue is empty,
packets can enqueue without limit, so there's a burst speed, while speed test app often use the max speed as result.
if i change the leaf pfifo limit from 1000p to 200p, then the test result is more closing to rate limit, but still bigger than it.
But why fq_codel is accurate?
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#
Technical Details
Message-ID:
<0f9c98123fa14979bdc4b6ba7abe37cc@xiaomi.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nntp.lore.kernel.org!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <0f9c98123fa14979bdc4b6ba7abe37cc@xiaomi.com> Subject: htb use pfifo as leaf qdisc has a burst speed which is double of limit rate Date: Wed, 5 Jun 2024 07:17:09 +0000 From: 袁建鹏 <yuanjianpeng@xiaomi.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nntp.lore.kernel.org!not-for-mail Received: from outboundhk.mxmail.xiaomi.com (outboundhk.mxmail.xiaomi.com [118.143.206.90]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF42D18F2CF Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=118.143.206.90 ARC-Seal: ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571906; cv=none; b=kSDnEBH0T88tZB9JiFX5ExHuA5uhAnzDNdu6KMMkzes+sQaKiGPSAYAxYwrSCTbh5hlqlimfDLRUIM1EnfN0SIkIkfqStYY6j5bZX513bX2HPITtl46snUNbR69n6Ohkc8TP/Gvp8/nbznAwcqpOxdDMw5YI98OxIc2RwE51qhw= ARC-Message-Signature: ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717571906; c=relaxed/simple; bh=tWZPw3/8NWeqCa+zBTrFMRpWJEkIHRV3HRBbukD6foA=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=rZJBvRLH90fs5rIxnDGU5qrsxYomVsddb/aqT3sA2NkPmRU27moTeIBXgwIg4rF/J7utuS0hCdMp0z5wsB5wsIK/LKubVjQcGKpjnmsKC2XgV5V1NakVKQC9wbZ+HWyjmTA513M980j1lZbtbiUXWFN2Krev26CZofTGQ7n4xLE= ARC-Authentication-Results: ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=xiaomi.com; spf=pass smtp.mailfrom=xiaomi.com; arc=none smtp.client-ip=118.143.206.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=xiaomi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xiaomi.com X-CSE-ConnectionGUID: 9gYbxq97SL6Vo99wSc+jdQ== X-CSE-MsgGUID: uCWqunzBTVOeuLsgZtH/7Q== X-IronPort-AV: E=Sophos;i="6.08,215,1712592000"; d="scan'208";a="87348178" To: lartc <lartc@vger.kernel.org> Thread-Topic: htb use pfifo as leaf qdisc has a burst speed which is double of limit rate Thread-Index: AQHatxgCk325KCmM3Uy0b6/bdmH8kA== Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-Has-Attach: X-MS-TNEF-Correlator: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Precedence: bulk X-Mailing-List: lartc@vger.kernel.org List-Id: <lartc.vger.kernel.org> List-Subscribe: <mailto:lartc+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:lartc+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Newsgroups: org.kernel.vger.lartc