From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Stephan Ferlin-Reiter <stephan.reiter@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: Slow "nft list counters"
Date: Mon, 6 Oct 2025 22:52:41 +0200 [thread overview]
Message-ID: <aOQsGUZTYvZkDcFx@calendula> (raw)
In-Reply-To: <CAFctyt+UdMz_yJYg=dMojijFZXdHT8aUyb7ga7Cme-NdYRP-gw@mail.gmail.com>
On Mon, Oct 06, 2025 at 12:39:56PM +0200, Stephan Ferlin-Reiter wrote:
> Hi,
>
> On a host I have many network interfaces with associated nftables
> rules and named counters. I’d like to get the state of the counters
> and thought about running “nft -j list counters”. That seems to take
> many seconds, however. As an alternative I wrote a small program that
> talks netlink and sends a dump request with NFT_MSG_GETOBJ for the
> tables I care about. That takes just milliseconds.
>
> Now I’m wondering whether I’m missing something in my program - I do
> seem to get what I care about. I’m also curious as to why the
> operation with the nft tool takes so long. Is it maybe looking at all
> the rules, which are complex in my case?
What userspace nftables version are you using?
I remember to have speed up this recently:
commit 969ce17b66f8084626610202f11d607911e049e6
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Mon Aug 26 00:41:37 2024 +0200
cache: add filtering support for objects
Currently, full ruleset flag is set on to fetch objects.
otherwise, provide simple script to reproduce.
Thanks.
next prev parent reply other threads:[~2025-10-06 20:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 10:39 Slow "nft list counters" Stephan Ferlin-Reiter
2025-10-06 20:52 ` Pablo Neira Ayuso [this message]
2025-10-07 8:43 ` Stephan Ferlin-Reiter
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=aOQsGUZTYvZkDcFx@calendula \
--to=pablo@netfilter.org \
--cc=netfilter@vger.kernel.org \
--cc=stephan.reiter@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