In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
How to analyze the Informer mechanism in K8s, I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Overview of Informer Mechanism Architecture Design
The following is a data flow diagram I have drawn based on my understanding to take a look at the overall trend of the data from a global perspective.
Where the dotted line represents the method in the code.
First of all, let's make a conclusion:
When the data is obtained through the Informer mechanism, all the Object of the corresponding Resource will be obtained from the Kubernetes API Server during initialization. Later, only the data pushed by the API Server will be received through the Watch mechanism, and the data will no longer be actively pulled from the API Server, and the data in the local cache will be used directly to reduce the pressure on the API Server.
The Watch mechanism is based on the Chunk implementation of HTTP and maintains a persistent connection, which is an optimization point to reduce the amount of data requested. The second optimization point is SharedInformer, which allows the same resource to use the same Informer, for example, when the v1 version of Deployment and the v1beta1 version of Deployment exist at the same time, share an Informer.
In the figure above, you can see that Informer is divided into three parts, which can be understood as three major logic.
Among them, Reflector mainly puts the data obtained from API Server data into the DeltaFIFO queue and acts as a producer.
SharedInformer mainly takes data from the DeltaFIFIO queue and distributes the data, acting as a consumer.
Finally, Indexer exists as a storage component of the local cache.
Reflector understanding
In Reflector, it is enough to mainly look at Run, ListAndWatch and watchHandler.
The source code location is tools/cache/reflector.go
/ / Ruvn starts a watch and handles watch events. Will restart the watch if it is closed.// Run will exit when stopCh is closed.// starts with Run, and the upper layer calls the Run method func (r * Reflector) Run (stopCh) in controller.go.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.