当前位置:网站首页>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:11. Container with the most water [double pointer + greed + remove the shortest board]
- Nous avons fait une plateforme intelligente de règlement de détail
- “google is not defined” when using Google Maps V3 in Firefox remotely
- Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext
- Getting started with JDBC
- 235. 二叉搜索树的最近公共祖先【lca模板 + 找路径相同】
- cipher
- 【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁
- [leetcode] [SQL] notes
- Webrtc[41] - Analysis of the establishment process of webrtc transmission channel
猜你喜欢
EGO Planner代码解析bspline_optimizer部分(3)
[free sharing] kotalog diary2022 plan electronic manual ledger
How to build an efficient information warehouse
KINGS
SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
my. INI file not found
leetcode:11. 盛最多水的容器【雙指針 + 貪心 + 去除最短板】
[mathematical modeling] ship three degree of freedom MMG model based on MATLAB [including Matlab source code 1925]
【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】
application
随机推荐
[water quality prediction] water quality prediction based on MATLAB Fuzzy Neural Network [including Matlab source code 1923]
Typescript configuration
Using the visualization results, click to appear the corresponding sentence
cipher
[leetcode] [SQL] notes
Web Security (VII) specific process of authentication with session cookie scheme
Day18 - basis of interface testing
Verilog HDL continuous assignment statement, process assignment statement, process continuous assignment statement
Does SQL always report foreign key errors when creating tables?
[wallpaper] (commercially available) 70 wallpaper HD free
OSPF - detailed explanation of stub area and full stub area
leetcode:11. 盛最多水的容器【雙指針 + 貪心 + 去除最短板】
Add control at the top of compose lazycolumn
Web3 credential network project galaxy is better than nym?
235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁
Work Measurement - 1
Why should we do feature normalization / standardization?
[optics] vortex generation based on MATLAB [including Matlab source code 1927]
Record: install MySQL on ubuntu18.04