Hello everyone, the structure ferry. This is my fourth original article, please support me.

Traffic limiting has always been a hot and old topic, but as a way to deal with high concurrency, traffic limiting has always been popular.

Previously, we briefly introduced the background of traffic limiting, the mainstream traffic limiting algorithms, and whether to choose self-developed or open source frameworks to implement the traffic limiting function. Relevant articles can be checked by referring to historical records.

Since the research of this road without a certain strength is really bad to go, most of the choice is estimated to be open source. So TODAY I will introduce a few with more limiting frame to everyone.

Guava

Guava comes with Ratelimiter for traffic limiting. This class implements traffic limiting based on the token bucket algorithm. However, Ratelimiter can only be used for traffic limiting in single-node scenarios. In general, single-node traffic limiting is sufficient.

If you want to use Guava to achieve single-machine flow limiting, or with the configuration center to use. The flow control can be dynamically adjusted through the configuration center for higher flexibility.

Source code address: github.com/google/guav…

Rating: 1 star

concuurency-limits

Concuurency-limits is an adaptive traffic limiting component introduced by Netflix. It borrowings from the TCP congestion control algorithm and dynamically adjusts the traffic limiting window according to the request delay and queue length directly affected.

It is not hard to see that Netflix has opened source a lot of useful frameworks, but it is difficult to maintain over the long term. However, many of the framework ideas are worth learning from.

For concuurency-limits, I don’t recommend it. It hasn’t been updated in a while. But the idea of Concuurency-limits, you have to learn. The ideal state of flow control is adaptive flow limiting, which can be discussed in a separate article.

Source code address: github.com/Netflix/con…

Rating: 1 star

Resilience4j

As we all know, Hystrix has announced that it will not be maintained, so Spring has officially recommended a new framework to replace Hystrix. This framework is Resilience4j.

Resilience4j is a lightweight fault-tolerant framework inspired by Netflix’s Hystrix framework and designed for functional programming.

Resilience4j is very powerful and supports many functions, as shown in the figure below:

You can see that there are many powerful features, such as fusing, limiting, caching, retry, etc.

Source code address: github.com/resilience4…

Recommendation: 4 stars

Sentinel

If I had to pick a current-limiting framework, it would be Sentinel. Sentinel was born in 2012 and has accumulated a lot of practical experience in flow production in Alibaba for 9 years. At present, the community is very active and many companies are using it. Currently, it has been updated to version 1.8.2, and the stability is no problem.

Sentinel is implemented by sliding window algorithm, which can support high concurrency scenarios with more writes than reads. In addition to single-node traffic limiting, it also supports cluster traffic limiting, which can fully meet the requirements of daily traffic control.

If you feel that their own maintenance is too much trouble, the commercial version is also available, to have what, is the cost of money.

Source code address: github.com/alibaba/sen…

Recommendation: 5 stars

conclusion

Finally, a summary! Sentinel is recommended as a flow control component. The reason is also said in front, not to say more. When in doubt, the best option is to go with the pack.

Hello everyone, I am a handsome man from ancient times: structure ferryman. I will put my martial arts secret all impart with you, feel useful please share to the friends around. Let’s do a triple. Thank you! In addition, I also recorded in B station “real order business, 100 million level data with your actual combat sub-database sub-table” actual combat course, remember to learn oh!