From: Jonathan Morton <chromatix99@gmail.com>
To: Sebastian Moeller <moeller0@gmx.de>
Cc: David Lang <david@lang.hm>, cake@lists.bufferbloat.net
Subject: [Cake] Re: help request for cake on a large network
Date: Tue, 30 Sep 2025 21:45:13 +0300 [thread overview]
Message-ID: <D1F64A64-276E-4BB6-B67E-067EC1CF8C4C@gmail.com> (raw)
In-Reply-To: <FA76869A-F4A3-4C70-8F15-57E4168DAC71@gmx.de>
> On 30 Sep, 2025, at 3:56 pm, Sebastian Moeller <moeller0@gmx.de> wrote:
>
>> what would need to be done to increase resources to allow for full isolation of more flows?
>
> I believe editing net/sched/sch_cake.c and increase the number of CAKE_QUEUES:
> #define CAKE_QUEUES (1024)
>
> to something larger...
>
> however I do not know what a realistic maximum is... and IIRC cake will search through this repeatedly
There's nothing that should repeatedly scan the entire list of queues, so there should only be a minor hit to performance from increasing the number of queues.
The set-associative hash searches only the set of 8 queues that the flow hashes to, and only when there's enough pressure to cause a hash collision, so this cost would be expected to go down if the number of queues is increased in anticipation of a heavy workload.
The list of active queues is scanned O(1) elements per delivered packet. This doesn't mean that each queue is visited only once per delivery cycle, nor that a complete scan of the list can never happen, but amortised over many packets, the scanning cost is independent of the number of active flows. (At least in theory. It's grown into rather complex logic that I plan to simplify in the next-gen qdisc. Running in "besteffort" mode already simplifies the control flow significantly.)
Queues that recently went inactive are kept in a separate list to "decay" their AQM state to quiescent. This is scanned at a rate of one element per delivered packet.
In the corner case of the configured memory limit being reached, Cake needs to find the longest queue(s) to drop from. This is done using a heap structure, *specifically* to avoid the possibility of a load-triggered DoS fault. A linear scan is done only to initialise the heap (when the need for overload dropping is first identified) which is a one-time operation. So even in this case, the cost per dropped packet is nearly independent - O(log N) - of the number of queues.
So the main limit on the practical number of queues is really the number of hash bits that are allocated to selecting a queue. Without specifically checking, I would be reasonably confident that you could run as many as 64K queues without difficulty. I would still test this in the lab before deploying to production.
- Jonathan Morton
prev parent reply other threads:[~2025-09-30 18:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-28 11:06 [Cake] " David Lang
2025-09-28 12:10 ` [Cake] " Sebastian Moeller
2025-09-28 12:17 ` David Lang
2025-09-30 9:04 ` Toke Høiland-Jørgensen
[not found] ` <837EA4ED-26D3-4D83-84D9-5C0C75CFB80D@gmx.de>
2025-09-30 9:23 ` Toke Høiland-Jørgensen
2025-09-30 12:44 ` David Lang
2025-09-28 12:12 ` Jaap de Vos
2025-09-28 12:38 ` David Lang
2025-09-28 12:56 ` Frantisek Borsik
2025-09-28 17:07 ` dave seddon
2025-09-28 17:26 ` David Lang
2025-09-30 5:18 ` Jonathan Morton
2025-09-30 6:09 ` Sebastian Moeller
2025-09-30 8:59 ` Jonathan Morton
2025-09-30 9:00 ` Sebastian Moeller
2025-09-30 12:55 ` David Lang
2025-09-30 3:55 ` Jonathan Morton
2025-09-30 4:30 ` dave seddon
2025-09-30 12:49 ` David Lang
2025-09-30 12:37 ` David Lang
2025-09-30 12:56 ` Sebastian Moeller
2025-09-30 13:19 ` David Lang
2025-09-30 18:00 ` Toke Høiland-Jørgensen
2025-09-30 18:45 ` Jonathan Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D1F64A64-276E-4BB6-B67E-067EC1CF8C4C@gmail.com \
--to=chromatix99@gmail.com \
--cc=cake@lists.bufferbloat.net \
--cc=david@lang.hm \
--cc=moeller0@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox