From: Radu Rendec <radu.rendec@ines.ro>
To: Jarek Poplawski <jarkao2@gmail.com>
Cc: Jesper Dangaard Brouer <hawk@diku.dk>,
Denys Fedoryschenko <denys@visp.net.lb>,
netdev@vger.kernel.org
Subject: Re: htb parallelism on multi-core platforms
Date: Thu, 23 Apr 2009 16:56:42 +0300 [thread overview]
Message-ID: <1240495002.6554.155.camel@blade.ines.ro> (raw)
In-Reply-To: <20090423082052.GA4243@ff.dom.local>
On Thu, 2009-04-23 at 08:20 +0000, Jarek Poplawski wrote:
> Within a common tree of classes it would a need finer locking to
> separate some jobs but considering cache problems I doubt there would
> be much gain from such redesigning for smp. On the other hand, a
> common tree is necessary if these classes really have to share every
> byte, which I doubt. Then we could think of config and maybe tiny
> hardware "redesign" (to more qdiscs/roots). So, e.g. using additional
> (cheap) NICs and even switch, if possible, looks quite natural way of
> spanning. Similar thing (multiple htb qdiscs) should be possible in
> the future with one multiqueue NIC too.
Since htb has a tree structure by default, I think it's pretty difficult
to distribute shaping across different htb-enabled queues. Actually we
had thought of using completely separate machines, but soon we realized
there are some issues. Consider the following example:
Customer A and customer B share 2 Mbit of bandwith. Each of them is
guaranteed to reach 1 Mbit and in addition is able to "borrow" up to 1
Mbit from the other's bandwith (depending on the other's traffic).
This is done like this:
* bucket C -> rate 2 Mbit, ceil 2 Mbit
* bucket A -> rate 1 Mbit, ceil 2 Mbit, parent C
* bucket B -> rate 1 Mbit, ceil 2 Mbit, parent C
IP filters for customer A classify packets to bucket A, and similar for
customer B to bucket B.
It's obvious that buckets A, B and C must be in the same htb tree,
otherwise customers A and B would not be able to borrow from each
other's bandwidth. One simple rule would be to allocate all buckets
(with all their child buckets) that have rate = ceil to the same tree /
queue / whatever. I don't know if this is enough.
> There is also an interesting thread "Software receive packet steering"
> nearby, but using this for shaping only looks like "less simple":
> http://lwn.net/Articles/328339/
I am aware of the thread and even tried out the author's patch (despite
the fact that David Miller suggested it was not sane). Under heavy
(simulated) traffic nothing was changed: only one ksoftirqd using 100%
CPU, one CPU in 100%, others idle. This only confirms what I've already
been told: htb is single threaded by design. It also proves that most of
the packet processing work is actually in htb.
> BTW, I hope you add filters after classes they point to.
Do you mean the actual order I use for the "tc filter add" and "tc class
add" commands? Does it make any difference?
Anyway, speaking of htb redesign or improvement (to use multiple
threads / CPUs) I think classification rules can be cloned on a
per-thread basis (to avoid synchronization issues). This means
sacrificing memory for the benefit of performance but probably it is
better to do it this way.
However, shaping data structures must be shared between all threads as
long as it's not sure that all packets corresponding to a certain IP
address are processed in the same thread (they most probably would not,
if a round-robin alhorithm is used).
While searching the Internet for what has already been accomplished in
this area, I ran several time across the per-CPU cache issue. The
commonly accepted opinion seems to be that CPU parallelism in packet
processing implies synchronization issues which in turn imply cache
misses, which ultimately result in performance loss. However, with only
one core in 100% and other 7 cores idle, I doubt that CPU-cache is
really worth (it's just a guess and it definitely needs real tests as
evidence).
Thanks,
Radu Rendec
next prev parent reply other threads:[~2009-04-23 13:56 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-17 10:40 htb parallelism on multi-core platforms Radu Rendec
2009-04-17 11:31 ` David Miller
2009-04-17 11:33 ` Badalian Vyacheslav
2009-04-17 22:41 ` Jarek Poplawski
2009-04-18 0:21 ` Denys Fedoryschenko
2009-04-18 7:56 ` Jarek Poplawski
2009-04-22 14:02 ` Radu Rendec
2009-04-22 21:29 ` Jesper Dangaard Brouer
2009-04-23 8:20 ` Jarek Poplawski
2009-04-23 13:56 ` Radu Rendec [this message]
2009-04-23 18:19 ` Jarek Poplawski
2009-04-23 20:19 ` Jesper Dangaard Brouer
2009-04-24 9:42 ` Radu Rendec
2009-04-28 10:15 ` Jesper Dangaard Brouer
2009-04-29 10:21 ` Radu Rendec
2009-04-29 10:31 ` Jesper Dangaard Brouer
2009-04-29 11:03 ` Radu Rendec
2009-04-29 12:23 ` Jarek Poplawski
2009-04-29 13:15 ` Radu Rendec
2009-04-29 13:38 ` Jarek Poplawski
2009-04-29 16:21 ` Radu Rendec
2009-04-29 22:49 ` Calin Velea
2009-04-29 23:00 ` Re[2]: " Calin Velea
2009-04-30 11:19 ` Radu Rendec
2009-04-30 11:44 ` Jesper Dangaard Brouer
2009-04-30 14:04 ` Re[2]: " Calin Velea
2009-05-08 10:15 ` Paweł Staszewski
2009-05-08 17:55 ` Vladimir Ivashchenko
2009-05-08 18:07 ` Denys Fedoryschenko
2009-04-23 12:31 ` Radu Rendec
2009-04-23 18:43 ` Jarek Poplawski
2009-04-23 19:06 ` Jesper Dangaard Brouer
2009-04-23 19:14 ` Jarek Poplawski
2009-04-23 19:47 ` Jesper Dangaard Brouer
2009-04-23 20:00 ` Jarek Poplawski
2009-04-23 20:09 ` Jeff King
2009-04-24 6:01 ` Jarek Poplawski
[not found] ` <1039493214.20090424135024@gemenii.ro>
2009-04-24 11:19 ` Jarek Poplawski
2009-04-24 11:35 ` Re[2]: " Calin Velea
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=1240495002.6554.155.camel@blade.ines.ro \
--to=radu.rendec@ines.ro \
--cc=denys@visp.net.lb \
--cc=hawk@diku.dk \
--cc=jarkao2@gmail.com \
--cc=netdev@vger.kernel.org \
/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).