Should caching parameters go to CLI parameters or Configuration parameters? #189
Replies: 4 comments 17 replies
-
I'm pretty sure @BrynCooke will want these parameters to go into Configuration because it's easier to maintain. As a general rule of thumb, I use CLI parameters only for things that are interesting to override. For example the log level (env_filter parameter). But there is no strict rule about this at the moment and I think we (the team) are still figuring out what to put where. Now you said:
If you don't mind sharing your thoughts on why you would want those parameters to be CLI parameters instead of Configuration file parameters? In my opinion the caching parameters are part of the configuration of the router itself. I might want to share this configuration file between multiple machines so it behaves the same. Using CLI parameters is less scalable as you need to change the command invocation. I imagine 2 possible scenarios:
The struct |
Beta Was this translation helpful? Give feedback.
-
I am a -1 on having any configuration or command line parameter for this at this moment. For us to add configuration options the things we should ask ourselves are:
In this case I would begin with a sensible default and re-evaluate if the face of an actual need to configure this. If we do need to configure would suggest that |
Beta Was this translation helpful? Give feedback.
-
as follow up on #118 (comment) how about environment variables for overridable things. Note that there are already environment variables for different things, like internal parameters for OTLP ( #50 ) or jaeger credentials (router/crates/apollo-router/src/configuration/mod.rs Lines 226 to 232 in 030ce44 I'm not suggesting we should have all 3 methods though, I'd just like us to be consistent and have like one main way and one override way |
Beta Was this translation helpful? Give feedback.
-
I agree with @Geal that env variables would be much better for now. I suggest we delete the CLI parameters related to caching and use (build?) environment variable instead. Vote for me 🇧🇪 |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
(Preserving the discussion about caching parameters here for further discussion...)
This should go in Configuration
I'm not convinced this is the right name for this field...
This variable in particular concerns the cache size of the query planning. There will probably be more caches. For example the queries will be parsed to Query objects Soon ™️ and it's also kind of a query cache.
I think we need to be more specific. For example we could create a struct Cache (in module configuration) that will have a field for each different cache. What do you think?
Member
Author
@garypen garypen 1 hour ago
I know what you mean about the name and the fact that it should be in configuration (which didn't exist before my merge).
Name suggestion: plan_cache_limit (to identify that it is only for plans). I could make that change in this PR.
The bigger suggestion of changing to Configuration and the Cache struct should be in a separate Issue/PR I think, since it is probably expanding the scope of this one too much.
Member
@cecton cecton 20 minutes ago
Configuration exists for a very long time now 🤔 even before I arrived.
Name suggestion: plan_cache_limit (to identify that it is only for plans).
Sounds good to me
The bigger suggestion of changing to Configuration and the Cache struct should be in a separate Issue/PR I think, since it is probably expanding the scope of this one too much.
I don't think we are in a hurry and since you are introducing those I would prefer that it is included in this PR. Things that are out-of-scope imo should be things that exist already in the code and should be improved in some way. But the parameter plan_cache_limit is something introduced in this PR so it makes sense to me that this PR locates it as best it could. I'm pretty sure this will also simplify your code.
It is possible there is a reason I'm not seeing here that makes this change complicated somehow so feel free to merge if that's the case.
@garypen
Sorry, that was my mis-apprehension. I was trying to refer to the changes you had made to internal parameters yesterday.
I could add it as a configuration, but I slightly prefer a command line and I think it could be resolved in a later issue/PR.
I think there's a good discussion here which will keep to a later issue/PR, so I will merge this and preserve the discussion in issue
Describe the solution you'd like
A discussion about how to proceed.
Describe alternatives you've considered
Configuration vs Options
Additional context
N/A
Beta Was this translation helpful? Give feedback.
All reactions