Comments (3)
Let's review the GetTemplateAsUnstructured
usages one by one:
- federate: It is only used to retrieve the GVK of the federated object. Could we just parse it as a
metav1.GroupVersionKind
there, or maybe just store the GVK in federated object labels? (Such a label would be useful for users anyway) - follower: Same as above, except we only need
metav1.GroupKind
- nsautoprop: Same as above, used to filter federated objects. (I even wanted to suggest using a filtered watch, but apparently it doesn't work well with shared informers)
- override (image overrider): this is the scope of resource interpreters, see below
- scheduler: We only need the metadata (labels/anotations). Allocating so many hashmaps for the nested objects is still wasteful.
- status/statusaggregator: Same as federate controller, only need
metav1.GroupVersionKind
- sync: OK, this is where we actually need a
map[string]any
in order to execute JSONPatch properly - util/pod: See resource interpreter below
- util/propagationstatus: This compares two JSON objects. Not sure if there are more efficient ways to do this. But this is only called from statusaggregator anyway.
For resource interpreter cases: If we support interpreter plugins written in Go, they'd better be deserialized into their native types. If we support interpreter plugins in some dynamic library or scripting language (WASM, Lua, etc, whatever), passing the object in JSON is probably the most efficient way to cross language boundaries. Allocating it into map[string]any
in advance does not seem to provide any notable benefit.
So given these use cases, the only reasonable use cases would be sync and statusaggregator, which most likely reconcile much less frequently than informer updates.
from kubeadmiral.
How often do we need to unmarshal the template? It saves the cost of deserializing them every time federated object is updated (especially status-only updates), and it reduces memory footprint. Any benchmarks to support the argument that late deserializations are more frequent than informer deserializations?
from kubeadmiral.
How often do we need to unmarshal the template? It saves the cost of deserializing them every time federated object is updated (especially status-only updates), and it reduces memory footprint. Any benchmarks to support this argument?
No benchmarks, but you do have a valid point.
Currently template
is accessed mainly via the GetTemplateAsUnstructured
method, which does the deserialization. My concern is mainly when the method is invoked multiple times during the reconcile loop, e.g. in event handler's FilterFunc
, UpdateFunc
, then in reconcile
, and potentially in downstream util methods. Ergonomics is an important factor too.
from kubeadmiral.
Related Issues (20)
- Clean up kubebuilder marker comments
- kubeadmiral can schedule no native k8s crd, like argo workflow or volcano job? HOT 3
- ClusterResourcesFit does not work because cannot get resourceQuest of object
- Accidental UT errors HOT 1
- cluster available resource is less than 0
- Support joining/unjoining member cluster via admiralctl command-line tool
- Provide proxy APIs for users to access member cluster resources
- Replace `pkg/client/generic` with dynamic client from `client-go` HOT 1
- `readyz` should reflect `InformerManager` and `FederatedInformerManager`'s cache sync status HOT 3
- Clean up unused functions in `pkg/util/naming`
- Investigate whether we can combine `pkg/util/collectedstatusadapters` and `pkg/util/fedobjectadapters`
- Organize the constants
- Webhook scheduler plugins should return reason when filtering out clusters HOT 1
- [Error] in installation: make local-up HOT 6
- Are we equipped to support Helm's deployment mode effectively?
- Need a webhook to constrain user input
- Can you provide relevant official technical documents, similar to Karmada? HOT 2
- Kubeadmiral support for versions higher than K8s v1.24 HOT 2
- difference with karmada HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubeadmiral.