Dubbo Service Governance (1) Downgrade

Online websites generally experience a sharp increase in server pressure, such as promotions in online malls. At this time, a common method is service downgrade. According to the current business situation and traffic, some services and pages are strategically downgraded, thereby alleviating server resources. Pressure to ensure the normal operation of core tasks, but also to ensure that some or even most customers get the correct response .

Service Degradation Implementation Policy

  • Page Denial of Service: The page prompts the service to be suspended due to busy service. Jump to a static page in varnish or nginx .
  • Service interface denial of service: pages without user-specific information can be accessed, indicating that the server is busy. Page content is also available in a cache ( Varnish ) or within a CDN .
  • Delayed persistence: The page access is as usual, but it involves record changes. It will prompt you to see the results later, record the data to the asynchronous queue or log , and execute it after the service is restored.
  • Random denial of service: The service interface randomly denies service, allowing the user to retry, which is rarely used at present. because of poor user experience.

Now let's talk about how to downgrade the dubbo service, there are two ways:

  • Downgrade by dynamic configuration  in dubbo-admin

     

 

      The parameters in the dynamic configuration can define the timeout period

      Here you can use the debug test to make the service time out, and soon the consumer will report an error

      The mock value here, there are two options for fault tolerance and shielding

      Mock (mock=force) :

 

mock=force:return+null 表示消费方对该服务的方法调用都直接返回 null 值,不发起远程调用。用来屏蔽不重要服务不可用时对调用方的影响

       The consumer directly returns null without calling the service remotely

      Fault tolerance (mock=fail)

 

 

还可以改为 mock=fail:return+null 表示消费方对该服务的方法调用在失败后,再返回 null 值,不抛异常。用来容忍不重要服务不稳定时对调用方的影响。

        Returns null if the call fails

 

 

  • Implemented by registering configuration
<dubbo:reference id="iUser" interface="com.dubbosample.iface.IUser"  timeout="1000" check="false" mock="return null">

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325041476&siteId=291194637