From: Simon Kirby <sim@netnation.com>
To: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Robert Olsson <Robert.Olsson@data.slu.se>,
Eric Dumazet <dada1@cosmosbay.com>,
netdev@oss.sgi.com
Subject: Re: Route cache performance
Date: Tue, 13 Sep 2005 15:14:48 -0700 [thread overview]
Message-ID: <20050913221448.GD15704@netnation.com> (raw)
In-Reply-To: <20050907195911.GA8382@yakov.inr.ac.ru>
On Wed, Sep 07, 2005 at 11:59:11PM +0400, Alexey Kuznetsov wrote:
> Hello!
>
> > Yes, setting maxbatch to 10000 also results in working gc,
>
> Could you try lower values? F.e. I guess 300 or a little more
> (it is netdev_max_backlog) should be enough.
300 seems to be sufficient, but I'm not sure what this depends on (load,
HZ, timing of some sort?). See below for full tests.
> > for the normal case also hurts the DoS case...and it really hurts when
> > the when the DoS case is the normal case.
>
> 5.7% is not "really hurts" yet. :-)
I decided to try out FreeBSD in comparison as I've heard people saying
that it handles this case quite well. The results are interesting.
FreeBSD seems to have a route cache; however, it keys only on
destination. When a new destination is seen, the route table entry that
matched is "cloned" so that the MTU, etc., is copied, the dst rewritten
to the exact IP (as opposed to a network route), and path MTU discovery
results are maintained in this entry, keyed by destination address only.
I'm not sure if Linux could work in the same way with the source routing
tables enabled, but perhaps it's possible to either disable the source
side of the route cache when policy routing is disabled. Or perhaps a
route cache hash could be instantiated per route table or something.
Actually, is there ever a valid case where the source needs to be tracked
in the route cache when policy routing is disabled? A local socket will
track MSS correctly while a forwarded packet will create or use an entry
without touching it, so I don't see why not.
Anyway, spoofed source or not go the same speed through FreeBSD. Also,
there is a "fastforwarding" sysctl that sends forwarded packets from
the input interrupt/poll without queueing them in a soft interrupt
("NETISR").
Polling mode on FreeBSD isn't as nice as NAPI in that it's fully manual
on or off, and when it's on it triggers entirely from the timer interrupt
unless told to also trigger from the idle loop. The user/kernel balancing
is also manual but I can't seem to get it to forward as fast as with it
disabled no matter how I adjust it.
TEST RESULTS
------------
All Linux tests with NAPI enabled and the e1000 driver native to that
kernel unless otherwise specified. maxbatch does not exist in kernels
< 2.6.9, and rhash_size does not exist in 2.4.
Sender: 367 Mbps, 717883 pps valid src/dst, 64 byte (Ethernet) packets
2.4.27-rc1: 297 Mbps forwarded (w/idle time?!)
2.4.31: 296 Mbps forwarded (w/idle time?!)
2.6.13-rc6: 173 Mbps forwarded
FreeBSD 5.4-RELEASE (HZ=1000): 103 Mbps forwarded (dead userland)
`- net.inet.ip.fastforwarding=1: 282 Mbps forwarded (dead userland)
`- kern.polling.enable=1: 75.3 Mbps forwarded
`- kern.polling.idle_poll=1: 226 Mbps forwarded
Sender: 348 Mbps, 680416 pps random src, valid dst, 64 bytes
(All FreeBSD tests have identical results.)
2.4.27-rc1: 122 Mbps forwarded
2.4.27-rc1 gc_elasticity=1: 182 Mbps forwarded
2.4.27-rc1+2.4.31_e1000: 117 Mbps forwarded
2.4.27-rc1+2.4.31_e1000 gc_elasticity=1: 170 Mbps forwarded
2.4.31: 95.1 Mbps forwarded
2.4.31 gc_elasticity=1: 122 Mbps forwarded
2.6.13-rc6: <1 Mbps forwarded (dst overflow)
2.6.13-rc6 maxbatch=30: <1 Mbps forwarded (dst overflow)
2.6.13-rc6 maxbatch=60: 1.5 Mbps forwarded (dst overflow)
2.6.13-rc6 maxbatch=100: 2.6 Mbps forwarded (dst overflow)
2.6.13-rc6 maxbatch=150: 3.8 Mbps forwarded (dst overflow)
2.6.13-rc6 maxbatch=200: 6.9 Mbps forwarded (dst overflow)
2.6.13-rc6 maxbatch=250: 15.4 Mbps forwarded (dst overflow)
2.6.13-rc6 maxbatch=300: 58.6 Mbps forwarded (gc balanced)
2.6.13-rc6 maxbatch=350: 60.5 Mbps forwarded
2.6.13-rc6 maxbatch=400: 59.4 Mbps forwarded
2.6.13-rc6 maxbatch=450: 59.1 Mbps forwarded
2.6.13-rc6 maxbatch=500: 62.0 Mbps forwarded
2.6.13-rc6 maxbatch=550: 61.9 Mbps forwarded
2.6.13-rc6 maxbatch=1000: 61.4 Mbps forwarded
2.6.13-rc6 maxbatch=2000: 60.2 Mbps forwarded
2.6.13-rc6 maxbatch=3000: 60.1 Mbps forwarded
2.6.13-rc6 maxbatch=5000: 59.1 Mbps forwarded
2.6.13-rc6 maxbatch=MAXINT: 59.1 Mbps forwarded
2.6.13-rc6 dst_free: 66.0 Mbps forwarded
2.6.13-rc6 dst_free max_size=rhash_size: 79.2 Mbps forwarded
------------
2.6 definitely has better dst cache gc balancing than 2.4. I can set
the max_size=rhash_size in 2.6.13-rc6 and it will just work, even without
adjusting gc_elasticity or gc_thresh. In 2.4.27 and 2.4.31, the only
parameter that appears to help is gc_elasticity. If I just adjust
max_size, it overflows and falls over.
I note that the actual read copy update "maxbatch" limit was added in
2.6.9. Before then, it seems there was no limit (infinite). Was it
added for latency reasons?
Time permitting, I'd also like to run some profiles. It's interesting
to note that 2.6 is slower at forwarding even straight duplicate small
packets. We should definitely get to the bottom of that.
Simon-
next prev parent reply other threads:[~2005-09-13 22:14 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-15 21:38 Route cache performance Simon Kirby
2005-08-16 2:23 ` Eric Dumazet
2005-08-23 19:08 ` Simon Kirby
2005-08-23 19:56 ` Robert Olsson
2005-08-24 0:01 ` Simon Kirby
2005-08-24 3:50 ` Robert Olsson
2005-08-25 18:11 ` Simon Kirby
2005-08-25 20:05 ` Alexey Kuznetsov
2005-08-25 21:22 ` Simon Kirby
2005-08-26 11:55 ` Alexey Kuznetsov
2005-08-26 19:49 ` Robert Olsson
2005-09-06 23:57 ` Simon Kirby
2005-09-07 1:19 ` Alexey Kuznetsov
2005-09-07 15:03 ` Robert Olsson
2005-09-07 16:55 ` Simon Kirby
2005-09-07 17:21 ` Robert Olsson
2005-09-07 14:45 ` Robert Olsson
2005-09-07 16:28 ` Simon Kirby
2005-09-07 16:49 ` Robert Olsson
2005-09-07 16:57 ` Simon Kirby
2005-09-07 19:59 ` Alexey Kuznetsov
2005-09-13 22:14 ` Simon Kirby [this message]
2005-09-14 8:04 ` Robert Olsson
2005-09-17 0:28 ` Simon Kirby
2005-09-17 9:04 ` Martin Josefsson
2005-09-17 15:17 ` jamal
2005-09-15 21:04 ` Alexey Kuznetsov
2005-09-15 21:30 ` Robert Olsson
2005-09-15 22:21 ` Alexey Kuznetsov
2005-09-16 12:18 ` Robert Olsson
2005-09-16 19:04 ` Alexey Kuznetsov
2005-09-16 19:22 ` Ben Greear
2005-09-16 19:57 ` Robert Olsson
-- strict thread matches above, loose matches on Subject: below --
2005-08-24 16:06 Simon Kirby
[not found] <20050301220743.GF2554@netnation.com>
[not found] ` <16940.9990.975632.115834@robur.slu.se>
2005-03-09 1:45 ` Simon Kirby
2005-03-09 12:05 ` Robert Olsson
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=20050913221448.GD15704@netnation.com \
--to=sim@netnation.com \
--cc=Robert.Olsson@data.slu.se \
--cc=dada1@cosmosbay.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@oss.sgi.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).