Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Frank Myhr <fmyhr@fhmtech.com>
Cc: Florian Westphal <fw@strlen.de>,
	"netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: Advantage(s) of static over dynamic nftables sets?
Date: Wed, 18 Mar 2020 23:51:53 +0100	[thread overview]
Message-ID: <20200318225153.GM979@breakpoint.cc> (raw)
In-Reply-To: <bc6f84a4-6599-eb7b-cc1c-e82f88d79ee0@fhmtech.com>

Frank Myhr <fmyhr@fhmtech.com> wrote:
> > > Would performance and/or memory usage take a significant hit by
> > > [defining all sets dynamic]?
> > 
> > I don't think so, but this will probably depend a lot on the
> > system in question and on the type of elements stored.
> 
> Makes sense, thanks. I suppose efficiency gets progressively worse for
> element types with larger possible ranges (# of bits), something like?:

Right now (assuming static), size <= 16 bits is most efficient,
then <= 32 bit, rest uses hash table.

> I suppose intervals are more efficient than an equivalent group of single
> elements?

Memory-wise yes, performance-wise no.

> Is a concatenation like ipv4_addr . inet_service as efficient as a pure data
> type with the same number of bits?

Yes, as it makes no difference for the storage.  The kernel doesn't know
what its storing, it only knows the size of the element.

It does store a 'type' information, but that is only used by nftables
so it knows how to format the elements when listing the ruleset.

  reply	other threads:[~2020-03-18 22:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 21:17 Advantage(s) of static over dynamic nftables sets? Frank Myhr
2020-03-18 21:35 ` Florian Westphal
2020-03-18 22:11   ` Frank Myhr
2020-03-18 22:51     ` Florian Westphal [this message]
2020-03-18 23:14       ` Frank Myhr
2020-03-19  0:08         ` Florian Westphal
2020-03-19  0:21           ` Frank Myhr

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=20200318225153.GM979@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=fmyhr@fhmtech.com \
    --cc=netfilter@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