Skip to main content
Version: Deploy Next

Configure JVM DNS TTL

This guide explains how to configure the DNS Time-to-Live (TTL) settings for the Deploy Java Virtual Machine (JVM) in a Kubernetes environment. Proper TTL configuration is crucial for managing how long DNS resolutions are cached, which can affect system performance and network behavior.

Understanding JVM DNS Caching​

The Deploy Java Virtual Machine (JVM) implements DNS caching to optimize hostname resolution performance. When the JVM resolves a hostname to an IP address, it stores this resolution in a cache for a configurable period, known as the Time-to-Live (TTL).

By default, the TTL on the Deploy images is set to 30 seconds. This setting is configured in the conf/security/security.properties file in the JVM home directory:

networkaddress.cache.ttl=30
TTL Values
  • Setting TTL to -1 configures permanent caching
  • Setting TTL to 0 disables caching entirely
  • Any positive value represents the cache duration in seconds

Modifying TTL Settings​

To change the default TTL value, you can modify the networkaddress.cache.ttl property through the operator CR configuration. For example, to set the TTL to 10 seconds:

For example, to set the TTL to 10 seconds on the master node:

kubectl patch -n digitalai digitalaideploys.xld.digital.ai dai-xld \
--type=merge --patch '{"spec":{"master":{"jvm":{"options":{"networkaddress.cache.ttl":10}}}}}'
important

After modifying the TTL setting, the Deploy pods will not automatically restart. You must manually restart them using the following steps:

  1. Restart the Deploy pods:
kubectl delete sts dai-xld-digitalai-deploy-master -n digitalai
kubectl delete sts dai-xld-digitalai-deploy-worker -n digitalai
  1. Wait for the Deploy pods to complete their restart sequence.