Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ali middleware open source components: official release of Sentinel 0.2.0

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Sentinel is a lightweight flow control component open source by Ali middleware team and oriented to distributed service architecture. It mainly takes flow as a starting point and helps users protect the stability of services from many dimensions such as flow control, circuit breaker degradation, system load protection and so on.

Related reading: Alibaba announces that Sentinel is open source, further improving Dubbo ecology (with PPT)

Recently, Sentinel 0.2.0 was officially released. As an important milestone version, Sentinel 0.2.0 releases a number of new product features, such as asynchronous call support, hot parameter current limitation, etc., and includes a large number of experience optimization and bug fixes. Let's take a look at the important new features of Sentinel 0.2.0.

Asynchronous call support

In the future, various RPC frameworks and Web frameworks will develop towards the goal of asynchronization, such as Spring WebFlux, Vert.x, asynchronous Servlet, Netty services, and so on. The development direction of the whole Java is also evolving towards asynchronism and responsiveness, whether it is CompletableFuture, Reactive Streams or the later Project Loom protocol, so supporting asynchronous invocation is one of the important iterative contents of all kinds of open source components.

After introducing the support of asynchronous call link, Sentinel 0.2.0 can easily count the data of asynchronous call resources, maintain the asynchronous call link, and have the ability to adapt to asynchronous framework / library. Asynchronous invocation resource access is similar to normal resource access, except that asynchronous invocation of resource exit is usually done in an asynchronous callback. At the same time, Sentinel also supports nesting of asynchronous calls (such as nesting a normal resource call or another asynchronous resource call in an asynchronous callback). Only with the help of the context switching function provided by Sentinel and the Context transformation in the corresponding place, the correct calling link relationship can be maintained.

Hot spot parameter current limit

Hot spots are frequently accessed data. In many cases, we want to count the most frequently accessed Top K data in a hot spot data and restrict its access. For example:

ID as a parameter, count and limit the ID of the most frequently purchased goods over a period of time.

User ID is a parameter that limits the ID of users who visit frequently over a period of time.

At this time, you can use the hot spot parameter current limit function of Sentinel. Hot spot parameter current limit will count the hot spot parameters in the incoming parameters, and limit the flow of resource calls containing hot spot parameters according to the configured current limiting threshold and mode. The current limit of hot spot parameters can be regarded as a special kind of flow control, which is effective only for resource calls that contain hot spot parameters. Sentinel uses LRU strategy, combined with the underlying sliding window mechanism to achieve hot spot parameter statistics. The LRU policy can count the most frequently visited hot spot parameters per unit time, and the sliding window mechanism can help to count the QPS of each parameter.

In addition, Sentinel also supports the configuration parameter current limit exception, which can specify a separate current limit threshold for a specific value. To use the current limit function of hot spot parameters, you only need to introduce the corresponding dependency, configure the current limiting rules of hot spot parameters for the corresponding resources, and pass the corresponding parameters in entry to make the current limit of hot spot parameters effective.

Blacklist and whitelist control

In many cases, we need to determine whether the resource is allowed to be accessed based on the caller's information. For example, Service An only allows requests from appA and appB callers, while Service B does not allow requests from appC callers. In this case, you can use Sentinel's blacklist and whitelist control feature.

The blacklist and whitelist restricts whether the resource is passed according to the request source (origin) of the resource. If the whitelist is configured, it can only be passed if the request source is in the whitelist; if the blacklist is configured, the request source is not approved when the request source is in the blacklist, and the rest of the requests are passed.

Slot Chain extension

Alibaba realizes various functions of Sentinel through a series of slot chain composed of slot, including building call chain, call data statistics, rule checking and so on. The order between the slot is very important. Sentinel 0.2.0 extends SlotChainBuilder as a SPI interface, which makes SlotChain have the ability to extend. In this way, users can add custom slot and arrange the order between slot, thus adding custom functions to Sentinel.

Dynamic rule data source reconstruction

Sentinel's dynamic rule data source is used to read and write rules from it. Sentinel 0.2.0 reconstructs the dynamic rule data source (DataSource), dividing the dynamic rule data source into two types: read data source (ReadableDataSource) and write data source (WritableDataSource), thus making the responsibilities of different types of data sources clearer:

The read data source is only responsible for listening or polling for remote storage changes.

The write data source is only responsible for writing rule changes to the rule source.

In the actual scenario, different storage types correspond to different data source types. You can refer to the previous article "using the Sentinel console in a production environment". Writes are generally not supported for push schema data sources, while pull schema data sources are writable. Sentinel 0.2.0 provides an implementation of local file writing data sources.

Other important features

Sentinel 0.2.0 also includes the following features and improvements:

Add Redis dynamic data source adaptation

Sentinel Dubbo Adapter supports statistics of more kinds of exceptions

Sentinel Dashboard provides an interface for monitoring data persistence, which developers can extend to achieve monitoring data persistence.

Sentinel Web Servlet Filter supports the extraction of source information from HTTP requests (origin)

Offline sharing trailer:

Zhao Yihao (Su he) was invited to attend the 2018 China Open Source Annual meeting COSCon'18 held in Shenzhen on October 20-21, and shared the theme "from getting started to mastering Sentinel". Welcome to the scene to communicate with Brother Su he.

Cdn.com/9682ea46fde3bf3473a7cd4997f431b1f938cc67.png ">

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report