-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Performance degradation in 0.10.0 due to DNS #2303
Comments
@Vermeille what is the ttl of your dns records? |
The TTL is 3600 |
The DNS call is always performed because somehow, Continuing my investigations. I'm trying to understand how upstreams_dict is meant to work. |
Okaaaaaaaaaaaaay. Should we write a migration procedure? I'll gladly help, but need your guidance to fully understand what /upstreams is all about |
This is completely logical, it should as it tests whether the hostname refers to an |
No
No
Yes 😄
yes. The
|
Okay, I think I got the general idea. However it seems the IP isn't cached, considering how long name resolution takes. Why so? Why Is it a good default behavior? My question essentially is: how do I stop spending that much time in DNS resolution and go back to my 0.9.9 awesome perfs? |
(Somewhat off topic) @Vermeille what are you using for load testing and generating those pretty charts? Is your testing script something you could share? Thanks! |
@coopr Jmeter 3 has super sexy charts. If you can't or don't use jmeter 3, we analyze the csv produced by jmeter 2 with a python/numpy script. I'll see on monday if I'm allowed to open source that script (I see no reason they refuse, but procedures...) |
What do your dns records look like? for SRV, A and CNAME queries, eg. |
an interesting experiment would be to add
to the |
My DNS is a CNAME that points to an A. My guess now is that there is a mistake in the cache.
When calling resolve("a.com") and the cache is empty, it will perform a DNS resolution. the DNS answer is:
And that will be cached. Meaning the cache now is
plus the "last" entry
Which is the mistake. The next query will then look for "a.com" in the cache, get the last successful type in the cache, which in this case is 1, and check for |
The mischievous line is this one. I guess the correct second argument is not |
Okay got a quick fix I guess. Certainly not what's best though. Adding this after this line puts in cache the first A response returned by the DNS, after following CNAMEs.
By doing so, the cache entry for |
@Vermeille can you give this branch a try: https://github.com/Mashape/lua-resty-dns-client/tree/fix/cname-caching check it out using git, and then do a |
That works super well for me, thanks! |
@Vermeille dunno how much work is involved, but could you share the update graphs from the original post as a comparison? |
thx! I love the way those graphs look ❤️ |
You're the real MVP! Many thanks! |
Fixes an issue with the dns resolver not properly caching CNAME records. fixes #2303
Fixes an issue with the dns resolver not properly caching CNAME records. fixes #2303
Hello,
Here, you can see some perf tests done in 0.9.9. Our setup is quite simple: we have a client querying a backend either directly ("Without Kong") or through Kong ("With Kong"). With upstream keep-alive properly set, the latency induced by kong is approxymately 1ms (networking time being negligible in our setup).
We were really looking forward to deploying Kong 0.10 because of the dynamic upstream keep-alive configuration. That being said, we ran our very same performance tests and got those results:
As you can see, latency distribution has clearly shifted right, with the mode of the distribution now being 15ms. After investigating, it turns out this time is spent in Kong, and more exactly in this call stack:
toip() does a DNS call way too frequently, it seems. Is it a misconfiguration on my side? Is it expected? Is there any issue when caching IPs?
I'm still investigating and will let you know of my results, and I'll be more efficient with your insights :)
The text was updated successfully, but these errors were encountered: