-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update: add DNS caching to request manager #4447
Conversation
**Summary** Fixes #746. Unfortunately neither Node, nor many systems come with built-in DNS caching so the many parallel requests that Yarn makes sometimes overwhelm the DNS servers, and most of the time, for the very same domain(s). Even worse, we pay the DNS look up cost for each request, which is quite sad at best. This patch introduces the `dnscache` module which intercepts all DNS look ups and answers them from an in-memory cache when possible. This applies to the built-in `http` and `https` modules, used by `request`. **Test plan** Exiting tests should pass, and hopefully be faster. Total number of DNS look ups should decrease dramatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
This change will increase the build size from 9.52 MB to 9.69 MB, an increase of 176.98 KB (2%)
|
70 KB increase seems like a lot, but I guess it's worth it 😛 I'm surprised the operating system doesn't do DNS caching? Does this mean that every app needs to implement its own cache? 😢 |
Good catch.
Is it JS only btw, does it bundle well?
…On Wed, Sep 13, 2017 at 9:36 PM Daniel Lo Nigro ***@***.***> wrote:
70 KB increase seems like a lot, but I guess it's worth it 😛
I'm surprised the operating system doesn't do DNS caching? Does this mean
that every app needs to implement its own cache? 😢
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#4447 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWOlvO1tTv_txOKelSsoi2-y_yobsks5siK1CgaJpZM4PW0Ju>
.
|
@bestander see #4447 (comment) I think it is acceptable since it is a 2% increase.
Some do some doesn't and apparently even if they do, they are not great. I know Chrome comes with its own DNS cache and resolution system for instance. Windows is supposed have the cache but those Docker instances sure don't and I'm fairly certain that leaving the app for the exact same domain thousands of times (even if you have the OS cache) is not great. |
any numbers on which scale this changes improves performance? |
**Summary** Fixes yarnpkg#746. Unfortunately, neither Node, nor many systems come with built-in DNS caching so the many parallel requests that Yarn makes sometimes overwhelm the DNS servers, and most of the time, for the very same domain(s). Even worse, we pay the DNS look up cost for each request, which is quite sad at best. This patch introduces the `dnscache` module which intercepts all DNS look ups and answers them from an in-memory cache when possible. This applies to the built-in `http` and `https` modules, used by `request`. **Test plan** Existing tests should pass, and hopefully be faster. Total number of DNS look ups should decrease dramatically.
Summary
Fixes #746. Unfortunately, neither Node, nor many systems come with
built-in DNS caching so the many parallel requests that Yarn makes
sometimes overwhelm the DNS servers, and most of the time, for the
very same domain(s). Even worse, we pay the DNS look up cost for
each request, which is quite sad at best. This patch introduces
the
dnscache
module which intercepts all DNS look ups and answersthem from an in-memory cache when possible. This applies to the
built-in
http
andhttps
modules, used byrequest
.Test plan
Existing tests should pass, and hopefully be faster. Total number of
DNS look ups should decrease dramatically.