springboot集成Sentinel「流控入门」

470 阅读1分钟

流量控制(flow control),其原理是监控应用流量的 QPS 或并发线程数等指标,当达到指定的阈值时对流量进行控制,以避免被瞬时的流量高峰冲垮,从而保障应用的高可用性。

基于 springboot集成Sentinel「入门」搭建的 springboot-sentinel-client-a 工程 ,来体验一下Sentinel 的流量控制的效果。

参考 springboot集成Sentinel「入门」启动 Sentinel 服务端与 springboot-sentinel-client-a 测试客户端。

访问:localhost:8080

访问了6次:http://localhost:8001/springboot-sentinel-client-a/test/1

下面配置流控规则

设置QPS单机阈值为:1(表示1秒钟只能访问1次)。

下面连续访问 http://localhost:8001/springboot-sentinel-client-a/test/1 测试效果

springboot集成Sentinel DEMO: gitee.com/renxiaoshi/…