karmada icon indicating copy to clipboard operation
karmada copied to clipboard

Clarification on caching mechanism in search and proxy components

Open seanlaii opened this issue 1 year ago • 3 comments

Please provide an in-depth description of the question you have: In the current Karmada search component, there are two sub-components: search and proxy. Both sub-components cache the resources defined in the ResourceRegistry.

My question is: Do these two sub-components use the same cache, or do they maintain separate caches for storing data?

The reason I'm asking is that currently, both sub-components are controlled through the resource registry. I only want to use the proxy functionality to read pod logs, and I don't need to use the search/cache functionality to cache pods. If these two sub-components create separate caches, it could potentially lead to resource wastage.

From reviewing the source code, my current understanding is that the search component's cache is managed through the InformerManager, while the proxy component has a MultiClusterCache for managing its cache.

If possible, I would also appreciate an explanation of the differences between these two caching mechanisms (InformerManager vs MultiClusterCache) and their respective use cases.

Thank you for your clarification on this matter.

Environment:

  • Karmada version: 1.9

seanlaii avatar May 05 '24 22:05 seanlaii

My question is: Do these two sub-components use the same cache, or do they maintain separate caches for storing data?

They use two sets of caches.

For Search, the informer is directly used to build cache. For Proxy, it is equivalent to self-built cache. See proposal for reference: https://github.com/karmada-io/karmada/tree/master/docs/proposals/resource-aggregation-proxy

XiShanYongYe-Chang avatar May 06 '24 03:05 XiShanYongYe-Chang

You can disable the search capability by setting the component parameter disable-search.

XiShanYongYe-Chang avatar May 06 '24 03:05 XiShanYongYe-Chang

Got it. Thanks for the information!

seanlaii avatar May 07 '24 00:05 seanlaii