public inbox for gwml@vger.gnuweeb.org
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
To: Ahmad Gani <reyuki@gnuweeb.org>
Cc: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>,
	GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>
Subject: Re: [PATCH gwproxy v8 2/2] gwproxy: refactor code base to add experimental raw DNS backend
Date: Sun, 7 Sep 2025 14:06:13 +0700	[thread overview]
Message-ID: <20250907070613.GC3438918-ammarfaizi2@gnuweeb.org> (raw)
In-Reply-To: <CAADvAgouDoKp3_ZLyHMwcNtouzHcaSYq=QEdEKu9GK+q+zniBw@mail.gmail.com>

On Sun, Sep 07, 2025 at 01:39:05PM +0700, Ahmad Gani wrote:
> I think 65536 is a pretty low memory footprint in modern systems; as Sir
> Alviro noted, it's around 0.25 or 0.5 MB.
> 
> Maybe it's more beneficial to allocate at once in the stack rather than
> add instructions for growing/shrinking the allocated memory?

Yes, it's small. But I prefer to save the space for it. The memory
saving is very beneficial for a small Linux device like Raspberry Pi,
4G modems, or even your lovely home routers.

Also, when you have 65536 clients in a single thread, that doesn't
necessarily mean your DNS mapping are fully used from index 0 to 65535.
A DNS query is a short-lived object. You only need to keep it until the
DNS query receives a response.

Having 65536 outstanding DNS queries is very unlikely even with 100K
concurrent connections. Especially given the cache feature, you will
skip the DNS resolution if identical names are accessed very often. I
believe allocating it lazily is a good way for this design.

If the initial size, 16, feels too low for you. You may consider adding
an option to customize the initial size via CLI args.

-- 
Ammar Faizi


  parent reply	other threads:[~2025-09-07  7:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  7:55 [PATCH gwproxy v8 0/2] Initial work on integration of DNS parser lib in gwproxy Ahmad Gani
2025-08-29  7:55 ` [PATCH gwproxy v8 1/2] dnsparser: Add dns parser code Ahmad Gani
2025-08-29  7:55 ` [PATCH gwproxy v8 2/2] gwproxy: refactor code base to add experimental raw DNS backend Ahmad Gani
2025-09-05 16:26   ` Alviro Iskandar Setiawan
2025-09-06  4:32     ` Ahmad Gani
2025-09-06  5:16       ` Ahmad Gani
2025-09-06  6:17       ` Ahmad Gani
2025-09-06  6:48         ` Ahmad Gani
2025-09-06  7:02           ` Alviro Iskandar Setiawan
2025-09-06  6:47       ` Alviro Iskandar Setiawan
2025-09-09  2:38         ` reyuki
2025-09-06 11:27       ` Ahmad Gani
2025-09-06 12:01         ` Alviro Iskandar Setiawan
2025-09-06 12:58         ` Ahmad Gani
2025-09-06 13:30           ` Alviro Iskandar Setiawan
2025-09-06 13:44             ` Alviro Iskandar Setiawan
2025-09-06 14:26             ` Ahmad Gani
2025-09-06 14:30               ` Alviro Iskandar Setiawan
2025-09-07  4:22             ` Ammar Faizi
2025-09-07  5:57               ` Ammar Faizi
2025-09-07  6:39               ` Ahmad Gani
2025-09-07  6:40                 ` Ahmad Gani
2025-09-07  6:43                   ` Ammar Faizi
2025-09-07  7:06                 ` Ammar Faizi [this message]
2025-09-07  7:17                   ` Ahmad Gani
2025-09-07  9:52               ` Ahmad Gani
2025-09-07 10:19                 ` Ammar Faizi
2025-09-07 10:36                   ` Ahmad Gani
2025-09-06  7:14     ` Alviro Iskandar Setiawan
2025-09-06  7:21       ` Ahmad Gani
2025-09-06  7:47   ` Alviro Iskandar Setiawan
2025-09-06 11:01     ` Ahmad Gani
2025-09-05  9:18 ` [PATCH gwproxy v8 0/2] Initial work on integration of DNS parser lib in gwproxy Ammar Faizi
2025-09-05  9:34   ` Alviro Iskandar Setiawan

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=20250907070613.GC3438918-ammarfaizi2@gnuweeb.org \
    --to=ammarfaizi2@gnuweeb.org \
    --cc=alviro.iskandar@gnuweeb.org \
    --cc=gwml@vger.gnuweeb.org \
    --cc=reyuki@gnuweeb.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