A Golang-based flow-control component enabling reliability and real-time monitoring for microservices


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.

History of Sentinel

  • 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.

Key Concepts

Resources

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.

Rules

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.

Features and Principles

Flow control and traffic shaping

Sentinel provides the ability to handle random incoming requests according to the appropriate shape as needed, as illustrated above

Principles of flow control

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 and concurrency control with Golang

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

Adaptive system protection

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.

How Sentinel works

image