Skip to content

Commit

Permalink
feat(templates): bump dns_stale_ttl default to 1 hour (#12087)
Browse files Browse the repository at this point in the history
A longer stale TTL can help reduce the load on less performant/reliable DNS servers,
reducing proxy latency and availability impact to Kong's proxy path.

KAG-3080

Co-authored-by: Datong Sun <datong.sun@konghq.com>

---------

Co-authored-by: Datong Sun <datong.sun@konghq.com>
  • Loading branch information
chobits and dndx authored Dec 5, 2023
1 parent 8d10cc0 commit 533d3f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/bump_dns_stale_ttl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: Bump `dns_stale_ttl` default to 1 hour so stale DNS record can be used for longer time in case of resolver downtime.
type: performance
scope: Configuration
4 changes: 3 additions & 1 deletion kong.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -1529,14 +1529,16 @@
# property receives a value (in seconds), it
# will override the TTL for all records.

#dns_stale_ttl = 4 # Defines, in seconds, how long a record will
#dns_stale_ttl = 3600 # Defines, in seconds, how long a record will
# remain in cache past its TTL. This value
# will be used while the new DNS record is
# fetched in the background.
# Stale data will be used from expiry of a
# record until either the refresh query
# completes, or the `dns_stale_ttl` number of
# seconds have passed.
# This configuration enables Kong to be more
# resilient during resolver downtime.

#dns_cache_size = 10000 # Defines the maximum allowed number of
# DNS records stored in memory cache.
Expand Down
2 changes: 1 addition & 1 deletion kong/templates/kong_defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ dns_resolver = NONE
dns_hostsfile = /etc/hosts
dns_order = LAST,SRV,A,CNAME
dns_valid_ttl = NONE
dns_stale_ttl = 4
dns_stale_ttl = 3600
dns_cache_size = 10000
dns_not_found_ttl = 30
dns_error_ttl = 1
Expand Down

0 comments on commit 533d3f7

Please sign in to comment.