Skip to content
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

feat: implement local dns cache #132

Merged
merged 2 commits into from
Mar 24, 2022
Merged

feat: implement local dns cache #132

merged 2 commits into from
Mar 24, 2022

Conversation

nlf
Copy link
Contributor

@nlf nlf commented Mar 22, 2022

@nlf nlf requested a review from a team as a code owner March 22, 2022 20:48
lib/dns.js Outdated Show resolved Hide resolved
lib/dns.js Outdated Show resolved Hide resolved
Copy link
Member

@wraithgar wraithgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with two very small suggestions that you can take or leave, approved either way.

verbatim: true,
}

const lookupCache = exports.lookupCache = new LRUCache({ max: 50 })
Copy link
Contributor

@lukekarrys lukekarrys Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any input on what this number should be, but I'm curious on what factors would lead us to change this. Do we have a target package-lock.json that would install without evicting any DNS cache entries?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is per-host, so unless you have more than 50 hosts you're making requests to in a single package-lock this should be just fine. also the lru-cache behaviors mean even if you did unless there's an even distribution you'll end up hitting the cache for the majority of requests anyway.

@nlf nlf merged commit 25cae2e into main Mar 24, 2022
@nlf nlf deleted the nlf/dns-cache branch March 24, 2022 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: introduce dns caching
3 participants