-
Notifications
You must be signed in to change notification settings - Fork 116
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
What is the caching specification for Config? #370
Comments
Hi Laird! All the caching is born from practical needs. At a customer we have about 20k requests/min and server and we read tons of config values with each request. If we would go e.g. to the properties Table in the DB for each Config#getValue().... You get the idea. There are 3 parts involved in this story: The are many subtle details involved and we went through long discussions and many years of experience in this field. Might be the easiest if you could join the mp-config hangout next time. |
Thanks, Mark; hangouts are fine and good but I'm looking for what's in the actual specification. Thanks for your reply. From your reply I understand that at least in version 1.2.1:
What I want to find out in version 1.2.1 is:
|
So that I'm not just complaining 😄 here are some example Javadocs in the style of what I would expect to see in anything that calls itself a specification, and not just a sketch or a hint. Here are some Javadocs I'd expect to see on the
Or, if caching is forbidden, i.e. the absence of caching is part of the specification, I'd expect to see this instead:
I might also add something like this:
…if it is true. (The specification says that all methods in With language such as this, I would know definitively how to implement this method. Without language such as this I would not know definitively how to implement this method. |
One step after the other:
Intentionally undefined. Note that this method is usually not used that often. So in my impl I do not have caches but always go through to the ConfigSources. But you could do it different.
Same behaviour as with getValue()!
getConfigSources() returns the ConfigSources registered or detected at startup. And the Config 'infrastructure' does not change afterwards (Config infra is basically immutable). If you consider this as 'caching' then yes. |
Thank you; should this information go in the specification? |
We could, but it would blow up the amount of things to specify. And this would be counter productive regarding readability. We could probably have some implementers notes. Also not sure how to TCK this. We should imo be very careful to not over-specify it. |
OK; could we add language that indicates that implementors are free to implement this method however they like? (Also, you mention:
I didn't find a reference in the specification for this (the third bullet is "Must a |
@struberg and I talked this in today's hangout. It is implementation details whether to cache it. If you cache it, you will have performance gain but latency. The spec does not force implementations to cache it or not. You may choose not to cache it. |
At today's hangout, we agreed that we are going to add a couple of sentences in the spec to state: |
I am trying to add something as noted above. However, I double checked the spec. It has the following already:
With is, I am closing this as done. |
The relevant section of the specification for MicroProfile Config says only this:
This speaks to the
getValue(String, Class)
method ofConfig
, but does not mention thegetOptionalValue(String, Class)
orgetPropertyNames()
(orgetConfigSources()
) methods.The phrase "A Config instance provides no caching" make It sound like perhaps the intent of the caching specification of
Config
is that, loosely speaking, no caching at all must occur in any implementations of any of these methods. That is,getConfigSources()
should always check to see ifConfigSource
s have been added or removed or otherwise changed since the last invocation, andgetPropertyNames()
should aggregate invocations of each suchConfigSource
'sgetPropertyNames()
method, each time, andgetOptionalValue(String, Class)
should use the same algorithm described by the specification forgetValue(String, Class)
.Is this a correct interpretation of the intent of the specification?
The text was updated successfully, but these errors were encountered: