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

What is the operation process of Hystrix?

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how the Hystrix operation process is, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Hystrix operation flow

In the previous example, when you use Hystrix, you only create commands and execute them, which seems simple, but in fact, Hystrix has a set of complex execution logic. In order to give you a general understanding of the execution process, the author simplifies the whole process. The operation flow of Hystrix is shown in figure 6-3.

Figure 6-3 operational flow chart of Hystrix

Briefly explain the operation process:

The first step: when the command starts to execute, some preparatory work will be done, such as creating a corresponding thread pool for the command (described in later chapters).

Step 2: determine whether the cache is turned on. If the cache is turned on, the cache is looked up directly and the result is returned.

Step 3: determine whether the circuit breaker is open, if it is open, it means that the link is not available, and directly execute the fallback method. Combined with the example at the beginning of this chapter, it can be understood that the "basic service" module is not available, and the "service A" module directly performs a fallback in response to user requests.

Step 4: determine conditions such as thread pools, semaphores (counters), such as thread pool overload, then execute the fallback method, otherwise, execute the contents of the command (such as invoking the service in the previous example).

Step 5: execute the command to calculate whether to deal with the circuit breaker. After the completion of the execution, if certain conditions are met, the circuit breaker needs to be opened. If the execution is successful, the result is returned, otherwise, a fallback is performed.

The most important point of the whole process is whether the circuit breaker is turned on or not, which will be explained later. When our client uses Hystrix, it ostensibly creates a command to execute, but in fact Hystrix has added several layers of protection to the client.

The flow chart in figure 6-3 gives the simplest description of the operation process of Hystrix. For some of the details, the reader can have a general understanding of the operation process, which will be described in detail in the following chapters.

Thank you for reading this article carefully. I hope the article "what is the operation process of Hystrix" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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