当前位置:网站首页>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

边栏推荐
- Free hand account sharing in September - [cream Nebula]
- “google is not defined” when using Google Maps V3 in Firefox remotely
- leetcode:11. Container with the most water [double pointer + greed + remove the shortest board]
- [new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
- 利用可视化结果,点击出现对应的句子
- [disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]
- OSPF - detailed explanation of stub area and full stub area
- How to design a high concurrency system
- HOW TO WRITE A DAILY LAB NOTE?
- How to read the source code [debug and observe the source code]
猜你喜欢
![[new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)](/img/4e/a51365bb88b1fc29d1c77fcdde5350.jpg)
[new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)

22.2.14 -- station B login with code -for circular list form - 'no attribute' - 'needs to be in path selenium screenshot deviation -crop clipping error -bytesio(), etc

Using the visualization results, click to appear the corresponding sentence

What does a really excellent CTO look like in my eyes

Zhengda futures news: soaring oil prices may continue to push up global inflation

User identity used by startup script and login script in group policy

If the warehouse management communication is not in place, what problems will occur?

FBI警告:有人利用AI换脸冒充他人身份进行远程面试

Flutter network and data storage framework construction-b1

组策略中开机脚本与登录脚本所使用的用户身份
随机推荐
C enum contains value - C enum contains value
[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]
Zhengda futures news: soaring oil prices may continue to push up global inflation
Max of PHP FPM_ Some misunderstandings of children
【光学】基于matlab涡旋光产生【含Matlab源码 1927期】
01. Preparation for automated office (free guidance, only three steps)
Why should we do feature normalization / standardization?
Think of new ways
SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
SQL injection for Web Security (1)
Flutter网络和数据存储框架搭建 -b1
Summary of composition materials for 2020 high-frequency examination center of educational resources
Record: MySQL changes the time zone
Web3 credential network project galaxy is better than nym?
變化是永恒的主題
Failed to start component [StandardEngine[Catalina]. StandardHost[localhost]. StandardContext
Add control at the top of compose lazycolumn
Free sharing | linefriends hand account inner page | horizontal grid | not for sale
PyTorch中在反向传播前为什么要手动将梯度清零?
【疾病识别】基于matlab GUI机器视觉肺癌检测系统【含Matlab源码 1922期】