public inbox for gwml@vger.gnuweeb.org
 help / color / mirror / Atom feed
* [GIT PULL] Implement getaddrinfo_a() for higher concurrency
@ 2025-06-27 18:51 Ammar Faizi
  2025-06-27 18:58 ` Alviro Iskandar Setiawan
  0 siblings, 1 reply; 5+ messages in thread
From: Ammar Faizi @ 2025-06-27 18:51 UTC (permalink / raw)
  To: Alviro Iskandar Setiawan; +Cc: Yonle, GNU/Weeb Mailing List

Hi Alviro,

Based on our discussion on Telegram, this pull request introduces
the usage of `gaiaddrinfo_a()` to enhance the concurrency of DNS
resolution.

There are two main changes in this pull request:

- Use `gaiaddrinfo_a()` to achieve more concurrency.

  Allow DNS resolver threads to perform multiple DNS queries
  at once using gaiaddrinfo_a().

- And then, avoid `gaiaddrinfo_a()` if resolver threads are not exhausted.

  The asynchronous `gaiaddrinfo_a()` function, while non-blocking,
  comes with a hidden cost: it spawns a new thread for every
  single query. This frequent creation and destruction of threads
  is inefficient and can become a major bottleneck.
  
  Check the number of active DNS queries against the pool of
  available resolver threads. If there are idle threads ready to
  work, we delegate new DNS lookups to them using the synchronous
  `getaddrinfo()`. It reuses existing threads and completely
  avoids the overhead of creating new ones.
  
  The costly `gaiaddrinfo_a()` is now only used as a fallback when
  the entire pool of resolver threads is exhausted. This leads to
  a more robust, efficient, and scalable DNS resolution mechanism.

Please pull!

The following changes since commit 46147b0405ae7565f2b3bc12488bc51653ed5d67:

  Delete fd from epoll early to avoid EPOLLIN being fired later (2025-06-27 21:39:08 +0700)

are available in the Git repository at:

  https://github.com/ammarfaizi2/gwproxy tags/gai_async-2025-06-28

for you to fetch changes up to ae6691db8c9a5ec07de75cdda23d939794cce91e:

  Avoid `gaiaddrinfo_a()` if resolver threads are not exhausted (2025-06-28 01:44:15 +0700)

----------------------------------------------------------------
gai_async-2025-06-28

----------------------------------------------------------------
Ammar Faizi (2):
      Use `gaiaddrinfo_a()` to achieve more concurrency
      Avoid `gaiaddrinfo_a()` if resolver threads are not exhausted

 gwproxy.c | 241 ++++++++++++++++++++++++++++++++++------
 1 file changed, 207 insertions(+), 34 deletions(-)

-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT PULL] Implement getaddrinfo_a() for higher concurrency
  2025-06-27 18:51 [GIT PULL] Implement getaddrinfo_a() for higher concurrency Ammar Faizi
@ 2025-06-27 18:58 ` Alviro Iskandar Setiawan
  2025-06-27 18:59   ` Ammar Faizi
  0 siblings, 1 reply; 5+ messages in thread
From: Alviro Iskandar Setiawan @ 2025-06-27 18:58 UTC (permalink / raw)
  To: Ammar Faizi; +Cc: Yonle, GNU/Weeb Mailing List

On Sat, Jun 28, 2025 at 1:52 AM Ammar Faizi wrote:
> Ammar Faizi (2):
>       Use `gaiaddrinfo_a()` to achieve more concurrency
>       Avoid `gaiaddrinfo_a()` if resolver threads are not exhausted

There are typos. s/gaiaddrinfo_a/getaddrinfo_a/g

-- Viro

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT PULL] Implement getaddrinfo_a() for higher concurrency
  2025-06-27 18:58 ` Alviro Iskandar Setiawan
@ 2025-06-27 18:59   ` Ammar Faizi
  2025-06-27 19:07     ` [GIT PULL v2] " Ammar Faizi
  0 siblings, 1 reply; 5+ messages in thread
From: Ammar Faizi @ 2025-06-27 18:59 UTC (permalink / raw)
  To: Alviro Iskandar Setiawan; +Cc: Yonle, GNU/Weeb Mailing List

On Sat, Jun 28, 2025 at 01:58:16AM +0700, Alviro Iskandar Setiawan wrote:
> On Sat, Jun 28, 2025 at 1:52 AM Ammar Faizi wrote:
> > Ammar Faizi (2):
> >       Use `gaiaddrinfo_a()` to achieve more concurrency
> >       Avoid `gaiaddrinfo_a()` if resolver threads are not exhausted
> 
> There are typos. s/gaiaddrinfo_a/getaddrinfo_a/g

Ah right, I will resend with the typos fixed.

-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [GIT PULL v2] Implement getaddrinfo_a() for higher concurrency
  2025-06-27 18:59   ` Ammar Faizi
@ 2025-06-27 19:07     ` Ammar Faizi
  2025-06-27 19:13       ` Alviro Iskandar Setiawan
  0 siblings, 1 reply; 5+ messages in thread
From: Ammar Faizi @ 2025-06-27 19:07 UTC (permalink / raw)
  To: Alviro Iskandar Setiawan; +Cc: Yonle, GNU/Weeb Mailing List

Hi Alviro,

[ v2: Fix typos, s/gaiaddrinfo_a/getaddrinfo_a/g ]

Based on our discussion on Telegram, this pull request introduces
the usage of `getaddrinfo_a()` to enhance the concurrency of DNS
resolution.

There are two main changes in this pull request:

- Use `getaddrinfo_a()` to achieve more concurrency

  Allow DNS resolver threads to perform multiple DNS queries
  at once using getaddrinfo_a().

- And then, avoid `getaddrinfo_a()` if resolver threads are not exhausted.

  The asynchronous `getaddrinfo_a()` function, while non-blocking,
  comes with a hidden cost: it spawns a new thread for every
  single query. This frequent creation and destruction of threads
  is inefficient and can become a major bottleneck.
  
  Check the number of active DNS queries against the pool of
  available resolver threads. If there are idle threads ready to
  work, we delegate new DNS lookups to them using the synchronous
  `getaddrinfo()`. It reuses existing threads and completely
  avoids the overhead of creating new ones.
  
  The costly `getaddrinfo_a()` is now only used as a fallback when
  the entire pool of resolver threads is exhausted. This leads to
  a more robust, efficient, and scalable DNS resolution mechanism.

Please pull!

The following changes since commit 46147b0405ae7565f2b3bc12488bc51653ed5d67:

  Delete fd from epoll early to avoid EPOLLIN being fired later (2025-06-27 21:39:08 +0700)

are available in the Git repository at:

  https://github.com/ammarfaizi2/gwproxy tags/gai_async-v2-2025-06-28

for you to fetch changes up to 7a4ca1ebc41b421e44bf83ad23c8bd06c2ed0a17:

  Avoid `getaddrinfo_a()` if resolver threads are not exhausted (2025-06-28 02:02:20 +0700)

----------------------------------------------------------------
gai_async-v2-2025-06-28

----------------------------------------------------------------
Ammar Faizi (2):
      Use `getaddrinfo_a()` to achieve more concurrency
      Avoid `getaddrinfo_a()` if resolver threads are not exhausted

 gwproxy.c | 241 ++++++++++++++++++++++++++++++++++------
 1 file changed, 207 insertions(+), 34 deletions(-)

-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT PULL v2] Implement getaddrinfo_a() for higher concurrency
  2025-06-27 19:07     ` [GIT PULL v2] " Ammar Faizi
@ 2025-06-27 19:13       ` Alviro Iskandar Setiawan
  0 siblings, 0 replies; 5+ messages in thread
From: Alviro Iskandar Setiawan @ 2025-06-27 19:13 UTC (permalink / raw)
  To: Ammar Faizi; +Cc: Yonle, GNU/Weeb Mailing List

The pull request you sent on Sat, 28 Jun 2025 02:07:12 +0700:

> https://github.com/ammarfaizi2/gwproxy tags/gai_async-v2-2025-06-28

has been merged into alviroiskandar/gwproxy.git:
https://github.com/alviroiskandar/gwproxy/commit/43c5e487c8deb14ac9d032383a7cdff565774222

ありがとうございます!

-- Viro

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-27 19:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 18:51 [GIT PULL] Implement getaddrinfo_a() for higher concurrency Ammar Faizi
2025-06-27 18:58 ` Alviro Iskandar Setiawan
2025-06-27 18:59   ` Ammar Faizi
2025-06-27 19:07     ` [GIT PULL v2] " Ammar Faizi
2025-06-27 19:13       ` Alviro Iskandar Setiawan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox