当前位置:网站首页>What is sentinel produced by Ali?
What is sentinel produced by Ali?
2022-06-11 06:18:00 【Milo_】
Hello, Hello everyone , This is Milo , Let's take you to know about Sentinel, This article mainly introduces what is Sentinel And how we build it Sentinel Console , Prepare for the follow-up study ;
Sentinel brief introduction

Sentinel It's an open source project of Ali , Positioned as a highly available flow control component for distributed service-oriented architecture . The main pointcut is traffic , Slave flow control 、 Fusing the drop 、 System adaptive protection and other dimensions to help users ensure the stability of micro services .
Sentinel Introduce
With the popularity of microservices , Stability between services and services is becoming more and more important .Sentinel emerge as the times require .
Sentinel The history of
- 2012 year ,Sentinel Be born , The main function is inlet flow control .
- 2013-2017 year ,Sentinel It is developing rapidly within Alibaba group , Become the basic technology module , Covering all the core scenarios .Sentinel As a result, a large number of traffic consolidation scenarios and production practices have been accumulated .
- 2018 year ,Sentinel Open source , And continue to evolve .
- 2019 year ,Sentinel Explore the direction of multilingual expansion , Introduction C++ Native version , Also aim at Service Mesh The scene also came out Envoy Cluster traffic control support , To solve the problem Service Mesh The problem of multi language flow restriction under the framework .
- 2020 year , Introduction Sentinel Go edition , Continue to evolve towards cloud Nativity .
Sentinel Developer Introduction
Never forget the digger when drawing water , Thanks to these guys

Sentinel The main characteristics of

Sentinel In two parts :
- Core library (Java client ) Don't rely on any framework / library , Can run on all Java Runtime environment , At the same time Dubbo / Spring Cloud And other frameworks also have better support .
- Console (Dashboard) be based on Spring Boot Development , It can run directly after packing , No additional Tomcat Etc. Application containers .
Sentinel Basic concepts
resources
Resources are Sentinel Key concepts of . It can be Java Anything in the application , for example , Services provided by applications , Or services provided by other applications called by the application , It could even be a piece of code . In the next document , We all use resources to describe code blocks .
As long as through the Sentinel API Defined code , It's resources , It can be Sentinel Protect it . In most cases , You can use method signature ,URL, Even the service name identifies the resource as the resource name .
The rules
Rules around the real-time state of resources , It can include flow control rules 、 Fusing degradation rules and system protection rules . All rules can be adjusted dynamically and in real time .
Sentinel Function and design concept
flow control
Flow control is a common concept in network transmission , It is used to adjust the sending data of network packets . However , From the perspective of system stability , In terms of the speed of processing requests , There is also a lot of stress . Requests coming at any time are often random and uncontrollable , And the processing power of the system is limited . We need to control the flow according to the processing capacity of the system .Sentinel As a tuner , You can adjust random requests to the right shape as needed , As shown in the figure below :

Flow control has the following angles :
- Resource call relationship , For example, the call link of resources , The relationship between resources ;
- Operation index , for example QPS、 Thread pool 、 System load, etc ;
- The effect of control , For example, direct current limiting 、 Cold start 、 Line up, etc .
Sentinel The design concept is to let you freely choose the angle of control , And flexible combination , So as to achieve the desired effect .
Fusing the drop
What is a fuse demotion
In addition to flow control , Reducing unstable resources in the call link is also Sentinel One of my missions . Because of the complexity of the call relationship , If a resource in the call link is unstable , It will eventually cause requests to pile up . The question is the same as Hystrix The problem described in it is the same .

Sentinel and Hystrix The principles of are the same : When a resource in the call link is unstable , for example , Manifested as timeout, When the proportion of anomalies increases , Then limit the call of this resource , And let the request fail quickly , Avoid affecting other resources , Eventually, it's an avalanche effect .
The concept of design
In the means of restriction ,Sentinel and Hystrix In a completely different way .
Hystrix adopt Thread pool The way , To depend on ( In our concept, the corresponding resources ) It was isolated . The advantage of this is the most thorough isolation between resources . The disadvantage is that in addition to increasing the cost of thread switching , We also need to allocate the size of thread pool to each resource in advance .
Sentinel There are two approaches to this problem :
- Limit by the number of concurrent threads
Unlike resource pool isolation ,Sentinel By limiting the number of resource concurrent threads , To reduce the impact of unstable resources on other resources . In this way, there is no loss of thread switching , There is no need for you to pre allocate the size of the thread pool . When a resource is unstable , For example, the response time becomes longer , The direct impact on resources is the gradual accumulation of threads . When the number of threads has accumulated to a certain number on a specific resource , New requests for this resource will be rejected . The stacked threads do not start receiving requests until they have completed their tasks .
- Demote resources through response time
In addition to controlling the number of concurrent threads ,Sentinel You can also quickly degrade unstable resources through response time . When the response time of dependent resources is too long , All access to the resource will be directly denied , Do not restore until after the specified time window .
System load protection
Sentinel At the same time provide Adaptive protection capability of system dimension . Prevent avalanche , It's an important part of system protection . When the system load is high , If the request continues to enter , May cause system crash , Unable to respond . In a cluster environment , Network load balancing will forward the traffic that should be carried by this machine to other machines . If other machines are in an edge state at this time , This increased traffic will cause the machine to crash , Finally, the whole cluster is not available .
In response to this situation ,Sentinel The corresponding protection mechanism is provided , Make the system's inlet flow and the system's load reach a balance , Ensure that the system processes the most requests within its capabilities .
Sentinel How it works
Sentinel The main working mechanism is as follows :
- Provide adaptation or display for mainstream framework API, To define the resources that need to be protected , And provide facilities for real-time statistics of resources and call link analysis .
- According to the preset rules , Combined with real-time statistics of resources , Control the flow . meanwhile ,Sentinel Provide an open interface , It's convenient for you to define and change the rules .
- Sentinel Provide real-time monitoring system , Convenient for you to quickly understand the status of the current system .
Sentinel Console construction
1. First, we need to go to the official website to download jar package
https://github.com/alibaba/Sentinel/releases
2. open jar Package directory , And open the command line window

3. start-up
Be careful : start-up Sentinel Console need JDK Version is 1.8 And above .
java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.1.jarexplain
among
-Dserver.port=8080Is used to specify the Sentinel The console port is8080If you have already downloaded other versions jar package , Please send the command sentinel-dashboard-1.8.1.jar Replace it with yours jar Package name

4.sentinel.dashboard It's just one. springboot engineering , You can see that the project is already 8080 Port boot

5. Enter... In the browser url:localhost:8080 Then you can enter the main page .

6. After successful login, it is shown in the following figure

边栏推荐
- What should the cross-border e-commerce evaluation team do?
- This point of arrow function
- All the benefits of ci/cd, but greener
- Completabilefuture asynchronous task choreography usage and explanation
- Using Internet of things technology to accelerate digital transformation
- C language war "minesweeping"
- Moteur de modèle de moteur thymeleaf
- Build the first power cloud platform
- JIRA software annual summary: release of 12 important functions
- Super explanation
猜你喜欢

Convert multiple pictures into one NPY file storage

修复鼠标右键没有vscode快捷入口的问题

verilog实现双目摄像头图像数据采集并modelsim仿真,最终matlab进行图像显示

A multi classification model suitable for discrete value classification -- softmax regression

Sqli-libs post injection question 11-17 actual combat

Sqli-libs range 23-24 filtration and secondary injection practice

Devsecops in Agile Environment
![[must see for game development] 3-step configuration p4ignore + wonderful Q & A analysis (reprinted from user articles)](/img/4c/42933ac0fde18798ed74a23279c826.jpg)
[must see for game development] 3-step configuration p4ignore + wonderful Q & A analysis (reprinted from user articles)

Eureka集群搭建

Jenkins voucher management
随机推荐
The difference between call and apply and bind
Chapter 1 of machine learning [series] linear regression model
Servlet
go的fmt包使用和字符串的格式化
Observer mode (listener mode) + thread pool to realize asynchronous message sending
Use meshlab to sample the point cloud of CAD model and display it in PCL
Chapter 6 of machine learning [series] random forest model
Shuffleerror:error in shuffle in fetcher solution
Sqli-libs range 23-24 filtration and secondary injection practice
Detailed steps for installing mysql-5.6.16 64 bit green version
Dichotomy find template
Linux Installation redis
FPGA interview notes (III) -- implementation of handshake signal synchronization in cross clock domain, arbitrary frequency division, binary conversion, RAM memory, original code inversion and complem
FPGA面试题目笔记(四)—— 序列检测器、跨时钟域中的格雷码、乒乓操作、降低静动态损耗、定点化无损误差、恢复时间和移除时间
How to use perforce helix core with CI build server
Use of constructors
Simple understanding of pseudo elements before and after
Convert multiple pictures into one NPY file storage
C language war "minesweeping"
PHP processing tree and infinite processing