-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Disable DNS cache #2262
Comments
Hi @asvetlov I was involved on the MR that put in place the current DNS cache mechanism implemented by aiohttp, here [1] and here [2]. The implementation should meet the requirements that you are asking as a showstopper. Indeed, this implementation was done taking into account the AWS enviornment, where we are running our services. The TTL initially proposed was 60 because this is the TTL proposed by AWS [1], I think that at some point @fafhrd91 proposed the current default value 10 seconds [3] (warning, the docstring is invalid [4]. Also related to that, the current implementation caches all IP addresses returned by the DNS server, choosing at each request the next IP address based on a round-robin strategy. I'm missing something? [1] #1819 |
Well, I'm not a DNS expert but @hellysmile could shed a light on the issue. BTW, what PPS. |
MR = PR I'm crossing words that I use in my daily work. Let's wait for @hellysmile comments, I'm not aware of any issue right now with the current DNS cache implementation. |
I'll try to explain issues that we have.
OS DNS call -> But if You have more than 1 process| I mean that only OS can cache DNS in this case. Any caching on application side without knowing TTL can bring issues. |
Hi @hellysmile thanks for your comment, much appreciated. The design of the current implementation was done using the AWS principles that you claim. The only difference is what TTL is used, for that as I've already commented in the original PR [1] :
Because of that, we decided to put the TTL as a hardcoded value. The value of that TTL, remember that is 10 seconds, is less than the value recommended by AWS [2], in fact 10 seconds value is some heuristic value that was found as the most optimal value to get rid of sporadic network failures [3] Regarding your comments. But, by default, the OS never caches DNS queries, at least for GNU/Linux environments that do not have a DNS service installed and configured. I do not understand your example of the processes and the DNS cache, can you evolve it a bit more ? [1] #1819 (comment) |
@pfreixes thanks You so much for detailed response! Seems I've missed #1819 , we had serious issues when I was mostly sure that there is built-in DNS cache on OS level, were forced to purge it on my Mac computer often. I've found There is only one feature which can be done in a future is to use |
@asvetlov I believe that this no longer a stopper for the new release. @hellysmile provide the TTL from the |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
If servers are hosted on Amazon DNS caches first answered IP.
In its turn Amazon uses round-robin to iterate over all IPs registered in load balancer.
Therefore aiohttp with cache enabled sends all payload to only one server from registered group.
The solution might don't use DNS cache for threaded DNS resolver and respect TTL returned by server for
aiodns
based implementation.To implement the feature the moving DNS caching into resolver makes sense.
The text was updated successfully, but these errors were encountered: