Request detection method, system, device, electronic device and storage medium

By judging and processing the fault status of microservices, the problem of thread resource exhaustion caused by microservice faults is solved, and timely response to business requests and system stability are achieved.

CN116074185BActive Publication Date: 2024-10-29BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202310056109.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-18
Publication Date
2024-10-29
Estimated Expiration
2043-01-18

AI Technical Summary

Technical Problem

In microservice technology, when the microservice corresponding to the detection rule fails, the thread processing the business request is continuously called, causing thread resources to be exhausted, which may cause the business system to crash.

Method used

By receiving the business request, it is judged whether the microservice corresponding to each detection rule is in a fault state. If it is faulty, the preset detection result is obtained. Otherwise, the microservice is called to obtain the real detection result, and the detection result of the business request is determined based on the fault and the real detection result. Avoid continuous occupation of threads.

Benefits of technology

Respond to business requests in a timely manner to avoid exhaustion of thread resources and prevent business system crashes, and determine the fault status through the number of timeouts to achieve timely processing of microservice failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116074185B_ABST
    Figure CN116074185B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a request detection method, system, device, electronic device and storage medium, which relates to the field of microservice technology. The method includes: receiving a business request for a target business; for each detection rule corresponding to the target business, determining whether there is a microservice currently in a faulty state in the microservice corresponding to the detection rule; if so, obtaining the preset detection result corresponding to the detection rule; if not, calling the microservice corresponding to the detection rule, and determining the real detection result corresponding to the detection rule according to the call result returned by the corresponding microservice; based on the preset detection result of the detection rule of the microservice in a faulty state in the corresponding microservice, and the real detection results of other detection rules, the detection result of the business request is obtained. In this way, when the corresponding microservice has a fault, the detection result of the detection rule can be obtained in time, and the business request can be responded to in time to avoid the thread being invalidly occupied.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of microservice technology, and in particular to a request detection method, system, device, electronic device and storage medium. Background Art

[0002] With the development of microservice technology, more and more businesses rely on microservice implementation. For example, in the field of risk control, for a business, the business request for accessing the business can be detected based on multiple detection rules, and one detection rule can correspond to at least one microservice. For example, the detection rules corresponding to the login business may include: rules for detecting mobile phone numbers (which may be called first detection rules) and rules for detecting IP addresses (which may be called second detection rules). Accordingly, when a business request for a login business is received, the microservice corresponding to the first detection rule is called to detect the logged-in mobile phone number to obtain the corresponding detection result, and the microservice corresponding to the second detection rule is called to detect the logged-in IP address to obtain the corresponding detection result. Furthermore, the detection result of the business request can be obtained based on the detection results corresponding to the first detection rule and the second detection rule, so as to respond to the business request based on the detection result.

[0003] In the related art, if a microservice corresponding to a detection rule fails, the thread used to process the business request will continuously call the microservice, and the thread cannot be released in time, resulting in invalid thread occupation, which may lead to thread resource exhaustion and even cause the business system to crash. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a request detection method, system, device, electronic device and storage medium to promptly respond to business requests, avoid the thread used to process business requests from continuously calling microservices in a faulty state, avoid invalid thread occupation, and thus avoid thread resource exhaustion, thereby avoiding business system crashes. The specific technical solution is as follows:

[0005] In a first aspect of the implementation of the present application, a request detection method is first provided, the method comprising:

[0006] Receiving a business request for a target business;

[0007] For each detection rule corresponding to the target business, determine whether there is a microservice currently in a faulty state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method;

[0008] If yes, obtain the preset detection result corresponding to the detection rule;

[0009] If not, call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule based on the call result returned by the corresponding microservice;

[0010] Based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules, the detection result of the business request is obtained.

[0011] Optionally, the method further includes:

[0012] When the preset time is reached, the number of response timeouts of each microservice whose response timed out in the preset historical time period is obtained;

[0013] For each microservice with a response timeout within the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, it is determined that the microservice is in a fault state from the current moment;

[0014] For each detection rule corresponding to the target business, determining whether there is a microservice currently in a fault state among the microservices corresponding to the detection rule includes:

[0015] For each detection rule corresponding to the target business, determine whether there is a microservice corresponding to the detection rule among the currently determined microservices in a faulty state;

[0016] If so, it is determined that there is a microservice in a fault state among the microservices corresponding to the detection rule;

[0017] If not, it is determined that there is currently no microservice in a fault state among the microservices corresponding to the detection rule.

[0018] Optionally, for each microservice with a response timeout within the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, after determining that the microservice is in a fault state from the current moment, the method further includes:

[0019] For each microservice determined to be in a faulty state, when a first moment is reached, the microservice is determined to be in a non-faulty state; wherein the first moment is a moment corresponding to a preset expiration period extended backward from a moment when the microservice is determined to be in a faulty state.

[0020] Optionally, when the preset time is reached, obtaining the number of response timeouts of each microservice that has timed out in a preset historical time period includes:

[0021] When the preset time is reached, the microservice response log within the preset historical time period is obtained through the message queue corresponding to the business system to which the target business belongs; wherein the microservice response log includes the response timeout record of the microservice whose response timed out;

[0022] According to the response timeout record, the number of response timeouts of each microservice that has timed out in response within the preset historical time period is counted.

[0023] Optionally, the method further includes:

[0024] When the preset time is reached, the number of response timeouts of each microservice that has timed out in the preset historical time period is displayed.

[0025] Optionally, the method further includes:

[0026] When the preset time is reached, if there is a microservice whose response timeout number is greater than a preset threshold within the preset historical time period, an alarm message is sent.

[0027] Optionally, after obtaining the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the real detection results of other detection rules, the method further includes:

[0028] Based on the correspondence between the preset detection result set and the response operation set, determine the response operation corresponding to the detection result of the business request; wherein the detection result set includes multiple detection results corresponding to the business request; the response operation set includes multiple response operations for responding to the business request;

[0029] The service request is responded to according to the determined response operation.

[0030] In a second aspect of the implementation of the present application, there is also provided a request detection system, the request detection system comprising: a service node;

[0031] The service node is used to receive a service request for a target service;

[0032] For each detection rule corresponding to the target business, determine whether there is a microservice currently in a faulty state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method;

[0033] If yes, obtain the preset detection result corresponding to the detection rule;

[0034] If not, call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule based on the call result returned by the corresponding microservice;

[0035] Based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules, the detection result of the business request is obtained.

[0036] Optionally, the request detection system further includes: a downgraded node;

[0037] The downgrade node is used to obtain the number of response timeouts of each microservice that has timed out in a preset historical time period when a preset time is reached; for each microservice that has timed out in the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, determine that the microservice is in a fault state from the current time;

[0038] The service node is specifically used to determine, for each detection rule corresponding to the target service, whether there is a microservice corresponding to the detection rule among the microservices in a faulty state determined by the current downgrade node;

[0039] If so, it is determined that there is a microservice in a fault state among the microservices corresponding to the detection rule;

[0040] If not, it is determined that there is currently no microservice in a fault state among the microservices corresponding to the detection rule.

[0041] Optionally, the downgrade node is further used to, for each microservice that has timed out in response within the preset historical time period, determine that the microservice is in a faulty state from the current moment if the number of response timeouts of the microservice is greater than a preset threshold, and then, for each microservice determined to be in a faulty state, determine that the microservice is in a non-faulty state when a first moment is reached; wherein the first moment is a moment corresponding to a preset expiration period extended backward from the moment when the microservice is determined to be in a faulty state.

[0042] Optionally, the business node is further used to add a microservice response log in the first message queue corresponding to the business system to which the target business belongs; wherein the microservice response log includes a response timeout record of a microservice whose response timed out;

[0043] The downgrade node is specifically used to obtain the microservice response log within a preset historical time period from the first message queue when a preset time is reached; and according to the response timeout record in the obtained microservice response log, count the number of response timeouts of each microservice that has responded timed out within the preset historical time period.

[0044] Optionally, the system further comprises: a display node;

[0045] The downgrade node is further used to add the number of response timeouts of each microservice that has responded timed out within the preset historical time period to the second message queue corresponding to the business system to which the target business belongs when a preset time is reached;

[0046] The display node is used to obtain the number of response timeouts of each microservice with response timeout from the second message queue and display it.

[0047] Optionally, the downgrade node is further used to send an alarm message when a preset time is reached if there is a microservice whose response timeout number is greater than a preset threshold within the preset historical time period.

[0048] Optionally, the business node is further used to determine the response operation corresponding to the detection result of the business request based on the correspondence between a preset detection result set and a response operation set after obtaining the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules; wherein the detection result set includes multiple detection results corresponding to the business request; and the response operation set includes multiple response operations for responding to the business request;

[0049] The service request is responded to according to the determined response operation.

[0050] In a third aspect of the implementation of the present application, a request detection device is also provided, the device comprising:

[0051] A service request receiving module, used for receiving a service request for a target service;

[0052] A fault status judgment module is used to judge, for each detection rule corresponding to the target business, whether there is a microservice currently in a fault state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method; if yes, a preset detection result acquisition module is triggered; if no, a microservice call module is triggered;

[0053] The preset detection result acquisition module is used to obtain the preset detection result corresponding to the detection rule;

[0054] The microservice calling module is used to call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule according to the call result returned by the corresponding microservice;

[0055] The detection result determination module is used to obtain the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice that is in a fault state and the actual detection results of other detection rules.

[0056] Optionally, the device further comprises:

[0057] A response timeout number acquisition module is used to obtain the number of response timeouts of each microservice that has responded timed out within a preset historical time period when a preset time is reached;

[0058] A fault status determination module is used to determine, for each microservice with a response timeout in the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, that the microservice is in a fault state from the current moment;

[0059] The fault state judgment module is specifically used to judge, for each detection rule corresponding to the target business, whether there is a microservice corresponding to the detection rule in the currently determined microservices in the fault state; if so, trigger the first determination module; if not, trigger the second determination module;

[0060] The first determination module is used to determine whether there is a microservice in a fault state among the microservices corresponding to the detection rule;

[0061] The second determination module is used to determine that there is currently no microservice in a fault state among the microservices corresponding to the detection rule.

[0062] Optionally, the device further comprises:

[0063] The non-fault state determination module is used for, for each microservice with a response timeout within the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, after determining that the microservice is in a fault state from the current moment, for each microservice determined to be in a fault state, when a first moment is reached, determining that the microservice is in a non-fault state; wherein the first moment is a moment corresponding to a preset expiration time period extending backward from the moment when the microservice is determined to be in a fault state.

[0064] Optionally, the response timeout number acquisition module is specifically used to obtain the microservice response log within a preset historical time period through the message queue corresponding to the business system to which the target business belongs when a preset time is reached; wherein the microservice response log includes a response timeout record of the microservice with response timeout; according to the response timeout record, the number of response timeouts of each microservice with response timeout within the preset historical time period is counted.

[0065] Optionally, the device further comprises:

[0066] The display module is used to display the number of response timeouts of each microservice that has timed out in the preset historical time period when a preset time is reached.

[0067] Optionally, the device further comprises:

[0068] The alarm module is used to send an alarm message when a preset time is reached if there is a microservice whose response timeout number is greater than a preset threshold within the preset historical time period.

[0069] Optionally, the device further comprises:

[0070] A response operation determination module is used to determine the response operation corresponding to the detection result of the business request based on the preset detection result of the detection rule based on the presence of a microservice in a faulty state in the corresponding microservice and the actual detection results of other detection rules, after obtaining the detection result of the business request, based on the correspondence between the preset detection result set and the response operation set; wherein the detection result set includes multiple detection results corresponding to the business request; the response operation set includes multiple response operations for responding to the business request;

[0071] The service request response module is used to respond to the service request according to the determined response operation.

[0072] In a fourth aspect of the implementation of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0073] Memory, used to store computer programs;

[0074] The processor is used to implement any of the request detection methods described above when executing a program stored in the memory.

[0075] In another aspect of the implementation of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the request detection methods described above is implemented.

[0076] In another aspect of the implementation of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the request detection methods described above.

[0077] A request detection method, system, device, electronic device and storage medium provided in an embodiment of the present application receive a business request for a target business; for each detection rule corresponding to the target business, determine whether there is a microservice in a faulty state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect information carried in the business request; a detection rule includes the information to be detected and the detection method; if so, obtain a preset detection result corresponding to the detection rule; if not, call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule based on the call result returned by the corresponding microservice; obtain the detection result of the business request based on the preset detection result of the detection rule that there is a microservice in a faulty state among the corresponding microservices, and the actual detection results of other detection rules.

[0078] Based on the above processing, for each detection rule corresponding to the target business, when there is a microservice in a faulty state among the microservices corresponding to the detection rule, the preset detection result of the detection rule can be obtained, which means that the detection result of the detection rule can be obtained in time when the corresponding microservice is in a faulty state, and then, the business request can be responded to according to the detection result, that is, the business request can be responded to in time, and the thread processing the business request can be released in time to avoid the thread being invalidly occupied, and then, the thread resources can be avoided from being exhausted, which can also avoid the crash of the business system. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0080] Figure 1 A first flow chart of a request detection method provided in an embodiment of the present application;

[0081] Figure 2 A second flow chart of a request detection method provided in an embodiment of the present application;

[0082] Figure 3 A system collaboration swim lane diagram for request processing provided in an embodiment of the present application;

[0083] Figure 4 A third flow chart of a request detection method provided in an embodiment of the present application;

[0084] Figure 5 A schematic diagram of the structure of a fuse degradation system provided in an embodiment of the present application;

[0085] Figure 6 A schematic diagram of the structure of a request detection device provided in an embodiment of the present application;

[0086] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0087] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0088] With the development of microservice technology, more and more businesses rely on microservice implementation. In the field of risk control, for a business, business requests used to access the business can be detected based on multiple detection rules, and one detection rule can correspond to at least one microservice.

[0089] For example, the detection rules corresponding to the login service may include: rules for detecting mobile phone numbers (which may be referred to as first detection rules) and rules for detecting IP addresses (which may be referred to as second detection rules). Accordingly, when a service request for the login service is received, the microservice corresponding to the first detection rule is called to detect the logged-in mobile phone number to obtain the corresponding detection result, and the microservice corresponding to the second detection rule is called to detect the logged-in IP address to obtain the corresponding detection result. Furthermore, the detection result of the service request can be obtained based on the detection results corresponding to the first detection rule and the second detection rule, so as to respond to the service request based on the detection result.

[0090] In the related technology, if a microservice corresponding to a detection rule fails, the thread used to process the business request will continuously call the microservice, and the thread cannot be released in time, resulting in invalid thread occupation, which may lead to thread resource exhaustion and even cause the business system to crash.

[0091] In order to ensure the normal response to the service request and thus the normal operation of the service system, the embodiment of the present application provides a request detection method, which can be applied to an electronic device. For example, the electronic device can be a server, which can communicate with the client network, and accordingly, the server can receive the service request sent by the client and respond.

[0092] See also Figure 1 , Figure 1 A first flow chart of a request detection method provided in an embodiment of the present application, the method may include the following steps:

[0093] Step S101: receiving a service request for a target service.

[0094] Step S102: for each detection rule corresponding to the target business, determine whether there is a microservice currently in a fault state among the microservices corresponding to the detection rule. If yes, execute step S103; if no, execute step S104.

[0095] Each detection rule corresponding to the target service is used to detect information carried in the service request; a detection rule includes the information to be detected and the detection method.

[0096] Step S103: Obtain a preset detection result corresponding to the detection rule.

[0097] Step S104: calling the microservice corresponding to the detection rule, and determining the actual detection result corresponding to the detection rule according to the calling result returned by the corresponding microservice.

[0098] Step S105: Based on the preset detection results of the detection rules for the microservices in the corresponding microservices that are in a faulty state and the actual detection results of other detection rules, the detection results of the business request are obtained.

[0099] A request detection method provided in an embodiment of the present application can obtain a preset detection result of the detection rule for each detection rule corresponding to a target business when there is a microservice in a faulty state among the microservices corresponding to the detection rule. In other words, the detection result of the detection rule can be obtained in time when the corresponding microservice is in a faulty state, and then, the business request can be responded to according to the detection result. That is, the business request can be responded to in time, and the thread processing the business request can be released in time to avoid invalid occupation of the thread, and then, the thread resource exhaustion can be avoided, and the business system crash can be avoided.

[0100] For step S101, the target service can be the service currently requested by the client, that is, any service that the electronic device can provide. For example, the electronic device in the present application can provide a variety of different services. For example, for the scenario of online banking, the electronic device can provide services including user login, transfer and balance inquiry; for example, for the scenario of social platform, the electronic device can provide services including user login and adding friends.

[0101] When a user requests a target service on a client, the client may generate a service request for accessing the target service and send it to the electronic device, and the electronic device may process the service request.

[0102] For step S102, when the electronic device receives a service request for the target service, it can detect the received service request for the target service based on the detection rule corresponding to the target service to obtain the detection result of the service request. There can be multiple detection rules corresponding to the target service, and the multiple detection rules are used to detect different information carried in the service request of the target service, that is, to detect the service request of the target service from different dimensions. That is, for each detection rule corresponding to the target service, the microservice corresponding to the detection rule can be called to determine the detection result of the detection rule according to the call result returned by the corresponding microservice.

[0103] For any detection rule corresponding to the target business, if any microservice corresponding to the detection rule has a fault, it can be determined that the microservice is in a faulty state. For a faulty microservice, the related technology cannot obtain its call result in a timely and effective manner. Therefore, for a detection rule for a microservice in a faulty state among the corresponding microservices, it is also impossible to obtain the detection result of the detection rule by calling the corresponding microservice in a timely and effective manner. Furthermore, for such detection rules, in the embodiment of the present application, the detection result of such detection rules can be obtained according to step S103.

[0104] For any microservice, if the call result returned by the microservice is not received after the preset time period after calling the microservice, it can be determined that the microservice response timed out. The preset time period can be 5 milliseconds, or it can also be 10 milliseconds. For example, for any microservice, it can be determined whether the microservice has a fault based on the number of response timeouts of the microservice in the historical time period.

[0105] In one implementation, the request detection method may further include:

[0106] Step 1: When the preset time is reached, the number of response timeouts of each microservice that has timed out in a preset historical time period is obtained.

[0107] Step 2: For each microservice with response timeout within a preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, it is determined that the microservice is in a fault state from the current moment.

[0108] For each detection rule corresponding to the target business, determine whether there is a microservice currently in a fault state among the microservices corresponding to the detection rule, including:

[0109] Step 3: For each detection rule corresponding to the target business, determine whether there is a microservice corresponding to the detection rule among the currently determined microservices in a faulty state. If yes, execute step 4; if not, execute step 5.

[0110] Step 4: Determine whether there is a microservice in a fault state among the microservices corresponding to the detection rule.

[0111] Step 5: Determine that there is no microservice in a faulty state among the microservices corresponding to the detection rule.

[0112] The preset time may be a periodic time.

[0113] In an embodiment of the present application, when a preset moment is reached, the electronic device may obtain the number of response timeouts of each microservice that has timed out in a preset historical time period. For example, the electronic device may obtain the number of response timeouts of each microservice that has timed out in a preset historical time period every five minutes, or may obtain the number of response timeouts of each microservice that has timed out in a preset historical time period every six minutes. The preset historical time period may be a historical time period before a preset moment, and the length of the preset historical time period may be 1 minute, or may be 2 minutes.

[0114] For each microservice with a response timeout in a preset historical time period, if the number of response timeouts of the microservice in the preset historical time period is greater than a preset threshold, it can be considered that the microservice has a fault, and the electronic device can determine that the microservice is in a faulty state. The number of response timeouts of the microservice in the preset historical time period can reflect the frequency of response timeouts of the microservice in the preset historical time period.

[0115] For example, the preset threshold value may be a fixed value, which is not limited here. Alternatively, the preset threshold value may be determined based on the current business load of the electronic device. For example, the preset threshold value may be positively correlated with the current business load of the electronic device. The preset threshold value may be set to 10% of the current business load of the electronic device, or may be set to 15% of the current business load of the electronic device.

[0116] It is understandable that in actual business scenarios, for some normal microservices, response timeouts may also occur due to the influence of network status, etc., but the number of response timeouts is small. If the current business load of the electronic device is large, for a normal microservice, the number of response timeouts within a certain period of time will also be large. Therefore, setting a larger preset threshold can avoid determining this type of normal microservice as a faulty microservice. Based on the above processing, it is possible to adapt to changes in business load, improve the accuracy of microservices determined to be in a faulty state, and ensure the high availability of the detection results of business requests.

[0117] In one way, the electronic device can determine the microservices in a faulty state and process the received business requests based on an asynchronous manner. For example, the electronic device can determine the microservices in a faulty state and process the received business requests through different threads. For example, the electronic device can determine the microservices in a faulty state through a thread (which can be called thread 1), that is, execute the above steps 1 and 2 through one thread. In addition, another thread (which can be called thread 2) can also be used to process the received business request based on the microservice in a faulty state determined by thread 1, that is, execute the above steps S101 to S105 through another thread.

[0118] Based on the above method, since the determination of the microservice in a faulty state is performed asynchronously with the processing of the received business request, the timeliness of the microservice in the determined faulty state can be improved without affecting the process of processing the business request, thereby further ensuring the availability of the detection results of the business request.

[0119] For step S103, for each detection rule corresponding to the target business, if there is a microservice in a faulty state among the microservices corresponding to the detection rule, that is, the detection rule is currently in a degraded state, the preset detection result corresponding to the detection rule can be obtained.

[0120] In one embodiment, a preset detection result corresponding to a detection rule indicates that the business request is at a risk level other than the first risk level and the second risk level among the preset risk levels. The first risk level indicates the highest risk level among the risk levels, and the second risk level indicates the lowest risk level among the risk levels. In other words, the preset detection result corresponding to a detection rule indicates that the business request is at an intermediate risk level.

[0121] For example, in the field of risk control, the preset detection result may be a risk assessment value representing an intermediate risk level. That is, for a detection rule, if the risk assessment value representing the detection rule belongs to a preset risk assessment value range, the preset detection result may be a value (also referred to as an intermediate value) other than the values ​​at the two ends of the preset risk assessment value range. For example, the preset detection result may be a risk assessment value corresponding to a bisection point of the preset risk assessment value range, or may be a risk assessment value corresponding to a trisection point of the preset risk assessment value range.

[0122] For example, the preset risk levels include: first risk level, second risk level and third risk level. The first risk level represents high risk, the second risk level represents low risk, and the third risk level represents medium risk. Accordingly, the preset detection result represents the risk assessment value corresponding to the third risk level.

[0123] Alternatively, the preset risk levels include: a first risk level, a second risk level, a third risk level, a fourth risk level, and a fifth risk level. The first risk level represents a high risk, the second risk level represents a low risk, the third risk level represents an intermediate risk, the fourth risk level represents a second highest risk, and the fifth risk level represents a second lowest risk. Accordingly, the preset detection result may represent a risk assessment value corresponding to the third risk level, or the preset detection result may also represent a risk assessment value corresponding to the fourth risk level, or the preset detection result may also represent a risk assessment value corresponding to the fifth risk level.

[0124] In the related art, for a faulty microservice, a preset call result can be obtained, for example, the preset call result is null, and then, it is determined that the call result does not match the information in the business request, and then, the detection result of the detection rule is determined to be the value of the endpoint of the above-mentioned preset risk assessment value range, that is, the detection result of the detection rule obtained indicates that the business request is the highest risk level, or the detection result of the detection rule obtained indicates that the business request is the lowest risk level. The information in the business request may match the call result of the microservice under normal circumstances. That is to say, based on the processing in the related art, in the case of a failure of the microservice, the detection result of the detection rule determined is completely opposite to the actual true result, which in turn leads to a low accuracy of the detection result of the business request finally calculated.

[0125] In an embodiment of the present application, for a detection rule in a degraded state, a risk assessment value representing an intermediate risk level can be returned, which can avoid the detection result of the determined detection rule being completely opposite to the actual real result, and can reduce the impact of the inaccurate detection result of the detection result on the detection result of the entire business request to a certain extent, thereby improving the availability of the detection result of the business request.

[0126] For step S104, the call result returned by the microservice is used to detect the business request, that is, to detect the information carried in the business request. It is understandable that different microservices return different call results. For each microservice, the information that needs to be detected in the business request can be detected based on the call result returned by the microservice in accordance with the detection method recorded in the corresponding detection rule to determine whether the information is normal, and then, the detection result of the corresponding detection rule can be obtained based on whether the information is normal.

[0127] For example, in the field of risk control, when a user requests a login service on a client, the client generates a service request for the login service and sends the service request to an electronic device. The service request may carry information such as the login mobile phone number, the hardware information of the login device, and the login location. The detection rules corresponding to the login service may include: rules for detecting the login mobile phone number, rules for detecting the hardware information of the login device, and rules for detecting the login location.

[0128] Furthermore, when the electronic device receives a service request for a login service, it can call a microservice for detecting the login mobile number to detect the mobile number in the service request, for example, to detect whether the first three digits of the mobile number in the service request are normal values. Accordingly, the call result of the microservice includes the first three digits of a normal mobile number.

[0129] A microservice for detecting the hardware information of the login device may also be called to detect the hardware information in the service request, for example, to detect whether the hardware information in the service request is commonly used hardware information. Accordingly, the call result of the microservice includes commonly used hardware information.

[0130] And the microservice for detecting the login location can be called to detect the login location in the business request, for example, to detect whether the login location in the business request is a commonly used login location. Correspondingly, the call result of the microservice includes the commonly used login locations.

[0131] For each detection rule, it is possible to determine whether the detected information is normal based on the call result of the microservice corresponding to the detection rule according to the detection method corresponding to the detection rule, and then determine the detection result of the detection rule. The detection result can be represented by a risk assessment value. For example, the higher the risk assessment value, the higher the risk level of the detection object.

[0132] For example, the detection result of the rule for detecting the login mobile phone number can be the risk assessment value of the mobile phone number in the service request. When the first three digits of the mobile phone number in the service request match the call result, it is determined that the mobile phone number in the service request is a normal mobile phone number, and the risk assessment value can be the minimum value in the above-mentioned preset risk assessment value range. When the mobile phone number in the service request does not match the call result, it is determined that the mobile phone number in the service request is not a normal mobile phone number, and the risk assessment value can be the maximum value in the above-mentioned preset risk assessment value range.

[0133] When each detection rule corresponding to the target business is not in a degraded state, that is, when the microservices called by each detection rule are not faulty, the microservices corresponding to each detection rule corresponding to the target business are called. At this time, the microservices corresponding to the detection rules can respond in time, so the call results of the corresponding microservices can be returned in time, and then the real detection results corresponding to the detection rules can be determined based on the call results returned by the corresponding microservices.

[0134] For step S105, for each detection rule corresponding to the target business, the real detection result corresponding to the detection rule can be obtained. When the detection rule is in a degraded state, the real detection result corresponding to the detection rule is the preset detection result; when the detection result is not in a degraded state, the real detection result corresponding to the detection rule is determined based on the call result returned by the corresponding microservice. Furthermore, the detection result of the business request of the target business can be determined based on the detection result corresponding to each detection rule corresponding to the target business.

[0135] The method for obtaining the detection result of the business request based on the preset detection result of the detection rule of the microservice in a faulty state in the corresponding microservice and the actual detection results of other detection rules can be the same as the method of obtaining the detection result of the business request based on the actual detection results of each detection rule in the related art.

[0136] In one implementation, the detection result of each detection rule can be represented by a risk assessment value, and then the risk assessment value of the service request, that is, the detection result of the service request, can be obtained by calculating the weighted sum of the detection results of each detection rule.

[0137] For example, the weighted sum of the detection results of all detection rules corresponding to the service request is calculated to obtain the detection result of the service request.

[0138] For another example, the weighted sum of the real detection results of other detection rules except the detection rule in a degraded state can also be calculated. That is, the preset detection results of the detection rules in a degraded state do not participate in the calculation. For example, when calculating the weighted sum, the weight of the preset detection results of the detection rules in a degraded state can be set to 0, and the weights of the real detection results of other detection rules can be adjusted accordingly. Based on this, it is also possible to reduce the impact of the inaccurate detection results of the detection rules in a degraded state on the detection results of the entire business request to a certain extent, and improve the availability of the detection results of the business request.

[0139] In one embodiment, for each microservice with response timeout within a preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, after determining that the microservice is in a fault state from the current moment, the request detection method may further include:

[0140] Step 1: for each microservice determined to be in a faulty state, when a first moment is reached, determine that the microservice is in a non-faulty state.

[0141] The first moment is a moment corresponding to a preset expiration time period extending backward from the moment when the microservice is determined to be in a fault state.

[0142] In the embodiment of the present application, each time the electronic device determines that a microservice is in a faulty state, it can also determine a preset expiration time of the microservice in a faulty state, that is, when determining a microservice in a faulty state, the microservice in a faulty state is in a faulty state within the preset expiration time thereafter. When the preset expiration time is exceeded, the microservice in a faulty state can be restored to a normal state, that is, it is no longer in a faulty state. The preset expiration time is less than the cycle time of setting the preset moment.

[0143] For example, each time a microservice in a faulty state is determined, the electronic device may record each microservice in a faulty state and the start time of the microservice in the faulty state. Subsequently, for each recorded microservice in a faulty state, after recording the start time of the microservice in the faulty state, when the time corresponding to the preset expiration time is reached, the microservice may be deleted from the recorded microservices in the faulty state, and the microservice may be determined to be in a non-faulty state.

[0144] For example, the preset expiration time may be 3 minutes or 4 minutes.

[0145] Based on the above processing, an expiration period is set for the detection rules in a degraded state, so that the detection rules can automatically return to a normal state without manual control. This can adapt to dynamic changes in the network environment, improve the accuracy of detection results, and further ensure the normal response of business requests.

[0146] In one embodiment, when a preset time is reached, the number of response timeouts of each microservice that has timed out in a preset historical time period is obtained, including:

[0147] Step 1: When the preset time is reached, the microservice response log within the preset historical time period is obtained through the message queue corresponding to the business system to which the target business belongs.

[0148] The microservice response log includes a response timeout record of a microservice whose response timed out.

[0149] Step 2: According to the response timeout records, count the number of response timeouts of each microservice that responded with timeouts within a preset historical time period.

[0150] The response timeout record records the microservice that has a response timeout and the time when the response timeout occurs in the microservice.

[0151] In the embodiment of the present application, a corresponding message queue can be set for each business system, and accordingly, each business system can send the microservice response log of the business system to the electronic device through the corresponding message queue. Based on this, the electronic device can connect to different business systems and detect the business requests of different business systems to achieve dynamic expansion of business request detection.

[0152] The electronic device can determine the number of response timeouts of the microservice based on the microservice response log. For example, the electronic device can analyze the response timeout records in the microservice response log through the Flink big data engine. That is, the electronic device can analyze the response timeout records in the microservice response log through an aggregation function to obtain the number of response timeouts of the microservice in a preset historical time period. For example, the electronic device can set a time window and obtain the number of response timeouts of the microservice in the time window through an aggregation function. The duration of the time window is the same as the duration of the preset historical time period.

[0153] By analyzing the response timeout records in the microservice response log through the Flink big data engine, that is, the response timeout records in the microservice response log can be analyzed in near real time, and near real-time monitoring of the microservices that are determined to be in a faulty state can be achieved. Since the microservice response log is generated during the business request processing, the electronic device directly analyzes the microservice response log, and can promptly determine the number of microservice response timeouts, and then promptly determine the microservices in a faulty state, further ensuring the availability of the detection results of the business request.

[0154] In one embodiment, the request detection method may further include:

[0155] Step 1: When the preset time is reached, the number of response timeouts of each microservice that has timed out in the preset historical time period is displayed.

[0156] In an embodiment of the present application, the number of response timeouts of each microservice that has timed out in a preset historical time period can be displayed. For example, the relationship between the time and the number of response timeouts of the microservice that has timed out can be displayed in the form of a chart through the monitoring dashboard. For example, the relationship between the time and the number of response timeouts of the microservice that has timed out can be displayed in the form of a line graph. Among them, the horizontal axis of the line graph can be time, and the vertical axis can be the number of response timeouts. The monitoring dashboard can be a RAP (Realtime Analytics Platform) data dashboard. By displaying the number of response timeouts of microservices, the trend of microservice response timeouts can be displayed, so that operation and maintenance personnel can intuitively understand the trend of microservice response timeouts based on the displayed information, and can also maintain and adjust the microservices based on the trend of response timeouts of microservices, further ensuring the stability of the business system.

[0157] In one embodiment, the request detection method may further include:

[0158] Step 2: When the preset time is reached, if there is a microservice whose response timeout number is greater than the preset threshold within the preset historical time period, an alarm message is sent.

[0159] For example, an alarm message can be sent in the form of a text message or email. The alarm message can include the microservice whose response timeout times are greater than a preset threshold, as well as the response timeout times of the microservice. When receiving the alarm message, the operation and maintenance personnel can check and maintain the microservice contained in the alarm message, further ensuring the stability of the business system.

[0160] In one embodiment, see Figure 2 , Figure 2 A second flow chart of a request detection method provided in an embodiment of the present application. After obtaining the detection result of the service request (S105) based on the preset detection result of the detection rule of the microservice in a faulty state in the corresponding microservice and the actual detection result of other detection rules, the request detection method may further include:

[0161] Step S106: Based on the preset correspondence between the detection result set and the response operation set, determine the response operation corresponding to the detection result of the business request.

[0162] The detection result set includes multiple detection results corresponding to the business request; the response operation set includes multiple response operations for responding to the business request.

[0163] Step S107: respond to the service request according to the determined response operation.

[0164] In an embodiment of the present application, the correspondence between each detection result and each response operation can be preset, that is, the correspondence between the detection result set and the response operation set. After obtaining the detection result of the service request, the electronic device can query in the correspondence to determine the response operation corresponding to the obtained detection result, and then respond to the service request according to the queried response operation. For example, the detection result for the login service indicates that the risk of the service request is low, and the corresponding response operation is to allow login. The detection result for the login service indicates that the risk of the service request is high, and the corresponding response operation is to refuse login.

[0165] Based on the correspondence between each detection result and each response operation, the response operation corresponding to the detection result can be determined, and then the business request can be responded to based on the determined response operation, which means that the business request can be responded to in a timely manner to ensure the normal operation of the business system.

[0166] The embodiment of the present application also provides a request detection system, the request detection system includes: a service node. The service node can be a server, which is used to receive a service request sent by a client and obtain a detection result corresponding to the service request. In addition, based on the detection result corresponding to the service request, a response can be made to the service request.

[0167] A service node is used to receive service requests for target services;

[0168] For each detection rule corresponding to the target business, determine whether there is a microservice currently in a faulty state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method;

[0169] If yes, obtain the preset detection result corresponding to the detection rule;

[0170] If not, call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule based on the call result returned by the corresponding microservice;

[0171] Based on the preset detection results of the detection rules for the microservices in the corresponding microservices that are in a faulty state and the actual detection results of other detection rules, the detection results of the business request are obtained.

[0172] A request detection system provided in an embodiment of the present application can obtain a preset detection result of the detection rule for each detection rule corresponding to a target business when there is a microservice in a faulty state among the microservices corresponding to the detection rule. In other words, the detection result of the detection rule can be obtained in time when the corresponding microservice is in a faulty state, and then, the business request can be responded to according to the detection result. That is, the business request can be responded to in time, and the thread processing the business request can be released in time to avoid invalid occupation of the thread, and then, the thread resource exhaustion can be avoided, and the business system crash can be avoided.

[0173] In one embodiment, the request detection system further includes: a degradation node. The degradation node may be a server, which is used to obtain the number of response timeouts of each microservice that has timed out in a preset historical time period, and may determine the microservice in a fault state.

[0174] The downgrade node is used to obtain the number of response timeouts of each microservice that has timed out in a preset historical time period when a preset time is reached; for each microservice that has timed out in a preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, it is determined that the microservice is in a fault state from the current time;

[0175] The service node is specifically used to determine, for each detection rule corresponding to the target service, whether there is a microservice corresponding to the detection rule among the microservices in a faulty state determined by the current downgraded node;

[0176] If so, it is determined that there is a microservice in a fault state among the microservices corresponding to the detection rule;

[0177] If not, it is determined that there is currently no microservice in a fault state among the microservices corresponding to the detection rule.

[0178] In an embodiment of the present application, the downgraded node may determine a microservice that is in a faulty state, and notify the business node of the determined microservice that is in a faulty state.

[0179] Alternatively, the downgrade node may also record the microservice in a faulty state in a database. Further, the service node may determine whether there is a microservice in a faulty state in the microservices corresponding to the detection rule corresponding to the target service based on the microservice in a faulty state recorded in the database.

[0180] Based on the above processing, a microservice in a faulty state can be determined through one node (i.e., the downgraded node), and a service request can be processed through another node (i.e., the service node), which means that the microservice in a faulty state can be determined and the received service request can be processed in an asynchronous manner. When the service node processes the received service request, it is not necessary to determine the microservice in a faulty state, which reduces the task load of the service node, avoids the excessive task load of the service node affecting the performance of the service node, and further ensures that the service node can respond to the service request in a timely manner.

[0181] In one embodiment, the downgrade node is further used to, for each microservice with a response timeout within a preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, determine that the microservice is in a faulty state from the current moment, and for each microservice determined to be in a faulty state, when a first moment is reached, determine that the microservice is in a non-faulty state; wherein the first moment is a moment corresponding to a preset expiration period extended backward from the moment when the microservice is determined to be in a faulty state.

[0182] In one embodiment, the business node is further used to add a microservice response log to a first message queue corresponding to a business system to which the target business belongs.

[0183] The microservice response log includes a response timeout record of a microservice whose response timed out.

[0184] The downgrade node is specifically used to obtain the microservice response log within a preset historical time period from the first message queue when a preset time is reached; and according to the response timeout record in the obtained microservice response log, count the number of response timeouts of each microservice that has timed out in the preset historical time period.

[0185] In an embodiment of the present application, a corresponding first message queue can be set for each business system, and accordingly, the business node can add the microservice response log of the business system in the corresponding message queue. Based on this, the downgraded node can obtain the microservice response logs of different business systems. The downgraded node can obtain the microservice response log based on the first message queue corresponding to the business system to which the target business belongs, and then, the microservice response log obtained from the first message queue can be analyzed to obtain the number of response timeouts of each microservice that has timed out in a preset historical time period. The way in which the downgraded node analyzes the microservice response log to obtain the number of response timeouts of each microservice can refer to the relevant introduction of analyzing the microservice response log to obtain the number of response timeouts of each microservice in the above method embodiment.

[0186] For example, the first message queue may be a kafka message queue, and the microservice response log may be transmitted between the downgraded node and the business node through the kafka message queue, thereby improving the transmission efficiency of the microservice response log.

[0187] In one embodiment, the request detection system further includes: a display node. The display node may be a server with a display function, which is used to obtain and display the number of response timeouts of each microservice that has timed out a response.

[0188] The downgrade node is further used to add the number of response timeouts of each microservice that has timed out in a preset historical time period to the second message queue corresponding to the business system to which the target business belongs when a preset time is reached;

[0189] The display node is used to obtain the number of response timeouts of each microservice with response timeout from the second message queue and display it.

[0190] In an embodiment of the present application, the downgrade node can add the number of response timeouts of each microservice that has timed out in a preset historical time period to the second message queue corresponding to the business system to which the target business belongs when the preset time is reached. Different business systems can share a second message queue, or a corresponding second message queue can be set for each business system. Based on this, the display node can obtain and display the number of response timeouts of each microservice that has timed out in response in different business systems.

[0191] The second message queue may also be a Kafka message queue. The downgrade node and the display node may transmit the response timeout times of the respective microservices with response timeouts through the Kafka message queue, thereby improving the transmission efficiency of the response timeout times of the respective microservices with response timeouts.

[0192] For the manner in which the display node displays the number of response timeouts, reference may be made to the relevant introduction of step 1 in the above method embodiment.

[0193] In one embodiment, the downgrade node is further used to send an alarm message when a preset time is reached if there is a microservice whose response timeout number is greater than a preset threshold within a preset historical time period.

[0194] For the manner in which the downgraded node sends an alarm message, reference may be made to the relevant introduction of step 2 in the above method embodiment.

[0195] In one embodiment, the business node is also used to determine the response operation corresponding to the detection result of the business request based on the correspondence between the preset detection result set and the response operation set after obtaining the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules; wherein the detection result set includes multiple detection results corresponding to the business request; the response operation set includes multiple response operations for responding to the business request; and the business request is responded to according to the determined response operation.

[0196] In one embodiment, see Figure 3 , Figure 3 A system collaboration swim lane diagram for request processing provided in an embodiment of the present application.

[0197] The business system (i.e., the business node in the above embodiment) can push the fuse degradation log (i.e., the microservice response log in the above embodiment) to the message queue (i.e., the first message queue in the above embodiment), and the Fuse.log in the message queue is the fuse degradation log.

[0198] Furthermore, the fuse degradation system (i.e., the degradation node in the above embodiment) can extract the fuse degradation log from the message queue, and parse the log to obtain the detection rule of the fuse degradation. That is, obtain the response timeout record in the microservice response log. Furthermore, the frequency of fuse degradation of the detection rule is aggregated by defining a time window, that is, a time window can be set, and the number of response timeouts of the microservice in the time window can be obtained by an aggregation function. The detection rule fuse degradation is the microservice response timeout corresponding to the detection rule.

[0199] Furthermore, the fuse degradation system can send the frequency of fuse degradation of the detection rule to the RAP data dashboard (i.e., the display node in the above embodiment), and the RAP data dashboard can display a fuse degradation trend graph, which includes the frequency of fuse degradation of the detection rule. That is, the trend of microservice response timeout can be displayed.

[0200] In addition, the fuse degradation system can monitor the detection rule degradation threshold (i.e., the preset threshold in the above embodiment) set in the configuration center, and then determine whether the frequency of fuse degradation of the detection rule exceeds the threshold. The configuration center can be a database.

[0201] For detection rules whose frequency of fuse degradation exceeds the detection rule degradation threshold, the fuse degradation system can determine that it is in a degraded state and set an expiration time for it (i.e., the preset expiration time in the above embodiment). This type of detection rule can be called a degraded detection rule. That is, for each microservice with a response timeout in a preset historical time period, if the number of response timeouts of the microservice is greater than the preset threshold, the fuse degradation system can determine that the microservice is in a fault state within the preset expiration time, that is, the detection rule corresponding to the microservice is in a degraded state within the preset expiration time.

[0202] Furthermore, the fuse downgrade system pushes the downgrade detection rule to the configuration center with an expiration time, that is, the fuse downgrade system can push the determined downgrade detection rule and the expiration time when the downgrade detection rule is in a downgraded state to the configuration center. The configuration center can generate a downgrade detection rule list and a custom detection rule decision result, that is, the configuration center can generate a downgrade detection rule list, record the downgrade detection rule in the downgrade detection rule list, and record the preset custom detection rule decision result (that is, the preset detection result in the above embodiment).

[0203] The business system monitors the configuration of the configuration center and pulls the list of downgrade detection rules. That is, the business system can monitor the decision results of the custom detection rules configured by the configuration center, pull the list of downgrade detection rules, and obtain the downgraded detection rules. That is, the fuse downgrade system can notify the business system of the detection rules determined to be in a downgraded state. Furthermore, for the downgraded detection rules, the business system can obtain the corresponding custom detection rule decision results.

[0204] The operation and maintenance personnel can customize the detection rule degradation threshold and the detection rule decision result in the configuration center, that is, record the preset threshold and the preset detection result in the configuration center. In this way, the dynamic scalability of the configuration can be improved, and then, based on the preset detection results, the business request can be responded to in a timely manner, and the high availability of the detection results of the business request can be achieved. In addition, the message queues that the fuse degradation system can consume can be expanded through the dynamic configuration of the configuration center. These message queues can be connected to different business systems, and then, the fuse degradation system can consume the fuse degradation logs of different business systems, and it is also possible to provide preset detection results for business systems that rely more on third-party services (i.e., the microservices in the above embodiment). It is also possible to ensure timely response to business requests of multiple business systems and ensure the high availability of detection results of business requests of multiple business systems.

[0205] In one embodiment, see Figure 4 , Figure 4This is a third flow chart of a request detection method provided in an embodiment of the present application. The service system may be a service node in the above embodiment, and the fuse degradation system may be a degradation node in the above embodiment. It should be noted that: Figure 4 The step numbers in the figure do not represent the actual order of the steps and are not specifically limited. Figure 4 For the relevant steps in Figure 3 Instructions in .

[0206] Before the business system pushes the fuse degradation log (i.e., the microservice response log in the above embodiment) to the fuse degradation system, step S401 is executed: the client requests the business system, i.e., the client sends a business request for the target business to the business system. After the business system receives the business request of the target business, step S402 is executed to call the third-party service, i.e., the business system calls the microservice corresponding to the detection rule corresponding to the target business. As shown in step S403, the third-party service call times out and returns a default value. The default value returned by the timed-out third-party service call can be empty. Furthermore, as shown in step S404, the business system obtains the default detection rule decision result and responds to the business request sent by the client based on the default detection rule decision result. That is, the business system determines the detection result of the detection rule (i.e., the default detection rule decision result) based on the returned default value. Furthermore, the detection result of the business request for the target business can be obtained according to the detection result of the detection rule, so as to respond to the business request sent by the client according to the detection result of the business request.

[0207] The business system processes the received business request, which can be asynchronous with the fuse degradation system determining the detection rules in the degradation state.

[0208] The configuration center records the detection rule degradation threshold, and pushes the detection rule degradation threshold to the fuse degradation system through step S405. As shown in step S406, the business system can push the business system fuse degradation log to the message queue.

[0209] Furthermore, the fuse downgrade system can obtain the fuse downgrade log from the push message of the message queue based on step S407, and analyze the fuse downgrade log. Then, as shown in step S408, the detection rule fuse exceeds the threshold, and then the detection rule can be downgraded, that is, it can be determined whether the detection rule fuse exceeds the threshold, and the detection rule in the downgraded state can be determined. That is, based on the microservice response log, the microservice whose response timeout number in the preset historical time period is greater than the preset threshold is determined to be in a fault state within the preset expiration time, that is, the detection rule corresponding to the microservice in the fault state is in a downgraded state.

[0210] For any detection rule corresponding to the business request, when the detection rule is blown beyond the threshold, as shown in step S409, the detection rule is downgraded with an expiration time and a custom downgrade strategy, and then the fuse downgrade system can push the downgraded detection rule with an expiration time and a custom downgrade strategy to the configuration center. The custom downgrade strategy is the preset detection result corresponding to the detection rule.

[0211] As shown in step S410, when the client requests the business system, after receiving the business request of the target business, the business system can execute step S411 to pull the downgrade detection rule list from the configuration center, that is, obtain the downgrade detection rule list from the configuration center. The downgrade detection rule list records the downgrade detection rules, expiration time and custom downgrade strategy.

[0212] As shown in step S412, the business system can obtain the list of downgrade detection rules returned by the configuration center. Furthermore, based on the list of downgrade detection rules, it can be determined whether the detection rule corresponding to the business request is in a downgraded state. As shown in steps S413 and S414, for any detection rule corresponding to the business request, if the detection rule is included in the list of downgrade detection rules, and the downgrade policy of the detection rule has not expired, that is, the custom downgrade policy of the detection rule is expired, and the expiration time corresponding to the detection rule has not been reached, then step S415 is executed. The business system obtains the custom detection rule decision result, and responds to the business request sent by the client based on the custom detection rule decision result. That is, the business system can obtain the preset detection result of the detection rule in a downgraded state based on the custom downgrade policy, that is, the custom detection rule decision result, and then, based on the custom detection rule decision result, the detection result of the business request of the target business can be obtained, and the business request can be responded to according to the detection result of the business request of the target business.

[0213] That is, the business system can determine, for each detection rule corresponding to the target business, whether there is a microservice currently in a faulty state among the microservices corresponding to the detection rule. If so, obtain the preset detection result of the detection rule. If not, call the microservice corresponding to the detection rule, and determine the detection result of the detection rule based on the call result returned by the corresponding microservice. Based on the detection results of each detection rule, the detection result of the business request can be obtained. Furthermore, the response operation corresponding to the detection result of the business request can be determined to respond to the business request of the client.

[0214] In one embodiment, see Figure 5 , Figure 5 A schematic diagram of the structure of a circuit breaker and downgrade system provided in an embodiment of the present application. The circuit breaker and downgrade system includes: a configuration monitoring layer, a computing layer, a component layer, and a data resource layer.

[0215] Among them, the configuration monitoring layer is used for downgrade configuration and downgrade monitoring. The downgrade configuration includes the setting of the fuse degradation threshold (i.e., the preset threshold in the above embodiment) and the configuration of the detection rule downgrade decision (i.e., the preset detection result in the above embodiment). The functions of the fuse degradation monitoring include: displaying the fuse degradation trend graph and alarming when the fuse degradation threshold is exceeded. The method of displaying the fuse degradation trend graph can refer to the relevant introduction in step one in the above embodiment, and the relationship between the time and number of response timeouts of the microservice that responded to the timeout can be displayed in the form of a chart through the monitoring dashboard (i.e., the RAP data dashboard in the above embodiment). The method of alarming when exceeding the fuse degradation threshold can refer to the relevant introduction of sending the alarm message in step two in the above embodiment.

[0216] The Flink Job in the computing layer can monitor changes in the configuration center parameters. The parameters recorded in the configuration center include the fuse degradation threshold and the detection rule degradation decision. The Flink Job can also count the detection rule fuse degradation frequency, that is, the number of response timeouts of each microservice with a response timeout can be counted. Furthermore, the fuse degradation system can determine the microservice in a faulty state based on the fuse degradation threshold, that is, the detection rule corresponding to the microservice in a faulty state is in a degraded state. In addition, the degraded detection rules can be sent through the Flink Job, that is, the detection rules in a degraded state are added to the message queue to notify the business system of the detection rules in a degraded state.

[0217] The response timeout record of the microservice response log records a set of microservices with response timeouts (i.e., a set of third-party services that are broken and downgraded), and a set of detection rules corresponding to the microservices with response timeouts (i.e., a set of detection rules for breaking and downgrading). The computing layer also includes an HTTP (HyperText Transfer Protocol) interface, through which the above two sets can be obtained. Furthermore, based on the correspondence between the microservices and the detection rules recorded in the MySQL database, the detection rules in a downgraded state can be determined, that is, the downgraded detection rules can be determined.

[0218] The component layer includes a configuration center, a monitoring dashboard, a message queue, and a Flink big data engine. Operation and maintenance personnel can set preset thresholds and preset detection results in the configuration center. The monitoring dashboard is used to display the fuse degradation trend chart. The message queue can transmit the detection rule fuse degradation frequency and the degradation detection rule, including the first message queue and the second message queue in the above embodiment. The Flink big data engine can process and analyze the response timeout records in the microservice response log in near real time to obtain the number of response timeouts of each microservice with response timeout.

[0219] The data resource layer may include a MySQL database, a Kafka message queue, and a data resource service platform. The MySQL database is used to record the correspondence between microservices and detection rules. The Kafka message queue corresponds to the first message queue and the second message queue in the above embodiment. The data resource service platform can provide a display interface, and then the operation and maintenance personnel can view the data in the Kafka message queue and the MySQL database through the data resource service platform.

[0220] The present application also provides a request detection device, see Figure 6 , Figure 6 A schematic diagram of a request detection device provided in an embodiment of the present application, wherein the request detection device comprises:

[0221] A service request receiving module 601 is used to receive a service request for a target service;

[0222] The fault status judgment module 602 is used to judge whether there is a microservice in a fault state among the microservices corresponding to the detection rule for each detection rule corresponding to the target business; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method; if yes, the preset detection result acquisition module 603 is triggered; if no, the microservice calling module 604 is triggered;

[0223] The preset detection result acquisition module 603 is used to obtain the preset detection result corresponding to the detection rule;

[0224] The microservice calling module 604 is used to call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule according to the call result returned by the corresponding microservice;

[0225] The detection result determination module 605 is used to obtain the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules.

[0226] Based on the above processing, for each detection rule corresponding to the target business, when there is a microservice in a faulty state among the microservices corresponding to the detection rule, the preset detection result of the detection rule can be obtained, which means that the detection result of the detection rule can be obtained in time when the corresponding microservice is in a faulty state, and then, the business request can be responded to according to the detection result, that is, the business request can be responded to in time, and the thread processing the business request can be released in time to avoid the thread being invalidly occupied, and then, the thread resources can be avoided from being exhausted, which can also avoid the crash of the business system.

[0227] In one embodiment, the request detection device further comprises:

[0228] A response timeout number acquisition module is used to obtain the number of response timeouts of each microservice that has responded timed out within a preset historical time period when a preset time is reached;

[0229] A fault status determination module is used to determine, for each microservice with a response timeout in the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, that the microservice is in a fault state from the current moment;

[0230] The fault state judgment module is specifically used to judge, for each detection rule corresponding to the target business, whether there is a microservice corresponding to the detection rule in the currently determined microservices in the fault state; if so, trigger the first determination module; if not, trigger the second determination module;

[0231] The first determination module is used to determine whether there is a microservice in a fault state among the microservices corresponding to the detection rule;

[0232] The second determination module is used to determine that there is currently no microservice in a fault state among the microservices corresponding to the detection rule.

[0233] In one embodiment, the request detection device further comprises:

[0234] The non-fault state determination module is used for, for each microservice with a response timeout within the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, after determining that the microservice is in a fault state from the current moment, for each microservice determined to be in a fault state, when a first moment is reached, determining that the microservice is in a non-fault state; wherein the first moment is a moment corresponding to a preset expiration time period extending backward from the moment when the microservice is determined to be in a fault state.

[0235] In one embodiment, a response timeout number acquisition module is specifically used to obtain a microservice response log within a preset historical time period through a message queue corresponding to a business system to which the target business belongs when a preset time is reached; wherein the microservice response log includes a response timeout record of a microservice with a response timeout; and according to the response timeout record, count the number of response timeouts of each microservice with a response timeout within the preset historical time period.

[0236] In one embodiment, the request detection device further comprises:

[0237] The display module is used to display the number of response timeouts of each microservice that has timed out in a preset historical time period when a preset time is reached.

[0238] In one embodiment, the request detection device further comprises:

[0239] The alarm module is used to send an alarm message when a preset time is reached if there is a microservice whose response timeout number is greater than a preset threshold within a preset historical time period.

[0240] In one embodiment, the request detection device further comprises:

[0241] A response operation determination module is used to determine the response operation corresponding to the detection result of the business request based on the preset detection result of the detection rule based on the presence of a microservice in a faulty state in the corresponding microservice and the actual detection results of other detection rules, after obtaining the detection result of the business request, based on the correspondence between the preset detection result set and the response operation set; wherein the detection result set includes multiple detection results corresponding to the business request; the response operation set includes multiple response operations for responding to the business request;

[0242] The business request response module is used to respond to the business request according to the determined response operation.

[0243] The present application also provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.

[0244] Memory 703, used for storing computer programs;

[0245] The processor 701 is used to execute the program stored in the memory 703 to implement the following steps:

[0246] Receiving a business request for a target business;

[0247] For each detection rule corresponding to the target business, determine whether there is a microservice currently in a faulty state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method;

[0248] If yes, obtain the preset detection result corresponding to the detection rule;

[0249] If not, call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule based on the call result returned by the corresponding microservice;

[0250] Based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules, the detection result of the business request is obtained.

[0251] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0252] The communication interface is used for communication between the above terminal and other devices.

[0253] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0254] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0255] In another embodiment provided in the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the request detection method described in any one of the above embodiments is implemented.

[0256] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the request detection methods described in the above embodiments.

[0257] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0258] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0259] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for system and device embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0260] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A request detection method, It is characterized in that The method comprises: Receiving a business request for a target business; For each detection rule corresponding to the target business, determine whether there is a microservice currently in a faulty state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method; If yes, then obtain a preset detection result corresponding to the detection rule; wherein a preset detection result corresponding to a detection rule indicates that: the business request is a risk level other than the first risk level and the second risk level among the preset risk levels; the first risk level indicates the highest risk level among the risk levels, and the second risk level indicates the lowest risk level among the risk levels; If not, call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule based on the call result returned by the corresponding microservice; Based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules, the detection result of the business request is obtained.

2. The method according to claim 1, It is characterized in that The method further comprises: When the preset time is reached, the number of response timeouts of each microservice whose response timed out in the preset historical time period is obtained; For each microservice with a response timeout within the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, it is determined that the microservice is in a fault state from the current moment; For each detection rule corresponding to the target business, determining whether there is a microservice currently in a fault state among the microservices corresponding to the detection rule includes: For each detection rule corresponding to the target business, determine whether there is a microservice corresponding to the detection rule among the currently determined microservices in a faulty state; If so, it is determined that there is a microservice in a fault state among the microservices corresponding to the detection rule; If not, it is determined that there is currently no microservice in a fault state among the microservices corresponding to the detection rule.

3. The method according to claim 2, It is characterized in that For each microservice with response timeout in the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, after determining that the microservice is in a fault state from the current moment, the method further includes: For each microservice determined to be in a faulty state, when a first moment is reached, the microservice is determined to be in a non-faulty state; wherein the first moment is a moment corresponding to a preset expiration period extended backward from a moment when the microservice is determined to be in a faulty state.

4. The method according to claim 2, It is characterized in that When the preset time is reached, the number of response timeouts of each microservice that has timed out in a preset historical time period is obtained, including: When the preset time is reached, the microservice response log within the preset historical time period is obtained through the message queue corresponding to the business system to which the target business belongs; wherein the microservice response log includes the response timeout record of the microservice whose response timed out; According to the response timeout record, the number of response timeouts of each microservice that has timed out in response within the preset historical time period is counted.

5. The method according to claim 2, It is characterized in that The method further comprises: When the preset time is reached, the number of response timeouts of each microservice that has timed out in the preset historical time period is displayed.

6. The method according to claim 2, It is characterized in that The method further comprises: When the preset time is reached, if there is a microservice whose response timeout number is greater than a preset threshold within the preset historical time period, an alarm message is sent.

7. The method according to claim 1, It is characterized in that After obtaining the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the real detection results of other detection rules, the method further includes: Based on the correspondence between the preset detection result set and the response operation set, determine the response operation corresponding to the detection result of the business request; wherein the detection result set includes multiple detection results corresponding to the business request; the response operation set includes multiple response operations for responding to the business request; The service request is responded to according to the determined response operation.

8. A request detection system, It is characterized in that The request detection system comprises: a service node; The service node is used to receive a service request for a target service; For each detection rule corresponding to the target business, determine whether there is a microservice currently in a faulty state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method; If yes, then obtain a preset detection result corresponding to the detection rule; wherein a preset detection result corresponding to a detection rule indicates that: the business request is a risk level other than the first risk level and the second risk level among the preset risk levels; the first risk level indicates the highest risk level among the risk levels, and the second risk level indicates the lowest risk level among the risk levels; If not, call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule based on the call result returned by the corresponding microservice; Based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules, the detection result of the business request is obtained.

9. The system according to claim 8, It is characterized in that The request detection system further includes: a downgrade node; The downgrade node is used to obtain the number of response timeouts of each microservice that has timed out in a preset historical time period when a preset time is reached; for each microservice that has timed out in the preset historical time period, if the number of response timeouts of the microservice is greater than a preset threshold, determine that the microservice is in a fault state from the current time; The service node is specifically used to determine, for each detection rule corresponding to the target service, whether there is a microservice corresponding to the detection rule among the microservices in a faulty state determined by the current downgrade node; If so, it is determined that there is a microservice in a fault state among the microservices corresponding to the detection rule; If not, it is determined that there is currently no microservice in a fault state among the microservices corresponding to the detection rule.

10. The system according to claim 9, It is characterized in that The downgrade node is further configured to, for each microservice with a response timeout within the preset historical time period, determine that the microservice is in a faulty state from the current moment if the number of response timeouts of the microservice is greater than a preset threshold, and then, for each microservice determined to be in a faulty state, determine that the microservice is in a non-faulty state when a first moment is reached; wherein the first moment is a moment corresponding to a preset expiration time period extended backward from a moment when the microservice is determined to be in a faulty state.

11. The system according to claim 9, It is characterized in that The business node is further used to add a microservice response log to the first message queue corresponding to the business system to which the target business belongs; wherein the microservice response log includes a response timeout record of a microservice whose response timed out; The downgrade node is specifically used to obtain the microservice response log within a preset historical time period from the first message queue when a preset time is reached; and according to the response timeout record in the obtained microservice response log, count the number of response timeouts of each microservice that has responded timed out within the preset historical time period.

12. The system according to claim 9, It is characterized in that The system further comprises: a display node; The downgrade node is further used to add the number of response timeouts of each microservice that has responded timed out within the preset historical time period to the second message queue corresponding to the business system to which the target business belongs when a preset time is reached; The display node is used to obtain the number of response timeouts of each microservice with response timeout from the second message queue and display it.

13. The system according to claim 9, It is characterized in that The downgrade node is further configured to send an alarm message when a preset time is reached if there is a microservice whose response timeout number is greater than a preset threshold within the preset historical time period.

14. The system according to claim 8, It is characterized in that The business node is further used to determine the response operation corresponding to the detection result of the business request based on the correspondence between the preset detection result set and the response operation set after obtaining the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice being in a faulty state and the actual detection results of other detection rules; wherein the detection result set includes multiple detection results corresponding to the business request; and the response operation set includes multiple response operations for responding to the business request; The service request is responded to according to the determined response operation.

15. A request detection device, It is characterized in that The device comprises: A service request receiving module, used for receiving a service request for a target service; A fault status judgment module is used to judge, for each detection rule corresponding to the target business, whether there is a microservice currently in a fault state among the microservices corresponding to the detection rule; wherein each detection rule corresponding to the target business is used to detect the information carried in the business request; a detection rule includes the information to be detected and the detection method; if yes, a preset detection result acquisition module is triggered; if no, a microservice call module is triggered; The preset detection result acquisition module is used to obtain the preset detection result corresponding to the detection rule; wherein the preset detection result corresponding to a detection rule indicates that: the business request is a risk level other than the first risk level and the second risk level among the preset risk levels; the first risk level indicates the highest risk level among the risk levels, and the second risk level indicates the lowest risk level among the risk levels; The microservice calling module is used to call the microservice corresponding to the detection rule, and determine the actual detection result corresponding to the detection rule according to the call result returned by the corresponding microservice; The detection result determination module is used to obtain the detection result of the business request based on the preset detection result of the detection rule of the microservice in the corresponding microservice that is in a fault state and the actual detection results of other detection rules.

16. An electronic device, It is characterized in that It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.

17. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Micro-service node exception handling method, device and system

    CN110995504A

  • Micro-service evaluation method and device, computing equipment and micro-service detection system

    CN112241350A

  • Abnormality detection method and device for micro-service system, electronic equipment and storage medium

    CN112463530A

  • Simulation test universal platform for high-speed rail train control vehicle-mounted equipment

    CN113885472A

  • Method, system, equipment and medium for high concurrency processing in power industry

    CN114979137A