-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Stats: Add JVM dns cache expiration config to JvmInfo #36372
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
Stats: Add JVM dns cache expiration config to JvmInfo #36372
Conversation
The java security manager disables the DNS cache by default and never expires any DNS entry. The default behaviour without the security manager is 30 seconds. In dynamic environment DNS entries can change, which means, that an Elasticsearch instance requires a restart to pick up new settings. Right now, there is no visibility to find out, if/how the configuration for DNS expiration is set. This adds this info to the JvmInfo class. Either the setting is shown or it is marked as 'unlimited'
|
Pinging @elastic/es-core-features |
|
Testing is a bit hard as it requires JVM config changes. I tested this by setting the following in one more thing we could think about as well is to configure this setting in Elasticsearch using |
server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| public void testDnsTtl() { | ||
| String propertyValue = System.getProperty("networkaddress.cache.ttl"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you mention in the comment... I think it is safe to grab the property here, set it to the the desired value, test it, then set it back to the original value in a finally block. Assuming we don't execute any of the unit tests within the same JVM concurrently (I don't think we do, but not 100%).
|
@elasticmachine retest this please |
|
After #36570 I am not sure if we need this anymore? |
|
I think this still might help to quickly check the authoritative setting independent from the JVM args, i.e. in case of support - even though it is now more likely that the defaults are used? |
|
After discussing this one more time yesterday: I thought about this over sleep and I agree we do not need it. The corner case that this can catch will be extremely rare in the future (unless different JDK distributions decide to change default behaviour, which I consider unlikely AND the user has removed the options in the configuration file). As we can easily detect a configuration change by checking the I will close this. |
The java security manager disables the DNS cache by default and never
expires any DNS entry. The default behaviour without the security
manager is 30 seconds.
In dynamic environment DNS entries can change, which means, that an
Elasticsearch instance requires a restart to pick up new settings.
Right now, there is no visibility to find out, if/how the configuration
for DNS expiration is set.
This adds this info to the JvmInfo class. Either the setting is shown or
it is marked as 'unlimited'