-
Notifications
You must be signed in to change notification settings - Fork 41k
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
Document ConfigurationPropertyCaching #34172
Comments
Are you able to provide some more details about the problems you're facing? Do you have very large property sources or is there some other reason why the memory pressure happens? Perhaps you can share a sample application that replicates the problem. The cache states are currently set based on if the property source is immutable. The assumption being that if the property source can't change, it's not a problem to keep the cache.
Have you seen the ConfigurationPropertyCaching.get(sources, propertySource).setTimeToLive(timeToLive); |
Hello, @philwebb . Thanks for your reply :) The actual usage scenario is a rules engine that relies on several keys in dynamic configuration, here is an example String[] keys = new String[]{ "foo", "bar", "foobar" /* other elements... */};
String[] values = Arrays.stream(keys).map(environment::getProperty).toArray(String[]::new);
/* do something with values... */ Different rules consume different keys. The complete data collection contains tens of thousands of keys and has a high QPS. At the same time, unfortunately, we are using G1's immature JDK version, and due to enterprise restrictions, we cannot upgrade it. Therefore, the young generation garbage collection algorithm is still Parallel New.
I did browse a lot of classes before this, but I paid too much attention to the Just a suggestion, would it be very valuable to provide a user-accessible documentation. |
Hello, @philwebb . There is still one point that I want to confirm: whether caching should be enabled by default. In the projects I have been in contact with, and many blogs have mentioned that properties can be obtained programmatically through If this values can be cached by default (even if it is only 50ms, P99 of latency in our pure calculation scenario), it will also be greatly improved in the above scenario of cyclically obtaining values. |
SpringIterableConfigurationPropertySource
is not enabled when using mutable property source
We've discussed this today. Our feeling is that having 10s of thousands of properties is a fairly extreme edge case. We're also reluctant to enable caching by default as it will cause unexpected and hard to diagnose behavior when a mutable property source changes. We'll update the reference documentation to make a brief mention of the |
spring-boot version: 3.0.2 (since 2.3.0)
In commit 7afd25f, a cache was introduced to optimize the overhead caused by copying and deduplication of
getPropertyNames
objects.But currently we have encountered some problems related to memory pressure. In the process of following the call stack, we found that the
cache
created inSpringIterableConfigurationPropertySource
only exists in two states:This is because there is no configuration in the
SpringIterableConfigurationPropertySource
, and there is no way to configure it (programmatic API or configuration file).The text was updated successfully, but these errors were encountered: