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

边栏推荐
- EasyGBS接入的设备视频直播突然全部无法播放是为什么?数据库读写不够
- Delegation agreement, data source agreement and advanced view in view
- Completabilefuture asynchronous task choreography usage and explanation
- Docker installation of MySQL and redis
- FPGA interview topic notes (I) - FPGA development process, metastable state and competitive risk, build and hold time, asynchronous FIFO depth, etc
- Simple understanding of XML and JSON
- Shandong University machine learning experiment VI k-means
- LeetCodeT526
- Print sparse arrays and restore
- 箭头函数的this指向
猜你喜欢

Eureka cluster setup

jenkins-用户权限管理

What do you need to know about Amazon evaluation?

Login and registration based on servlet, JSP and MySQL

Servlet

C language war "minesweeping"

autojs,读取一行删除一行,停止自己外的脚本

Detailed installation instructions for MySQL

Goodbye 2021 Hello 2022

Make a small game with R language and only basic package
随机推荐
JIRA software annual summary: release of 12 important functions
Sword finger offer 50: the first character that appears only once
Don't be afraid of xxE vulnerabilities: understand their ferocity and detection methods
Examinelistactivity of Shandong University project training
Markdown + typora + picgo experimental report template attached
Sqoop installation tutorial
ThymeleafEngine模板引擎
Sword finger offer 04: find in 2D array
跨境电商测评自养号团队应该怎么做?
Eureka cluster setup
Basic use of BufferedReader and bufferedwriter
Graphsage paper reading
ERROR 1215 (HY000): Cannot add foreign key constraint
Servlet
The artistic director and production designer of Disney's Mandalorian revealed the virtual scene production behind it
FPGA面试题目笔记(一)——FPGA开发流程、亚稳态和竞争冒险、建立保持时间、异步FIFO深度等
CCF 2013 12-5 I‘m stuck
Shandong University machine learning experiment 7 pca+ SVM face recognition
Warmly celebrate that yeyanxiu, senior consultant of Longzhi, won the title of "atlassian Certified Expert"
All questions and answers of database SQL practice niuke.com