当前位置:网站首页>Sentinel source code analysis part I sentinel overview
Sentinel source code analysis part I sentinel overview
2022-07-03 19:12:00 【Age people】
List of articles
Architecture diagram
The whole source code part is based on the use of the production environment
- 1.1 Sentinel Contains console : Configure current limiting rules [ System rules , Authority, etc ]
- 1.2 The console pushes rules to the data source (zookeeper etc. ) to ground
- 1.3 User process installation sentinel Module monitor zk To configure
- 2.1 Request to enter and hand it over to sentinel-adapter Intercept each module
- 2.2 According to Adapter Analytic contextName structure context
- 2.3 according to contextName structure EntranceNode
- 2.4 Find resources ResourceWrapper Corresponding ProcessorSlotChain
- 2.5 ProcessorSlotChain Handle [ Statistics , Current limiting , Rule verification, etc ]
Object name | explain |
---|---|
EntranceNode | Entry node |
StatisticNode | Statistics node , It contains two sliding window structures of second level and minute level |
DefaultNode | Link nodes , It is used to count the data of a resource on the call link , Maintain the tree structure |
ClusterNode | Cluster link information |
Entry | every time Adapter Module resource calls will create a Entry, Trestle Structure [ Enter the first ]Entry1->Entry2->Entry3[ Exit first ], Contains the resource name 、curNode( Current statistics node ) When the call of information resources ends, you need entry.exit Restore call stack |
Context | Call link context , Maintaining the entry node ,Entry link ,curNode |
One context Maintenance request link Entry, Every entry Both contain node, Maintain the tree relationship between resources and the storage of flow limiting information
Schematic diagram of current limiting
- The whole working mechanism of current limiting is handled through the responsibility chain
- Each resource corresponds to a ProcessorSlotChain
- This work chain passes Spi Mechanism discovery , Users can customize the corresponding implementation , And pass @SpiOrder Orchestration priority
context And entry Relationship
- context Represents the current thread context
- Unlike cross process tracing , Here we do not consider cross thread and cross process processing
- Multiple resource calls in the same thread , Will form the entry chain ,context Hold the relevant chain
- context Is the thread dimension . but context The name of is resource ResourceWrapper dimension
context And node Relationship
- According to the resource name, it will build EntranceNode
- context Will hold EntranceNode
node Self relationship tree maintenance
- Call resource throttling multiple times in a thread , be node Form a tree structure
- entry Form a linked list stack [ First in, then out ] structure
See the relationship between the three from the dimension of request and resource
- x Axis indicates request , The thread of each request builds a context, but context Could be the same , Generally, it is the resource name
- Each creation context Will get or build from the cache entranceNode, The same resource name corresponds to the same Node
- node It will build a tree structure , Indicates current statistics node Tree structure current limiting information
That's why ProcessorSlotChain Instantiate by resource dimension , Instead of singleton mode
Because of the statistics Slot Statistics are based on resource dimensions , If singleton is used, the current limit statistics of all resources are in the same node
- Above picture Node The same color means the same object
Expansion point - Official schematic diagram
Expand a little bit node Class diagram
边栏推荐
- [leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult
- Add control at the top of compose lazycolumn
- Why should the gradient be manually cleared before back propagation in pytorch?
- Sqlalchemy - subquery in a where clause - Sqlalchemy - subquery in a where clause
- These problems should be paid attention to in the production of enterprise promotional videos
- 记录在模拟器中运行flutter时报的错
- This Chinese numpy quick look-up table is too easy!
- Smart wax therapy machine based on STM32 and smart cloud
- Dynamic planning -- expansion topics
- Free sharing | linefriends hand account inner page | horizontal grid | not for sale
猜你喜欢
我们做了一个智能零售结算平台
记录在模拟器中运行flutter时报的错
235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
Foundation of ActiveMQ
[wallpaper] (commercially available) 70 wallpaper HD free
Chisel tutorial - 06 Phased summary: implement an FIR filter (chisel implements 4-bit FIR filter and parameterized FIR filter)
Pan for in-depth understanding of the attention mechanism in CV
application
Record: pymysql is used in pycharm to connect to the database
Php based campus lost and found platform (automatic matching push)
随机推荐
平淡的生活里除了有扎破皮肤的刺,还有那些原本让你魂牵梦绕的诗与远方
Smart wax therapy machine based on STM32 and smart cloud
Briefly describe the quantitative analysis system of services
为什么要做特征的归一化/标准化?
Which do MySQL and Oracle learn?
[disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]
Nous avons fait une plateforme intelligente de règlement de détail
Sqlalchemy - subquery in a where clause - Sqlalchemy - subquery in a where clause
Think of new ways
C enum contains value - C enum contains value
【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】
Ego planner code parsing Bspline_ Optimizer section (1)
Today I am filled with emotion
math_ Taylor formula
Work Measurement - 1
Web Security (VII) specific process of authentication with session cookie scheme
Day_ 18 IO stream system
Valentine's Day - make an exclusive digital collection for your lover
Compose LazyColumn 顶部添加控件
Processing of user input parameters in shell script