DEV Community

Cover image for Did you know Ruby has resolv-replace?
Yuta Miyama
Yuta Miyama

Posted on

Did you know Ruby has resolv-replace?

In Ruby, there's a library called resolv-replace.

This is a drop-in replacement (moneky patch) of libc DNS resolver Ruby's using under the hood. It'll use a pure Ruby implementation called Resolv.

The doc states the merit of Resolv as "Resolv can handle multiple DNS requests concurrently without blocking the entire Ruby interpreter". So ppl probably reach out to this when they want to improve the performance.

You can read how resolv-replace is patching a set of Ruby's stdlibc network calls at https://ruby-doc.org/stdlib-2.7.0/libdoc/resolv-replace/rdoc/index.html.

If you'd like more control on the DNS layer due to how your app's constructed, I'd recommend checking out this library.


Cover Photo by JJ Ying on Unsplash

Top comments (0)