Hystrix blown downgrade

Hystrix blown purpose

When the self-reliance of the service is unavailable, the service itself will not collapse. Micro prevent abnormal cascade service .

Bulkhead mode

Isolation of critical resources each workload or services, such as connection pooling, memory and CPU, hard disk. Each working unit has its own connection pool, memory, CPU.

Avoid using a single bulkhead services consumed all the resources, resulting in the failure of other service scene appears.
This mode is primarily by preventing a service by a cascading failure due to increase the flexibility of the system.

To our thinking: can be set for each request, a separate connection pool, configure the number of connections, do not affect other requests. Like a one waterproof compartment.

Avalanche

avalanche:

By the underlying service failure resulting in the phenomenon of cascading failures. It describes: provider unavailability consumer is unavailable, and the process gradually enlarge unavailable. Snowball, more and more services are unavailable. Impact of worsening.

Avalanche three processes:

Service provider is unavailable

Retry cause network traffic to increase, but also affect the service provider.

A service call is unavailable, because the caller has been waiting to return to service until system resources.

Service unavailable reasons:

Server downtime

Network failure

Downtime

Program exception

Load is too large, resulting in slow response service provider

Cache breakdown resulting in service overloaded

Fault Tolerance

1, the network setting request timeout.
2, circuit breakers mode.

breaker

If you have a lot of time out (indicating that the service is not available), and then let the new request access to the service for a micro-service request does not make sense, it will only unnecessary consumption of resources. For example, set timeout 1s, in a short time if there are a large number of requests not respond within 1s, there is no need to depend on requests of the service.

  1. Breaker is easily lead to erroneous operation of the agency . Such agents can count the number of failures over time, and the decision is dependent on the normal request service or direct return based on the number of times.

  2. Breakers can fail fast , if it detects many similar error (timeout) for a period of time, it will after a period of time, forcing calls to the service fast failure, that is no longer requesting the service call. For such consumers no longer need to waste CPU to wait a long time out.

  3. Circuit breaker can automatically diagnose dependent service is back to normal . If found to be dependent service has returned to normal, it will resume request the service. The reset time is determined by re-closing the circuit breaker.

    This realization of the "self-healing" Micro services: When the dependent services are not available, open the circuit breaker, so fast service failed to prevent avalanches. When the dependent services back to normal and restore requests.

Breaker status

Closed state: Under normal circumstances, the circuit breaker is closed, the normal request
open state: When a certain time, the number of failures reaches a certain threshold, the circuit breaker to open. Service requests are not going to ask dependent services. It returns to the caller directly. The real call does not occur. After the reset time, into the semi-open mode.
Half-open state: open the circuit breaker after a period of time, automatically enter the "semi-open mode" at this time, the circuit breaker to allow access to a service request dependent services. If this request is successful (success or reach a certain percentage), then turn off the circuit breaker to restore normal access. Otherwise, it continues to remain open.

Hystrix

Hystrix implement a timeout mechanism and circuit breakers mode.

  1. Provide protection for the system. When dependent services high latency or failure to provide protection and control systems.
  2. Prevent avalanches.
  3. Wrapping request: Use HystrixCommand (or HystrixObservableCommand) dependence of the call logic package, each command run in a separate thread.
  4. Trip Mechanism: When a service failure rate reaches a certain threshold, MAMMALIA, can automatically trip, the service stop request period.
  5. Resource isolation: Hystrix for each request are dependent maintains a small thread pool, if the thread pool is full, sent to the dependent request is rejected immediately, instead of waiting in line, thus speeding up the failure determination. Prevent cascading failures.
  6. Rapid-Fail: Fail Fast. At the same time be able to quickly recover. :( focus is not really requesting service, abnormal return), but directly to fail.
  7. Monitoring: Hystrix can run real-time monitoring metrics and configuration changes, providing near real-time monitoring, alarm, operation and maintenance control.
  8. Fallback mechanism: fallback, when the request fails, the timeout, rejected, or when the circuit breaker is open, a rollback logic. Our custom fallback logic, provide elegant service degradation.
  9. Self-Healing: After opening the circuit breaker for some time, will automatically enter the "half-open" state, can be opened, closed, half-open state of the conversion.
Published 25 original articles · won praise 0 · Views 570

Guess you like

Origin blog.csdn.net/RaymondCoder/article/details/105233339