[ruby-core:91422] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout

From: Eric Wong <normalperson@...>
Date: 2019-02-06 10:21:48 UTC
List: ruby-core #91422
Masaki Matsushita <glass.saga@gmail.com> wrote:
> > getaddrinfo_a(3) still spawns background threads in glibc; so not a big win.
> As I briefly looked through glibc code, it seems to share and reuse
> its background threads.
> Please take a look at glibc/resolv/gai_misc.c and related files.

Right, however Ruby 2.6+ also has USE_THREAD_CACHE enabled to
reuse threads.  For applications which already uses short-lived
(Ruby) threads; this can even be a win because reusing Ruby
threads can improve locality.

I prefer sticking to resolve.rb.

c-ares <https://c-ares.haxx.se/> may be a another option if
resolve.rb isn't fast enough.

getaddrinfo_a(3) is the worst option IMHO.

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next