Skip to content

Commit cbab90a

Browse files
Merge pull request #288713 from pauljewellmsft/java-dns-ttl
Add section for JVM TTL
2 parents ef68869 + 89b7510 commit cbab90a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

articles/storage/blobs/storage-blob-java-get-started.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ author: pauljewellmsft
88
ms.author: pauljewell
99
ms.service: azure-blob-storage
1010
ms.topic: how-to
11-
ms.date: 10/02/2024
11+
ms.date: 10/18/2024
1212
ms.custom: devx-track-java, devguide-java, devx-track-extended-java
1313
---
1414

@@ -178,6 +178,20 @@ For information about how to obtain account keys and best practice guidelines fo
178178
179179
---
180180

181+
## Configure the JVM TTL for DNS name lookups
182+
183+
The Java Virtual Machine (JVM) caches responses from successful DNS name lookups for a specified period of time, known as time-to-live (TTL). The default TTL value for many JVMs is `-1`, which means that the JVM caches the response indefinitely, or until the JVM is restarted.
184+
185+
Because Azure resources use DNS name entries that can change, we recommend that you set the JVM TTL value to 10 seconds. This configuration ensures that an updated IP address for a resource is returned with the next DNS query.
186+
187+
To change the TTL value globally for all applications using the JVM, set the `networkaddress.cache.ttl` property in the `java.security` file.
188+
189+
```plaintext
190+
networkaddress.cache.ttl=10
191+
```
192+
193+
For Java 8, the `java.security` file is located in the `$JAVA_HOME/jre/lib/security` directory. For Java 11 and higher, the file is located in the `$JAVA_HOME/conf/security` directory.
194+
181195
## Build your app
182196

183197
As you build apps to work with data resources in Azure Blob Storage, your code primarily interacts with three resource types: storage accounts, containers, and blobs. To learn more about these resource types, how they relate to one another, and how apps interact with resources, see [Understand how apps interact with Blob Storage data resources](storage-blob-object-model.md).

0 commit comments

Comments
 (0)