# Alibaba Sentinel — Flow Control and Circuit Breaking for Distributed Systems > A guide to Sentinel, the flow control component for microservices that provides real-time traffic shaping, circuit breaking, and adaptive system protection. ## Install Save as a script file and run: # Alibaba Sentinel — Flow Control and Circuit Breaking for Distributed Systems ## Quick Use ```bash # Add Maven dependency to your Spring Boot project # com.alibaba.cloud:spring-cloud-starter-alibaba-sentinel # Download and start Sentinel Dashboard wget https://github.com/alibaba/Sentinel/releases/download/1.8.8/sentinel-dashboard-1.8.8.jar java -Dserver.port=8080 -jar sentinel-dashboard-1.8.8.jar # Configure your app to connect: spring.cloud.sentinel.transport.dashboard=localhost:8080 ``` ## Introduction Sentinel is a flow control and circuit-breaking library developed by Alibaba for protecting distributed service architectures. It provides real-time monitoring, traffic shaping, circuit breaking, and adaptive system protection to keep services stable under high load or partial failures. ## What Sentinel Does - Enforces flow control rules with QPS limiting, concurrency limiting, and traffic shaping - Provides circuit breaking based on slow request ratio, error ratio, or error count thresholds - Offers adaptive system protection that adjusts limits based on CPU, load, and inbound QPS - Delivers a real-time monitoring dashboard showing per-resource metrics and rule configuration - Supports hot parameter flow control to limit traffic on specific argument values ## Architecture Overview Sentinel operates as an in-process library that wraps protected resources (methods, URLs, RPC calls) with slot chains. Each slot chain includes a statistics slot for metrics collection, a flow control slot for rate limiting, a degrade slot for circuit breaking, and a system protection slot. The Dashboard is a separate Spring Boot application that collects metrics from Sentinel clients via HTTP and allows dynamic rule configuration pushed to clients in real time. ## Self-Hosting & Configuration - Add the Sentinel core dependency or Spring Cloud Alibaba Sentinel starter to your project - Deploy the Sentinel Dashboard JAR for visual rule management and monitoring - Configure transport settings so your application registers with the dashboard - Define flow rules, degrade rules, and system rules via the dashboard UI or programmatically - Persist rules to Nacos, ZooKeeper, or Apollo for durability across restarts ## Key Features - Millisecond-level flow control with QPS, thread count, and warm-up rate-limiting strategies - Circuit breaker with half-open recovery and configurable slow-call and error-ratio thresholds - Real-time dashboard with per-second metrics, topology graphs, and one-click rule creation - Seamless integration with Spring Cloud, Dubbo, gRPC, Servlet, and reactive frameworks - Cluster flow control mode for global rate limiting across multiple service instances ## Comparison with Similar Tools - **Resilience4j** — Lightweight Java circuit breaker; Sentinel adds flow control, system protection, and a monitoring dashboard - **Hystrix** — Netflix circuit breaker (archived); Sentinel is actively maintained with more protection strategies - **Envoy rate limiting** — Sidecar-based; Sentinel operates in-process with lower latency and richer Java integration - **Spring Cloud Circuit Breaker** — Abstraction layer; Sentinel is a concrete implementation with its own dashboard - **Polly (.NET)** — .NET resilience library; Sentinel is JVM-native with cluster-wide flow control capabilities ## FAQ **Q: How does Sentinel differ from Hystrix?** A: Sentinel provides flow control, system protection, and a real-time dashboard in addition to circuit breaking. Hystrix is archived and limited to circuit breaking and bulkheading. **Q: Can Sentinel persist rules across restarts?** A: Yes. Configure a dynamic rule source like Nacos, ZooKeeper, or Apollo. Without persistence, rules are lost on restart. **Q: Does Sentinel work with non-Spring applications?** A: Yes. Sentinel core is framework-agnostic. You can use it with raw Java, Dubbo, Servlet filters, or any JVM application. **Q: What is the performance overhead of Sentinel?** A: Sentinel uses efficient sliding window statistics. Overhead is typically under 1ms per resource invocation in benchmarks. ## Sources - https://github.com/alibaba/Sentinel - https://sentinelguard.io/en-us/ --- Source: https://tokrepo.com/en/workflows/2ec8d655-3d7d-11f1-9bc6-00163e2b0d79 Author: Script Depot