How to realize service degradation

I am thinking about a question: how to downgrade the service?

for example, there was an interface before, and an average was determined through the other three interfaces. Hypothetically, it doesn"t necessarily make sense. To get the location of the user, first request Amap, then request Baidu Map, and then request Tencent Map. After comparing the last three data results, a comprehensive result is returned to the client.

then after downgrading, you only need to request an interface or simply do not request, and return the last cached data directly to the user.

but in general, for example, a request to check DB, how is it degraded?

it has been said in previous books that multiple interface weights are defined, such as the following:

  1. quite important
  2. important
  3. General
  4. Yes or no

in this way, when the server is under load, level 4-> level 3.

can be discarded first.

but how can it be overloaded? at the same time, what should the rules of abandonment look like?

or the client is degraded, that is, the client counts the requests and normal responses of each interface. When a large number of 500 is returned, it means that the server load is high, and a large number of requests should be avoided. The client directly tells the user that it has failed without requesting the server

the rule seems to be: for a period of time:

canRequest = requestCount - N * responseCount > 0

that is, when requestCount is normally requested, but only responseCount succeeds, all others fail.

is there any way to play like this?

can anyone give a specific example of a production environment

Mar.03,2021

can provide an idea. An available service list, a service list, only gets services from the top of the available service list at a time. Here, you can sort the weight according to different rules, abnormal service list, you can open a thread to detect the recovery. If it is judged that it has been restored, move back to the normal service list ~


there are many ways to downgrade. Your situation is suitable for fuse, you can use combined fuse

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8cc80-1108.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8cc80-1108.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?