From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Jose M. Guisado" <guigom@riseup.net>
Cc: Phil Sutter <phil@nwl.cc>,
netfilter-devel@vger.kernel.org, Derek Dai <daiderek@gmail.com>
Subject: Re: [nft PATCH] json: echo: Speedup seqnum_to_json()
Date: Wed, 2 Dec 2020 10:47:02 +0100 [thread overview]
Message-ID: <20201202094702.GA6888@salvia> (raw)
In-Reply-To: <62770c7d-8c44-e50a-a1dd-9829e660e499@riseup.net>
On Mon, Nov 30, 2020 at 09:43:04PM +0100, Jose M. Guisado wrote:
> On 23/11/20 0:56, Phil Sutter wrote:
> > Hi,
> >
> > On Sat, Nov 21, 2020 at 01:17:24PM +0100, Pablo Neira Ayuso wrote:
> > > On Fri, Nov 20, 2020 at 08:16:40PM +0100, Phil Sutter wrote:
> > > > Derek Dai reports:
> > > > "If there are a lot of command in JSON node, seqnum_to_json() will slow
> > > > down application (eg: firewalld) dramatically since it iterate whole
> > > > command list every time."
> > > >
> > > > He sent a patch implementing a lookup table, but we can do better: Speed
> > > > this up by introducing a hash table to store the struct json_cmd_assoc
> > > > objects in, taking their netlink sequence number as key.
> > > >
> > > > Quickly tested restoring a ruleset containing about 19k rules:
> > > >
> > > > | # time ./before/nft -jeaf large_ruleset.json >/dev/null
> > > > | 4.85user 0.47system 0:05.48elapsed 97%CPU (0avgtext+0avgdata 69732maxresident)k
> > > > | 0inputs+0outputs (15major+16937minor)pagefaults 0swaps
> > > >
> > > > | # time ./after/nft -jeaf large_ruleset.json >/dev/null
> > > > | 0.18user 0.44system 0:00.70elapsed 89%CPU (0avgtext+0avgdata 68484maxresident)k
> > > > | 0inputs+0outputs (15major+16645minor)pagefaults 0swaps
> > >
> > > LGTM.
> > >
> > > BTW, Jose (he's on Cc) should rewrite his patch to exercise the
> > > monitor path when --echo and --json are combined _and_ input is _not_
> > > json.
>
> IIRC v4 of the patch already takes into account this situation. Specifically
> this piece of code inside netlink_echo_callback. Returning the
> json_events_cb (the path leading to the seqnum_to_json call) when input is
> json.
OK, I have pushed out this patch. Thanks for clarifying.
prev parent reply other threads:[~2020-12-02 9:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 19:16 [nft PATCH] json: echo: Speedup seqnum_to_json() Phil Sutter
2020-11-21 12:17 ` Pablo Neira Ayuso
2020-11-22 23:56 ` Phil Sutter
2020-11-30 20:43 ` Jose M. Guisado
2020-12-02 9:47 ` Pablo Neira Ayuso [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=20201202094702.GA6888@salvia \
--to=pablo@netfilter.org \
--cc=daiderek@gmail.com \
--cc=guigom@riseup.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.