Purpose of current limiting/fusing

  • After microservitization, the system is distributed and communicates with each other through RPC framework. The probability of failure of the whole system increases with the increase of the system scale. A small fault may cause a bigger fault through link conduction.
  • When the business system invokes the service, it chooses to make the most of the influence caused by the spoof shielding when some non-critical path services are degraded.

Service traffic limiting and fusing requirements

  • Most fuses return the default value (NULL), can also be customized, RPC client native support is best, the business side less code change.
  • When entering the circuit breaker, it prints the circuit breaker log and returns Exception (the business customized the circuit breaker method).
  • The service management platform can see the state of the service, whether degraded, whether fusing, can real-time issue threshold configuration, can alarm, and had better add abnormal information
  • Determination of caller granularity, interface granularity.

The industry solution

  • Netflex OSS Hystrix

    • Write Hystrix command manually or have maven plugin generate command, return null in fall back method.
    • Services are highly intrusive.
    • Add the jar package
      • Introduce the Hystrix JAR package as an additional
      • Into the RPC framework
    • The platform
      • Cost of client direct reference and restart
      • Needs to be a service governance platform (not a JAR package, otherwise the caller needs to pay attention to the JAR package version)
  • Elegant scheme

    • RPC Client(implemented here) + service governance platform (where specific policies are configured to realize the fusing of some functions, as shown below)

      • Realize fusing based on RPC Client
      • The RPC Client modiizes the created proxy and determines whether to disable the proxy based on local calculation statistics in the PRXY
      • The service governance platform stores degraded configurations and provides visualization of reported data, alarms, and push-down of configuration changes

The interaction process

Custom fallback

  • Convention the class name of fallback

    • In the form of notes
  • The convention method is added

    The fallbackCommand annotation is valid (unannotated methods are not fallback methods).

implementation

Hystrix solution reference