From 93eb3d9f7107ce1e7c180173d62b250304dcca80 Mon Sep 17 00:00:00 2001 From: Carter Kozak Date: Tue, 30 Apr 2024 14:24:21 -0400 Subject: [PATCH] Reduce default dns cache ttl to ten seconds (from twenty) (#1636) Reduce default dns cache ttl to ten seconds (from twenty) to follow address changes more quickly --- changelog/@unreleased/pr-1636.v2.yml | 6 ++++++ .../gradle/dist/service/tasks/LaunchConfig.java | 5 +++-- .../service/JavaServiceDistributionPluginTests.groovy | 10 +++++----- 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 changelog/@unreleased/pr-1636.v2.yml diff --git a/changelog/@unreleased/pr-1636.v2.yml b/changelog/@unreleased/pr-1636.v2.yml new file mode 100644 index 000000000..5a1e351f3 --- /dev/null +++ b/changelog/@unreleased/pr-1636.v2.yml @@ -0,0 +1,6 @@ +type: improvement +improvement: + description: Reduce default dns cache ttl to ten seconds (from twenty) to follow + address changes more quickly + links: + - https://github.com/palantir/sls-packaging/pull/1636 diff --git a/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/LaunchConfig.java b/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/LaunchConfig.java index e117562be..7823f43c6 100644 --- a/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/LaunchConfig.java +++ b/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/service/tasks/LaunchConfig.java @@ -71,9 +71,10 @@ public final class LaunchConfig { "-Djava.io.tmpdir=var/data/tmp", "-XX:ErrorFile=var/log/hs_err_pid%p.log", "-XX:HeapDumpPath=var/log", - // Set DNS cache TTL to 20s to account for systems such as RDS and other + // Set DNS cache TTL to 10s to account for systems such as RDS and other // AWS-managed systems that modify DNS records on failover. - "-Dsun.net.inetaddr.ttl=20", + // We use a 10 second value matching the default negative cache ttl. + "-Dsun.net.inetaddr.ttl=10", "-XX:+UnlockDiagnosticVMOptions", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:NativeMemoryTracking=summary", diff --git a/gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/JavaServiceDistributionPluginTests.groovy b/gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/JavaServiceDistributionPluginTests.groovy index 0da24fc02..7c29838cc 100644 --- a/gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/JavaServiceDistributionPluginTests.groovy +++ b/gradle-sls-packaging/src/test/groovy/com/palantir/gradle/dist/service/JavaServiceDistributionPluginTests.groovy @@ -457,7 +457,7 @@ class JavaServiceDistributionPluginTests extends GradleIntegrationSpec { '-Djava.io.tmpdir=var/data/tmp', '-XX:ErrorFile=var/log/hs_err_pid%p.log', '-XX:HeapDumpPath=var/log', - '-Dsun.net.inetaddr.ttl=20', + '-Dsun.net.inetaddr.ttl=10', '-XX:+UnlockDiagnosticVMOptions', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:NativeMemoryTracking=summary', @@ -487,7 +487,7 @@ class JavaServiceDistributionPluginTests extends GradleIntegrationSpec { '-Djava.io.tmpdir=var/data/tmp', '-XX:ErrorFile=var/log/hs_err_pid%p.log', '-XX:HeapDumpPath=var/log', - '-Dsun.net.inetaddr.ttl=20', + '-Dsun.net.inetaddr.ttl=10', '-XX:+UnlockDiagnosticVMOptions', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:NativeMemoryTracking=summary', @@ -539,7 +539,7 @@ class JavaServiceDistributionPluginTests extends GradleIntegrationSpec { '-Djava.io.tmpdir=var/data/tmp', '-XX:ErrorFile=var/log/hs_err_pid%p.log', '-XX:HeapDumpPath=var/log', - '-Dsun.net.inetaddr.ttl=20', + '-Dsun.net.inetaddr.ttl=10', '-XX:+UnlockDiagnosticVMOptions', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:NativeMemoryTracking=summary', @@ -569,7 +569,7 @@ class JavaServiceDistributionPluginTests extends GradleIntegrationSpec { '-Djava.io.tmpdir=var/data/tmp', '-XX:ErrorFile=var/log/hs_err_pid%p.log', '-XX:HeapDumpPath=var/log', - '-Dsun.net.inetaddr.ttl=20', + '-Dsun.net.inetaddr.ttl=10', '-XX:+UnlockDiagnosticVMOptions', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:NativeMemoryTracking=summary', @@ -612,7 +612,7 @@ class JavaServiceDistributionPluginTests extends GradleIntegrationSpec { '-Djava.io.tmpdir=var/data/tmp', '-XX:ErrorFile=var/log/hs_err_pid%p.log', '-XX:HeapDumpPath=var/log', - '-Dsun.net.inetaddr.ttl=20', + '-Dsun.net.inetaddr.ttl=10', '-XX:+UnlockDiagnosticVMOptions', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:NativeMemoryTracking=summary',