Sentinel 是面向分布式、多语言异构化服务架构的流量治理组件,主要以流量为切入点,从流量路由、流量控制、流量整形、熔断降级、系统自适应过载保护、热点流量防护等多个维度来帮助开发者保障微服务的稳定性。

Springboot+Dubbo+Nacos 集成 Sentinel(入门)-CSDN博客

1.系统规则介绍

系统保护规则是从应用级别的入口流量进行控制,从单台机器的总体 Load、RT、线程数、入口 QPS 和CPU使用率监控应用数据,让系统尽可能跑在最大吞吐量的同时保证系统整体的稳定性。

系统保护规则是应用整体维度的,而不是资源维度的,并且仅对入口流量生效。入口流量指的是进入应用的流量(EntryType.IN),比如 Web 服务或 Dubbo 服务端接收的请求,都属于入口流量。

系统规则 (SystemRule)包含下面几个重要的属性:

Field 说明 默认值
highestSystemLoad Load触发值,用于触发自适应控制阶段 -1 (不生效)
avgRt 所有入口流量的平均响应时间 -1 (不生效)
maxThread 入口流量的最大并发数 -1 (不生效)
qps 所有入口资源的 QPS -1 (不生效)
highestCpuUsage 当前系统的 CPU 使用率(0.0-1.0) -1 (不生效)

2.规则持久化

Sentinel 规则持久化-CSDN博客

持久化Json数据格式

[
	{
		"highestSystemLoad": -1,
		"avgRt": -1,
		"maxThread": -1,
		"qps": 100,
		"highestCpuUsage": -1
	}
]
spring:
  application:
    name: user
  cloud:
    nacos:
      config:
        server-addr: 127.0.0.1:8848
        prefix: dubbo-user-api
        file-extension: yml
    sentinel:
      transport:
        dashboard: 127.0.0.1:6780
      eager: true # 取消懒加载
      datasource:
        ds-user-system-rule:
          nacos:
            server-addr: 127.0.0.1:8848
            dataId: user-system-rule
            groupId: user-sentinel
            namespace: sentinel
            rule-type: SYSTEM # AUTHORITY(授权规则) DEGRADE(熔断规则) FLOW(流控规则) GW_API_GROUP GW_FLOW PARAM_FLOW(热点规则) SYSTEM(系统规则)

GitHub 加速计划 / sentine / Sentinel
48
7
下载
alibaba/Sentinel: Sentinel 是阿里巴巴开源的一款面向分布式服务架构的流量控制、熔断降级组件,提供实时监控、限流、降级和系统保护功能,适用于微服务治理场景。
最近提交(Master分支:3 个月前 )
222670e6 * fix: Endpoint#toString host formatting; add Endpoint unit test * test: remove empty EndpointTest.java (fix accidental PR changes) --------- Signed-off-by: 赖尧 <yujitang_2006@qq.com> 11 天前
e7a9c560 * chore: remove node_modules from git & add to .gitignore * fix(docs): normalize README table style (MD060) across adapters and cluster modules * docs: fix compact table style in parameter flow README * docs: fix markdownlint MD009 and MD060 in README files * docs: fix table format in parameter-flow-control README (MD060/MD009) * docs: fix table format in spring-webmvc README files (MD060/MD009) * fix: restore UTF-8 encoding and fix markdownlint errors * fix: wrap remaining bare URLs with angle brackets (MD034) * fix: remove trailing spaces from table rows (MD009) --------- Signed-off-by: 赖尧 <yujitang_2006@qq.com> 15 天前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐