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

边栏推荐
- Error reporting injection of SQL injection
- Free get | full function version of version control software
- 跨境电商测评自养号团队应该怎么做?
- Twitter data collection (content, fans, keywords, etc.)
- Super (subclass)__ init__ And parent class__ init__ ()
- Quartz2d drawing technology
- FPGA Design -- ping pong operation implementation and Modelsim simulation
- Global case | how an airline with a history of 100 years can expand and transform to promote innovation in the aviation industry
- Goodbye 2021 Hello 2022
- Topic collection of FIFO minimum depth calculation
猜你喜欢

亚马逊、速卖通、Lazada、虾皮平台在用911+VM的环境可以进行产号、养号、补单等操作吗?

A collection of problems on improving working frequency and reducing power consumption in FPGA design

FPGA interview notes (II) -- synchronous asynchronous D flip-flop, static and dynamic timing analysis, frequency division design, retiming

Shandong University machine learning experiment 7 pca+ SVM face recognition

Sqoop installation tutorial

Login and registration based on servlet, JSP and MySQL

Summarize the five most common BlockingQueue features

C language war "minesweeping"

不同VLAN间的通信

Free get | full function version of version control software
随机推荐
Continuous update of ansible learning
FIFO最小深度计算的题目合集
Sword finger offer 50: the first character that appears only once
Global case | how an airline with a history of 100 years can expand and transform to promote innovation in the aviation industry
Delegation agreement, data source agreement and advanced view in view
Simple understanding of pseudo elements before and after
Build the first power cloud platform
The meaning in the status column displayed by PS aux command
Ethical discussion on reptile Technology
11. Gesture recognition
jenkins-用户权限管理
Pycharm usage experience
Principle of copyonwritearraylist copy on write
Cocoatouch framework and building application interface
CCS安装编译器的方法
Can Amazon, express, lazada and shrimp skin platforms use the 911+vm environment to carry out production number, maintenance number, supplement order and other operations?
FPGA面试题目笔记(一)——FPGA开发流程、亚稳态和竞争冒险、建立保持时间、异步FIFO深度等
Chapter 2 of machine learning [series] logistic regression model
The classification effect of converting video classification data set to picture classification data set on vgg16
Convert multiple pictures into one NPY file storage