What Is the golang-based Sentinel?
As distributed systems are becoming increasingly popular, the reliability between services is becoming more important than ever before. Sentinel is a powerful fault-tolerance component that takes “flow” as the breakthrough point and covers multiple fields including flow control, traffic shaping, concurrency limiting, circuit breaking, and adaptive system protection to guarantee the reliability and resiliency of microservices.
- 2012, Sentinel was born in Alibaba with the main purpose of flow control.
- 2013-2017, Sentinel grew fast and became a fundamental component for all microservices in Alibaba. It was used in more than 6000 services and covers almost all core e-commerce scenarios.
- 2018, Sentinel evolves into an open-source project.
- 2020, Sentinel Golang was released.
Resource is a key concept in Sentinel. It could be anything, such as a service, a method, or even any code snippet.
Once it is wrapped by Sentinel API, it is defined as a resource. Sentinel will record its real-time metrics and perform rule checking.
Sentinel protects resources by rules, such as flow control, concurrency control, and circuit breaking rules. Rules can be dynamically updated, and take effect in real-time.
Sentinel provides the ability to handle random incoming requests according to the appropriate shape as needed, as illustrated above
Flow control is based on the following statistics:
- Invocation chain between resources;
- Runtime metrics such as QPS, response time and system load;
- Desired actions to take, such as reject immediately or queueing.
Sentinel allows applications to combine all these statistics in a flexible manner.
Circuit breaking is used to detect failures and encapsulates the logic of preventing failure from constantly reoccurring during maintenance, temporary external system failure or unexpected system difficulties.
Sentinel leverages the following principles to prevent your services from cascade failure:
- Concurrency control
- Circuit breaking by slow requests or error ratio
Sentinel can be used to protect your services in case the system load or CPU usage goes too high. It helps you to achieve a good balance between system load and incoming requests with Golang Jobs.