-
Notifications
You must be signed in to change notification settings - Fork 126
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
Prevent NONEEDEDGLUE errors and add cache statistics #456
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… failures, which is par for the course
zakird
reviewed
Sep 28, 2024
src/cli/worker_manager.go
Outdated
@@ -530,6 +533,7 @@ func Run(gc CLIConf) { | |||
close(outChan) | |||
close(metaChan) | |||
routineWG.Wait() | |||
resolverConfig.Cache.Stats.PrintStatistics() |
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.
We should move into metadata
zakird
approved these changes
Sep 28, 2024
…t cache stats at verbosty=5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Prior to this change, we were adding
Authorities
andAdditionals
as separate records in the cache. This meant that theAuthorities
was inserted as an NS record, but the Additionals were inserted as separate A/AAAA records. Separately, our cache is an LRU cache with 4096 shards, 2 entries per shard by default. What this means is that we have no guarantees that all of a domain's Authorities + Additionals are in the cache, since a partial set can be evicted.This loss of accuracy was what caused the
NONEEDEDGLUE
records to pop up, especially as more domains in the same run.Changes
--verbosity=5
. No performance impact if--verbosity < 5
time="2024-09-27T20:28:52Z" level=debug msg="Cache statistics: hits=29870 misses=85581 adds=30790 ejects=21604 hitRate=25.872448% missRate=74.127552%"
SingleQueryResult
pointer vs. returning the struct since each function would have to create a new structure and copy the internals. The pointer avoids this.Authority
record or `Answer record are stored atomicallyAuthority
records store the authority's for a certain domain -.com
Answer
records store the authoritative answers for a certain query -A google.com
Performance
Tested with 10000 top domains,
A --iterative --threads=100 --verbosity=5
main
Runtime - 37.2 s
Allocs - 2199 MB total allocations (this is not peak memory use since the Garbage Collector cleans up un-used memory, this is just total allocated objects)
NOERROR - 9919
TIMEOUT/ITERATIVE_TIMEOUT - 5
NXDOMAIN - 54
Branch
Runtime - 33.9 s
Allocs - 1216 MB
NOERROR - 9916
TIMEOUT/ITERATIVE_TIMEOUT - 9
NXDOMAIN - 55
Main takeaway is there was a sharp reduction in allocations, however the runtime reduction wasn't that large (and likely within the margin of error, other A/B tests didn't show such a large delta), so it seems garbage collection is not our bottleneck.
Either way, I think this is a needed change for cache use.