Mechanism to register Runtime Information which depends on Configuration #46915
Replies: 8 comments 74 replies
-
//cc @cescoffier @dmlloyd @gsmet |
Beta Was this translation helpful? Give feedback.
-
I'm very glad to see this proposal moving forward (as you know 🙂). Making our configuration properly immutable and solving these use cases well at the same time is very important! A few unordered points:
One longer point. My gut feeling is that using special configuration layer syntax to reference registered port bindings (when the client and server are in the same application, which is not a common case, right?) is not the right approach and won't scale to new problem domains (in addition to complicating something that is already hideously complex). A structural approach might work better, for example: quarkus.rest-client.EchoClient.service-binding=serviceName Better still would be to acknowledge that the server is in the same process as the client and bypass the whole HTTP socket thing completely in this case, but maybe that's magical thinking (or significant misunderstanding). In WildFly there is a notion of configured socket bindings which is completely separate from the services that are bound, so that both the client and server side of the services would reference the configuration by name. There are a few downsides to this (e.g. the configuration of the socket not living in the same place as the service itself) and a few upsides (everything is uniform and managed centrally, and everything is always named as a consequence of how the configuration stacks together). Not sure if there is anything that can be done with this idea, but maybe it's a useful seed. Remote service location is related to this but I think that is a separate (more complex) topic of conversation. |
Beta Was this translation helpful? Give feedback.
-
One thing missing from the summary are the specific use cases (they're implied but not really stated directly). We discussed several, but my memory of our conversation is already fading, as it usually does. Can we list them? One would be same-VM service discovery as discussed above. Could we get a description of the relevant circumstances? I.e. testing, etc. One use case could be to centralize logging of socket registration so that there's just one thing that logs new open ports (for example). One use case could be to have a central point that a service discovery mechanism of some sort (DNS-SD, SLP, or something else) could tie into. |
Beta Was this translation helpful? Give feedback.
-
This seems like a service registry notion more than a naming service notion. The WildFly separation of network bindings from the service is what matches the reality of environments better. Both the transport and protocol are potentially things that are configured independent of a given service and injected into the service. |
Beta Was this translation helpful? Give feedback.
-
Would all consumers of config need to understand this mechanism and query both config and the new registry to get 'correct' values? Or would consumption of config continue to use the current mechanism? |
Beta Was this translation helpful? Give feedback.
-
Next question :) How will we handle priority? In the current mechanism, |
Beta Was this translation helpful? Give feedback.
-
Hello, Lazy Runtime Config DiscussionI'll try to summarize this discussion. The ProblemSome Quarkus configuration properties receive their actual value at runtime (e.g., quarkus.http.port=0 delegates to the OS to assign a random port). Once resolved, these values:
This issue is not limited to ports—it affects any lazy value. Proposed SolutionsSolution A – Adding a Quarkus Runtime RegistryNote: This version excludes integration with the config system - only a separate API is considered. Mechanism:
⠀
⠀
Integrating this directly into the config system would mutate the config and create values that change depending on resolution timing. Solution B – Service Bindings with Specific Config SyntaxMechanism:
⠀
⠀
⠀ Solution C – Scheme-Based URIs (Stork-style stork:// or quarkus://)Mechanism:
⠀
⠀
Solution D – Socket Binding Registry (WildFly Style)Mechanism:
⠀
⠀
⠀ Solution E – Two-Phase Plan: Registry First, Discovery LaterThis approach limits initial impact and opens the door to broader features in Quarkus 4. Mechanism:
⠀
⠀
⠀ Summary Table
|
Beta Was this translation helpful? Give feedback.
-
Currently these are the pieces that rely in the Configuration to retrieve the running port:
There may be more, since there is a lot of indirection going on (via String building, expressions, etc), but it already gives us a good idea of the situation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, we have specific configurations that do not necessarily reflect the actual runtime value used by Quarkus. Many configuration names can set specific values that instruct Quarkus to either generate the final value or get the final value by some other means.
A good example is when we set
quarkus.http.port=0
. What we mean by this is for Quarkus to assign a random port, but how do we communicate the actual real port back to the system? Right now, we override the original config, and consumers have to query the Config system to get the correct value, which is far from ideal, causing many issues:Also, a few related issues:
While the issue with
quarkus.http.port
is the most visible one, this also affects other properties usually related to CPU, Memory, Threads, and more.Proposal
Add a new simple API (a poor's man simple JNDI approach :)), where the final runtime values are registered, instead of using the current Config:
An internal implementation can be backed up by a
ConcurrentHashMap
. The API may offer methods to list and remove runtime values. This is intended only for extension and is not limited to ports. It can be used to store any runtime information that does not fit in the configuration.Each runtime value should provide specialized APIs backed by
QuarkusRuntime
to convey expected behaviors.Ports
When users need to connect to Quarkus, they often use
quarkus.http.host
,quarkus.http.port
(or configuration expressions). As we described earlier and current issues, this is not desirable.An alternate proposal is to introduce a naming mechanism that can reference the internal Quarkus service without requiring to know or specify the details. Typically, if we want to connect to a REST endpoint, we use the following:
Instead, we would use:
Where
serviceName
isquarkus-http
. This would give us enough information to resolve the address to Quarkus Vert.x HTTP. Each configuration that may take a@{serviceName}
must be mapped by aConverter
friendly class (SocketAddress?
), that usesQuarkusRuntime
detailed above to provide the final resolved value. SuchConverter
could also contain specific code to support the legacy case ofhttp://${quarkus.http.host}:${quarkus.http.port}
. Also, it should be possible for the user to keep specifying a plainURL
.As an example, a non-comprehensive list of possible names for Quarkus Services:
quarkus-http
quarkus-https
quarkus-management
quarkus-grpc
quarkus-websockets
This should allow us to remove all our current workarounds and make our Configuration immutable. Obviously, this is just a proposal, which we should discuss and figure out if we have other ideas.
Beta Was this translation helpful? Give feedback.
All reactions