From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Akshat Kakkar <akshat.1984@gmail.com>
Cc: brouer@redhat.com, "Cong Wang" <xiyou.wangcong@gmail.com>,
NetFilter <netfilter-devel@vger.kernel.org>,
lartc <lartc@vger.kernel.org>, netdev <netdev@vger.kernel.org>,
"Eric Dumazet" <eric.dumazet@gmail.com>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Anton Danilov" <littlesmilingcloud@gmail.com>
Subject: Re: Unable to create htb tc classes more than 64K
Date: Mon, 26 Aug 2019 18:45:42 +0200 [thread overview]
Message-ID: <20190826184542.4d61b609@carbon> (raw)
In-Reply-To: <CAA5aLPjzX+9YFRGgCgceHjkU0=e6x8YMENfp_cC9fjfHYK3e+A@mail.gmail.com>
On Sun, 18 Aug 2019 00:34:33 +0530
Akshat Kakkar <akshat.1984@gmail.com> wrote:
> My goal is not just to make as many classes as possible, but also to
> use them to do rate limiting per ip per server. Say, I have a list of
> 10000 IPs and more than 100 servers. So simply if I want few IPs to
> get speed of says 1Mbps per server but others say speed of 2 Mbps per
> server. How can I achieve this without having 10000 x 100 classes.
> These numbers can be large than this and hence I am looking for a
> generic solution to this.
As Eric Dumazet also points out indirectly, you will be creating a huge
bottleneck for SMP/multi-core CPUs. As your HTB root qdisc is a
serialization point for all egress traffic, that all CPUs will need to
take a lock on.
It sounds like your use-case is not global rate limiting, but instead
the goal is to rate limit customers or services (to something
significantly lower than NIC link speed). To get scalability, in this
case, you can instead use the MQ qdisc (as Eric also points out).
I have an example script here[1], that shows how to setup MQ as root
qdisc and add HTB leafs based on how many TX-queue the interface have
via /sys/class/net/$DEV/queues/tx-*/
[1] https://github.com/xdp-project/xdp-cpumap-tc/blob/master/bin/tc_mq_htb_setup_example.sh
You are not done, yet. For solving the TX-queue locking congestion, the
traffic needs to be redirected to the appropriate/correct TX CPUs. This
can either be done with RSS (Receive Side Scaling) HW ethtool
adjustment (reduce hash to IPs L3 only), or RPS (Receive Packet
Steering), or with XDP cpumap redirect.
The XDP cpumap redirect feature is implemented with XDP+TC BPF code
here[2]. Notice, that XPS can screw with this so there is a XPS disable
script here[3].
[2] https://github.com/xdp-project/xdp-cpumap-tc
[3] https://github.com/xdp-project/xdp-cpumap-tc/blob/master/bin/xps_setup.sh
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
prev parent reply other threads:[~2019-08-26 16:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 12:48 Unable to create htb tc classes more than 64K Akshat Kakkar
2019-08-16 17:45 ` Cong Wang
2019-08-17 12:46 ` Akshat Kakkar
2019-08-17 18:24 ` Cong Wang
2019-08-17 19:04 ` Akshat Kakkar
2019-08-20 6:26 ` Akshat Kakkar
2019-08-21 22:06 ` Cong Wang
2019-08-22 5:59 ` Akshat Kakkar
2019-08-25 17:52 ` Cong Wang
2019-08-26 6:32 ` Eric Dumazet
2019-08-26 7:28 ` Toke Høiland-Jørgensen
2019-08-27 20:53 ` Dave Taht
2019-08-27 21:09 ` Eric Dumazet
2019-08-27 21:41 ` Dave Taht
2020-01-10 12:38 ` Akshat Kakkar
2019-08-26 16:45 ` Jesper Dangaard Brouer [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190826184542.4d61b609@carbon \
--to=brouer@redhat.com \
--cc=akshat.1984@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=lartc@vger.kernel.org \
--cc=littlesmilingcloud@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=toke@redhat.com \
--cc=xiyou.wangcong@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).