Service degradation method and apparatus, and storage medium

By determining the service call relationships and memory information of microservices, calculating priorities, and executing microservice degradation, the blocking and crashing problems of microservice systems under high concurrency or abnormal conditions are solved, and access efficiency is improved.

CN114237666BActive Publication Date: 2025-12-16BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111543479.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-16
Publication Date
2025-12-16
Estimated Expiration
2041-12-16

AI Technical Summary

Technical Problem

Existing microservice systems are prone to blocking or crashing under high concurrency or abnormal conditions, resulting in reduced access efficiency, especially when critical services with strong dependencies are downgraded and become unusable.

Method used

By determining the service call relationships and memory information between microservices, the service degradation priority is calculated, and the microservice degradation operation is executed according to the priority, prioritizing the degradation of non-core microservices to avoid affecting core services.

Benefits of technology

It improves access efficiency when accessing microservices, ensures the normal operation of core services, and avoids the impact of non-core service degradation on core services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114237666B_ABST
    Figure CN114237666B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a service degradation method and device, and a storage medium, comprising the following steps: in the case that a micro-service access instruction transmitted by a client is received, a plurality of micro-services related to access information in the access instruction are determined; a service calling relationship between the plurality of micro-services is acquired; a plurality of memory information corresponding to the plurality of micro-services are determined; according to the service calling relationship and the plurality of memory information, a plurality of service degradation priorities are determined, and a micro-service degradation operation is performed according to the plurality of service degradation priorities.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of service degradation, and particularly relates to a service degradation method and device and a storage medium. BACKGROUND

[0002] With the development of Internet technology, a micro-service system often has access peaks. When the access amount is large, such as high concurrency and high traffic, or when an abnormality occurs in an upstream micro-service node in the system, the micro-service system needs to adopt a degradation strategy to ensure normal operation of the micro-service system.

[0003] In the prior art, when the micro-service system adopts a flow limiting automatic degradation strategy or a timeout automatic degradation strategy, the micro-service system is prone to blocking, and even the micro-service system crashes. In this case, if a strongly dependent service associated with an important service is degraded, the service cannot be used, thereby reducing the access efficiency when the micro-service is accessed. SUMMARY

[0004] To solve the above technical problems, the embodiments of the present application aim to provide a service degradation method and device and a storage medium, which can improve the access efficiency when the micro-service is accessed.

[0005] The technical scheme of the present application is implemented as follows:

[0006] The embodiments of the present application provide a service degradation method, which comprises the following steps:

[0007] In the case that a micro-service access instruction transmitted by a client is received, a plurality of micro-services related to access information in the access instruction are determined;

[0008] A service calling relationship between the plurality of micro-services is obtained;

[0009] A plurality of memory information corresponding to the plurality of micro-services is determined;

[0010] According to the service calling relationship and the plurality of memory information, a plurality of service degradation priorities is determined, and a micro-service degradation operation is performed according to the plurality of service degradation priorities.

[0011] The embodiments of the present application provide a service degradation device, which comprises the following:

[0012] A determination unit is configured to, in the case that a micro-service access instruction transmitted by a client is received, determine a plurality of micro-services related to access information in the access instruction; determine a plurality of memory information corresponding to the plurality of micro-services; and determine a plurality of service degradation priorities according to a service calling relationship and the plurality of memory information;

[0013] The acquisition unit is configured to acquire the service invocation relationship among the plurality of microservices.

[0014] The execution unit is configured to perform a microservice degradation operation according to the plurality of service degradation priorities.

[0015] The embodiment of the present application provides a service degradation device, and the device comprises:

[0016] The memory, the processor and the communication bus, the memory communicates with the processor through the communication bus, the memory stores the service degradation program executable by the processor, when the service degradation program is executed, the service degradation method is executed by the processor.

[0017] The embodiment of the present application provides a storage medium, and a computer program is stored on the storage medium, and the computer program is applied to a service degradation device, and the computer program is executed by a processor to realize the service degradation method.

[0018] The embodiment of the present application provides a service degradation method and device and a storage medium, and the service degradation method comprises the following steps: in the case that a microservice access instruction transmitted by a client is received, a plurality of microservices related to access information in the access instruction are determined; the service invocation relationship among the plurality of microservices is acquired; a plurality of memory information corresponding to the plurality of microservices are determined; according to the service invocation relationship and the plurality of memory information, a plurality of service degradation priorities are determined, and a microservice degradation operation is performed according to the plurality of service degradation priorities. The method implementation scheme is adopted, the service degradation device acquires the service invocation relationship among the plurality of microservices, determines the plurality of service degradation priorities corresponding to the plurality of microservices according to the plurality of memory information corresponding to the plurality of microservices and the service invocation relationship, and performs the microservice degradation operation according to the plurality of service degradation priorities, that is, the degradation operation is first performed on the remaining microservices except the core microservice and the associated microservice associated with the core microservice, the dependency between the remaining microservices and the core microservice is weak, and the degradation operation on the remaining microservices will not affect the core microservice, so that the access process corresponding to the microservice access instruction can be normally executed, and the access efficiency during the microservice access is improved. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 A service degradation method flow chart is provided for the embodiment of the present application.

[0020] Figure 2 An exemplary microservice invocation system block diagram is provided for the embodiment of the present application.

[0021] Figure 3 An exemplary microservice registration block diagram is provided for the embodiment of the present application.

[0022] Figure 4 An exemplary microservice-oriented degradation system is provided for the embodiments of the present application.

[0023] Figure 5 An exemplary service degradation method flowchart is provided for the embodiments of the present application.

[0024] Figure 6 An exemplary system read-write capability comparison diagram is provided for the embodiments of the present application.

[0025] Figure 7 An exemplary system availability comparison diagram is provided for the embodiments of the present application.

[0026] Figure 8 An exemplary system load condition comparison diagram is provided for the embodiments of the present application.

[0027] Figure 9 An exemplary microservice hierarchical degradation diagram is provided for the embodiments of the present application.

[0028] Figure 10 An exemplary service degradation device component structure diagram is provided for the embodiments of the present application Figure 1 .

[0029] Figure 11 An exemplary service degradation device component structure diagram is provided for the embodiments of the present application Figure 2 . DETAILED DESCRIPTION

[0030] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0031] The embodiments of the present application provide a service degradation method, Figure 1 A service degradation method flowchart is provided for the embodiments of the present application Figure 1 As shown in Figure 1 , the service degradation method can include:

[0032] S101, in the case of receiving a microservice access instruction transmitted by a client, determining a plurality of microservices related to access information in the access instruction.

[0033] The service degradation method provided by the embodiments of the present application is applicable to the scenario of microservice degradation of a plurality of microservices.

[0034] In the embodiments of the present application, the service degradation apparatus can be implemented in various forms. For example, the service degradation apparatus described in the present application can include devices such as a mobile phone, a camera, a tablet computer, a notebook computer, a palm computer, a personal digital assistant (PDA), a portable media player (PMP), a navigation device, a wearable device, a smart bracelet, a pedometer, etc., and devices such as a digital TV, a desktop computer, etc.

[0035] In the embodiments of the present application, the plurality of microservices are part of the microservices in the service degradation apparatus, and any microservice in the service degradation apparatus can execute the microservice degradation method proposed in the embodiments of the present application when the microservice receives a microservice access instruction.

[0036] In the embodiments of the present application, the microservice access instruction is an instruction for a client to access a microservice.

[0037] In the embodiments of the present application, the number of microservice access instructions can be one; the number of microservice access instructions can also be two; the number of microservice access instructions can also be multiple; and the specific number of microservice access instructions can be determined according to actual conditions, which is not limited in the embodiments of the present application.

[0038] S102, obtain a service call relationship between the plurality of microservices.

[0039] In the embodiments of the present application, after the service degradation apparatus determines the plurality of microservices related to the access information in the access instruction, the service degradation apparatus can obtain the service call relationship between the plurality of microservices.

[0040] In the embodiments of the present application, the service call relationship can be a microservice association matrix table; the service call relationship can also be a key-value pair between the plurality of microservices and the post-related associated microservices stored; the service call relationship can also be other forms of relationships between the plurality of microservices and the post-related associated microservices; and the specific service call relationship can be determined according to actual conditions, which is not limited in the embodiments of the present application.

[0041] For example, if the service call relationship can be a microservice association matrix table, the microservice association matrix table is shown in Table 1.

[0042] Table 1 Microservice Association Matrix Table

[0043]

[0044]

[0045] It should be noted that M1, M2, M3, M4, M5, M6, M7, M8, M9, M10 are respectively 10 microservices.

[0046] It should be noted that the value corresponding to M1 in the second row and M2 in the third column is 1, that is, M2 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M3 in the fourth column is 1, that is, M3 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M4 in the fifth column is 1, that is, M4 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M5 in the sixth column is 1, that is, M5 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M6 in the seventh column is 1, that is, M6 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M7 in the eighth column is 1, that is, M7 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M8 in the ninth column is 1, that is, M8 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M9 in the tenth column is 1, that is, M9 is a microservice associated backwardly with M1; the value corresponding to M1 in the second row and M10 in the eleventh column is 1, that is, M10 is a microservice associated backwardly with M1; the value corresponding to M2 in the third row and M3 in the fourth column, the value corresponding to M2 in the third row and M4 in the fifth column, the value corresponding to M2 in the third row and M5 in the sixth column, the value corresponding to M2 in the third row and M8 in the ninth column, the value corresponding to M2 in the third row and M9 in the tenth column, and the value corresponding to M2 in the third row and M10 in the eleventh column are all 1, that is, M3, M4, M5, M6, M7, M8, M9, M10 are respectively microservices associated backwardly with M2; the value corresponding to M3 in the fourth row and M4 in the fifth column is 1, that is, M4 is a microservice associated backwardly with M3; the value corresponding to M5 in the sixth row and M6 in the seventh column, the value corresponding to M5 in the sixth row and M7 in the eighth column, the value corresponding to M5 in the sixth row and M8 in the ninth column, the value corresponding to M5 in the sixth row and M9 in the tenth column, and the value corresponding to M5 in the sixth row and M10 in the eleventh column are all 1, that is, M6, M7, M8, M9, M10 are all microservices associated backwardly with M5; the value corresponding to M6 in the seventh row and M7 in the eighth column, the value corresponding to M6 in the seventh row and M8 in the ninth column, the value corresponding to M6 in the seventh row and M9 in the tenth column, and the value corresponding to M6 in the seventh row and M10 in the eleventh column are all 1, that is, M7, M8, M9, M10 are all microservices associated backwardly with M6; the value corresponding to M7 in the eighth row and M8 in the ninth column, the value corresponding to M7 in the eighth row and M9 in the tenth column, and the value corresponding to M7 in the eighth row and M10 in the eleventh column are all 1, that is, M8, M9, M10 are all microservices associated backwardly with M7; the value corresponding to M9 in the tenth row and M10 in the eleventh column is 1, that is, M10 is a microservice associated backwardly with M9.

[0047] It should be noted that the M2 is a backwardly associated microservice of the M1, and the M1 microservice can call the M2 microservice in the process of obtaining the access information.

[0048] In the embodiment of the present application, before the service degradation device obtains the service calling relationship among the plurality of microservices, the service degradation device further obtains the first backwardly associated microservice corresponding to the first microservice from the microservice registry center, and establishes the backwardly associated relationship between the first microservice and the first backwardly associated microservice. Correspondingly, the process of obtaining the service calling relationship among the plurality of microservices by the service degradation device comprises: obtaining the service calling relationship from the backwardly associated relationship by the service degradation device.

[0049] It should be noted that the first microservice is all the microservices contained in the microservice registry center, and the first microservice includes the plurality of microservices.

[0050] In the embodiment of the present application, each microservice in the service degradation device is configured with a Restful (design style and development method of network application program) application program interface (Application Programming Interface, API), and the services associated with the microservice are written into the Restful API when each microservice is built. For example, as shown in Figure 2 As shown in the figure, there are m microservices, each microservice is represented by M, and the mth microservice can be represented by Mm. Different microservices are in different business modules. Specifically, the business module 1 includes two microservices M1 and M2, the business module 2 includes two microservices M3 and M4, the business module 3 includes two microservices M3 and M4, the business module 4 includes two microservices M7 and M8, the business module 5 includes two microservices M9 and M10, and so on. The Restful API in the microservice M1 includes the backwardly associated microservice information M2, M3, M4, M5, M6, M7, M8, M9, M10, and so on. The Restful API in the microservice M2 includes the backwardly associated microservice information M3, M4, M5, M6, M7, M8, M9, M10, and so on. The Restful API in the microservice M3 includes the backwardly associated microservice information M4, and so on. The Restful API in the microservice M5 includes the backwardly associated microservice information M6, M7, M8, M9, M10, and so on. The Restful API in the microservice M6 includes the backwardly associated microservice information M7, M8, M9, M10, and so on. The Restful API in the microservice M7 includes the backwardly associated microservice information M8, M9, M10, and so on. The Restful API in the microservice M9 includes the backwardly associated microservice information M10, and so on.

[0051] Specifically, in the case of microservice M1 in the household request service module 1, microservice M1 calls microservice M2 (i.e., microservice M2 is the backward associated microservice of microservice M1, and microservice M1 can be referred to as the forward associated microservice of M2).

[0052] As shown in the example, Figure 3 Before the microservice is used, the information of the microservice needs to be registered to the service registry center (including the service registry center 1, the service registry center 2, and the service registry center 3). Microservice 3 can register the corresponding registration information (including the microservice system service name, the network address of the service, and the associated service name and network address of the service; and the backward associated services (including the addresses of the subsequent associated microservices) of the microservice are saved in the form of key-value pairs) to the service registry center 2, and microservice 4 can register the corresponding registration information to the service registry center 3. By synchronizing the registration information in the service registry center 1, the service registry center 2, and the service registry center 3, the service registry center 1 also contains the registration information of microservice 3 and the registration information of microservice 4. The service degradation device can obtain the corresponding backward associated microservices (service list) of microservice 1 and the corresponding backward associated microservices (service list) of microservice 2 from the microservice registry center 1, and microservice 1 can directly call (service call) microservice 3; microservice 2 can also directly call (service call) microservice 4.

[0053] It should be noted that the network address of the service includes the port number and the network address.

[0054] In the embodiment of the application, the service degradation device can construct a key-value pair according to the registered microservice and the corresponding backward associated microservice of the microservice, set a microservice association matrix table, and obtain the backward association relationship between the first microservice and the first backward associated microservice. The elements in the microservice association matrix table are filled with 1 according to the key-value pair, and the remaining elements are set to 0.

[0055] It should be noted that according to the association relationship between M1 and M2 microservices in Table 1, Figure 2 The value corresponding to M1 in the third column M2 in the second row of Table 1 is set to 1, and the value corresponding to M2 in the second column M1 in the third row is set to 0, indicating that microservice M1 is the forward associated microservice of microservice M2, and microservice M2 does not belong to the forward associated service of microservice M1. In this way, the microservice association matrix table shown in Table 1 can be constructed.

[0056] In S103, a plurality of memory information corresponding to a plurality of microservices is determined.

[0057] In the embodiments of the present application, the service degradation device can first acquire the service calling relationship among the plurality of microservices, and then determine the plurality of memory information corresponding to the plurality of microservices; or the service degradation device can first determine the plurality of memory information corresponding to the plurality of microservices, and then acquire the service calling relationship among the plurality of microservices; or the service degradation device can acquire the service calling relationship among the plurality of microservices and determine the plurality of memory information corresponding to the plurality of microservices at the same time; the order in which the service degradation device acquires the service calling relationship among the plurality of microservices and determines the plurality of memory information corresponding to the plurality of microservices can be determined according to actual conditions, and the embodiments of the present application do not limit this.

[0058] It should be noted that the plurality of microservices and the plurality of memory information correspond one-to-one, specifically, one microservice corresponds to one memory information.

[0059] In the embodiments of the present application, the plurality of memory information can be a plurality of usage memory information corresponding to the plurality of microservices; the plurality of memory information can also be a plurality of remaining memory information corresponding to the plurality of microservices; specifically, this can be determined according to actual conditions, and the embodiments of the present application do not limit this.

[0060] In the embodiments of the present application, after the service degradation device determines the plurality of memory information corresponding to the plurality of microservices, the service degradation device can determine the plurality of service degradation priorities according to the service calling relationship and the plurality of memory information, and perform the microservice degradation operation according to the plurality of service degradation priorities.

[0061] In the embodiments of the present application, after the service degradation device determines the plurality of memory information corresponding to the plurality of microservices, the service degradation device can determine the plurality of service degradation priorities according to the service calling relationship and the plurality of memory information, and perform the microservice degradation operation according to the plurality of service degradation priorities.

[0062] In the embodiments of the present application, the plurality of microservices and the plurality of service degradation priorities correspond one-to-one, specifically, one microservice corresponds to one service degradation priority.

[0063] It should be noted that the service degradation priority includes: cache degradation, cache degradation and write degradation, cache degradation, write degradation and read degradation, cache degradation, write degradation, read degradation and fuse.

[0064] In the embodiments of the present application, the process in which the service degradation device determines the plurality of service degradation priorities according to the service calling relationship and the plurality of memory information includes: the service degradation device determines the total memory of the plurality of microservices according to the plurality of memory information; the service degradation device respectively determines the ratio between the plurality of memory information and the total memory to obtain a plurality of memory ratios; and the service degradation device determines the plurality of service degradation priorities according to the plurality of memory ratios and the service calling relationship.

[0065] In the embodiments of the present application, each of the plurality of memory information includes: heap memory (heap), thread stack application memory (thread), entire microservice class size memory (jar package), and other memory (other) including garbage collection, compilation, and the like.

[0066] In the embodiments of the present application, the service degradation device respectively determines the ratio between the plurality of memory information and the total memory, and obtains the plurality of memory ratios in the manner shown in formula (1):

[0067]

[0068] It should be noted that MM(i) is the memory ratio of the i-th microservice, M(i, heap) is the heap memory of the i-th microservice; M(i, thread) is the thread stack application memory of the i-th microservice; M(i, class) is the class size memory of the i-th microservice; M(i, other) is the other memory of the i-th microservice, and M(i, heap)+M(i, thread)+M(i, class)+M(i, other) is the memory information of the i-th microservice. is the total memory.

[0069] In the embodiments of the present application, the process of determining the plurality of service degradation priorities by the service degradation device according to the plurality of memory ratios and the service call relationship includes: the service degradation device determines a core microservice in the plurality of microservices; and in the service call relationship, determines an association degree between each microservice in the plurality of microservices and the core microservice, and obtains a plurality of association degree values; the service degradation device obtains a memory ratio coefficient and an association degree coefficient; and the service degradation device determines a plurality of service degradation priorities corresponding to the plurality of microservices according to the plurality of memory ratios, the memory ratio coefficient, the association degree coefficient, and the plurality of association degree values.

[0070] In the embodiments of the present application, the service degradation device determines the plurality of service degradation priorities corresponding to the plurality of microservices according to the plurality of memory ratios, the memory ratio coefficient, the association degree coefficient, and the plurality of association degree values in the manner shown in formula (2):

[0071] F(i)=μ1*MM(i)+μ2*MR(i) (2)

[0072] Wherein, the sum of the memory ratio coefficient μ1 and the association degree coefficient μ2 is 1, and μ1 and μ2 are both between 0 and 1. MR(i) is the association degree value of the i-th microservice. The greater the value of the calculated service degradation priority F(i) is, the smaller the priority of degradation is; otherwise, the smaller the value is, the earlier the microservice needs to be degraded.

[0073] In the embodiment of the present application, the number of core microservices is multiple, and the service degradation device determines the association degree between each microservice in the multiple microservices and the core microservices in the service calling relationship, and obtains multiple association degree values. The process includes: the service degradation device determines the first number of each group of target core microservices corresponding to each microservice from the multiple core microservices according to the service calling relationship, and obtains multiple first numbers; and the service degradation device determines the multiple association degree values according to the multiple first numbers and the number of core microservices.

[0074] In the embodiment of the present application, the process of determining the multiple association degree values by the service degradation device according to the multiple first numbers and the number of core microservices is shown in formula (3):

[0075]

[0076] In the embodiment of the present application, the service degradation device sets the number of core microservices to 0.2*m (where m is the number of multiple microservices) according to the 80-20 rule. The association degree of the ith microservice and the core service can be obtained by using formula 3. Wherein, x represents the number of association with the core service, and MR(i) represents the relationship closeness between the ith microservice and the core service.

[0077] It should be noted that the closer MR(i) is to 1, the closer the relationship between the ith microservice and the core microservice is, and the higher the association degree is, and vice versa.

[0078] In the embodiment of the present application, the process of performing microservice degradation operation by the service degradation device according to the multiple service degradation priorities includes: the service degradation device determines the remaining service priority corresponding to the remaining microservice from the multiple service degradation priorities; the service degradation device obtains the first memory occupancy corresponding to the remaining microservice from the multiple memory occupancies; and the service degradation device performs the degradation operation of the corresponding level on the remaining microservice according to the corresponding relationship between the preset memory occupancy and the preset degradation level, the first memory occupancy and the remaining service priority.

[0079] It should be noted that the remaining microservice is the microservice in the multiple microservices except the core microservice and the associated microservice. The associated microservice is the microservice associated with the core microservice in the backward direction.

[0080] In the embodiment of the present application, the process that the service degradation device determines the remaining service priority corresponding to the remaining microservice from the plurality of service degradation priorities includes: the service degradation device determines a plurality of first service priorities corresponding to the core microservice from the plurality of service degradation priorities; the service degradation device determines a second service priority corresponding to the associated microservice from the plurality of service degradation priorities; the service degradation device removes the plurality of first service priorities and the second service priority from the plurality of service degradation priorities to obtain the remaining service priority.

[0081] In the embodiment of the present application, the service degradation device can obtain the number of 1 in each column and the number of associated microservices backwardly associated with each core microservice according to the microservice association matrix table, taking the core microservice as the column element. The number of associated microservices corresponding to the core microservice obtained by traversing the microservice association matrix is Z. The number of associated microservices of the core microservice can be represented as The associated microservices between the plurality of core microservices exist in the case of depending on the same service, so there are associated microservices.

[0082] It should be noted that the number of repeated associated microservices can be Z D The number of associated services corresponding to the i-th core microservice y i is shown in formula (4):

[0083]

[0084] The number of microservices is m. The number of microservices that can be degraded (remaining microservices) is shown in formula (5):

[0085]

[0086] In the embodiment of the present application, the core microservice is selected by using the 80-20 rule. Then, the number of associated microservices can be obtained according to formula 4. The number of microservices that can be degraded in the plurality of microservices is obtained by using formula 5. The order set of microservices that can be degraded in the microservice system is constructed to perform the microservice degradation operation on the microservices in the order set of microservices that can be degraded.

[0087] It should be noted that the construction steps of the microservice degradation order set include: first, divide the core microservice and the non-core microservice of the microservice by using the 80-20 rule, and save the core microservice of the microservice in a size of Array1. Then, the association matrix of the core microservice based microservice is constructed by using the method of constructing the association matrix, the associated microservice of the core microservice can be obtained, and the associated microservice is saved in an array Array2 with a size of j. After that, the remaining microservices in the microservice system which do not contain the core microservice and the associated microservice are saved in an array Array3 with a size of j. Then, each service in the three arrays Array1-Array3 is sorted from low to high according to the corresponding service degradation priority F(i) respectively. Finally, each element in the three arrays is merged in the order of Array3 to Array1, and saved in a complete chain table (list) arranged in order and descending in each array. At this time, the corresponding service degradation order set list in the entire chain table is The service degradation method is executed by the service degradation device (including service registration, service list, performance detection center, service degradation, service state monitoring center and the like) shown in three parts, and the execution flowchart of the service degradation method is shown in Figure 4 Figure 5

[0088] S50, the service degradation device determines a plurality of microservices related to the access information in the access instruction in the case of receiving the microservice access instruction transmitted by the client.

[0089] S51, the service degradation device obtains the service calling relationship between the plurality of microservices; and determines a plurality of memory information corresponding to the plurality of microservices.

[0090] S52, the service degradation device determines the total memory of the plurality of microservices according to the plurality of memory information; and respectively determines the ratio between the plurality of memory information and the total memory to obtain a plurality of memory ratios.

[0091] S53, the service degradation device determines the core microservice in the plurality of microservices; and in the service calling relationship, determines the first quantity of each group of target core microservices corresponding to each microservice from the plurality of core microservices according to the service calling relationship, to obtain a plurality of first quantities.

[0092] S54, the service degradation device determines a plurality of association degree values according to the plurality of first quantities and the number of core microservices.

[0093] S55, the service degradation device obtains a memory ratio coefficient and an association degree coefficient; and determines a plurality of service degradation priorities corresponding to the plurality of microservices according to the plurality of memory ratios, the memory ratio coefficient, the association degree coefficient and the plurality of association degree values.

[0094] S56, the service degradation device determines a plurality of first service priorities corresponding to the core microservice from the plurality of service degradation priorities.​​

[0095] S57, the service degradation device determines a second service priority corresponding to the associated microservice from the plurality of service degradation priorities.

[0096] S58, the service degradation device removes the plurality of first service priorities and the second service priority from the plurality of service degradation priorities to obtain a remaining service priority.

[0097] It should be noted that the remaining microservice is a microservice in the plurality of microservices except the core microservice and the associated microservice backwardly associated with the core microservice.

[0098] S59, the service degradation device obtains a first memory occupation ratio corresponding to the remaining microservice from the plurality of memory occupation ratios; and performs a corresponding level of degradation operation on the remaining microservice according to a corresponding relationship between a preset memory occupation ratio and a preset degradation level, the first memory occupation ratio, and the remaining service priority.

[0099] Exemplarily, the service degradation method in the embodiment of the present application and the automatic timeout degradation algorithm and the automatic flow limiting method are compared in the case of system load and read-write capability as shown in the following table: Figure 6 wherein the line with square is the read-write capability curve corresponding to the service degradation method in the embodiment of the present application; the line with triangle is the read-write capability curve corresponding to the automatic flow limiting method; and the line with circle is the read-write capability curve corresponding to the automatic timeout degradation algorithm. With the gradual increase of the concurrency (the horizontal axis is the concurrency, and the unit is ten thousand), the read-write capability of the degradation mode corresponding to the service degradation method in the embodiment of the present application, the automatic flow limiting method and the automatic timeout degradation algorithm gradually decreases, but the read-write capability of the degradation mode corresponding to the service degradation method in the embodiment of the present application is higher than that of the automatic flow limiting method and the automatic timeout degradation algorithm, and the degradation mode corresponding to the service degradation method in the embodiment of the present application is superior to the automatic flow limiting method and the automatic timeout degradation algorithm.

[0100] Exemplarily, the service degradation method in the embodiment of the present application and the automatic timeout degradation algorithm and the automatic flow limiting method are compared in the case of system availability as shown in the following table: Figure 7As shown: the line with square is the availability curve corresponding to the service degradation method in the embodiment of the present application; the line with triangle is the availability curve corresponding to the automatic flow limiting method; the line with circle is the availability curve corresponding to the automatic timeout degradation algorithm. With the gradual increase of the concurrency (the horizontal axis is the concurrency, the unit is ten thousand), the availability of the degradation mode corresponding to the service degradation method, the automatic flow limiting method and the automatic timeout degradation algorithm in the embodiment of the present application gradually decreases, and the availability of the degradation mode corresponding to the automatic flow limiting method and the automatic timeout degradation algorithm decreases more sharply. At the same concurrency, the availability of the degradation mode corresponding to the service degradation method in the embodiment of the present application is higher than the availability of the degradation mode corresponding to the automatic flow limiting method and the automatic timeout degradation algorithm, which is superior to the degradation mode corresponding to the automatic flow limiting method and the automatic timeout degradation algorithm.

[0101] For example, the load comparison chart of the service degradation method in the embodiment of the present application and the automatic timeout degradation algorithm and the automatic flow limiting method is as shown in Figure 8 As shown: the line with square is the load curve corresponding to the service degradation method in the embodiment of the present application; the line with triangle is the load curve corresponding to the automatic flow limiting method; the line with circle is the load curve corresponding to the automatic timeout degradation algorithm. With the gradual increase of the concurrency (the horizontal axis is the concurrency, the unit is ten thousand), the load of the degradation mode corresponding to the service degradation method, the automatic flow limiting method and the automatic timeout degradation algorithm in the embodiment of the present application gradually increases, and the load of the degradation mode corresponding to the automatic flow limiting method and the automatic timeout degradation algorithm increases more sharply. At the same concurrency, the load of the degradation mode corresponding to the service degradation method in the embodiment of the present application is lower than the load of the degradation mode corresponding to the automatic flow limiting method and the automatic timeout degradation algorithm, which is superior to the degradation mode corresponding to the automatic flow limiting method and the automatic timeout degradation algorithm. When the concurrency QPS reaches 120,000, the load is still lower than 30%, which is superior to the degradation mode corresponding to the automatic flow limiting method and the automatic timeout degradation algorithm.

[0102] In the embodiment of the present application, the preset degradation level includes four levels, wherein the first level is cache degradation, the second level is cache degradation and write degradation, the third level is cache degradation, write degradation and read degradation, and the fourth level is cache degradation, write degradation, read degradation and fuse. The specific corresponding relationship between the preset memory ratio and the preset degradation level is as shown in Figure 9It is shown that: in the case that the first memory ratio of the remaining microservice is greater than or equal to 50% and less than 60% (that is, a blue storm), it is determined that the remaining service priority of the remaining microservice is cache degradation; in the case that the first memory ratio of the remaining microservice is greater than or equal to 60% and less than 70% (that is, a yellow storm), it is determined that the remaining service priority of the remaining microservice is cache degradation and write degradation; in the case that the first memory ratio of the remaining microservice is greater than or equal to 70% and less than 80% (that is, an orange storm), it is determined that the remaining service priority of the remaining microservice is cache degradation, write degradation and read degradation; in the case that the first memory ratio of the remaining microservice is greater than or equal to 80% (that is, a red storm), it is determined that the remaining service priority of the remaining microservice is cache degradation, write degradation, read degradation and fuse.

[0103] It can be understood that the service degradation apparatus determines the plurality of service degradation priorities corresponding to the plurality of microservices according to the plurality of memory information corresponding to the plurality of microservices and the service call relationship between the plurality of microservices by acquiring the service call relationship between the plurality of microservices, so as to execute the microservice degradation operation according to the plurality of service degradation priorities, that is, to execute the degradation operation on the remaining microservices except the core microservice and the associated microservice associated with the core microservice, and the dependency between the remaining microservices and the core microservice is weak, so that the degradation operation on the remaining microservices will not affect the core microservice, so that the access process corresponding to the microservice access instruction can be normally executed, and the access efficiency during microservice access is improved.

[0104] Based on the same inventive concept of the above embodiment, the embodiment of the present application provides a service degradation apparatus 1 corresponding to a service degradation method; Figure 10 The composition structure of a service degradation apparatus provided by the embodiment of the present application is shown in Figure 1 The service degradation apparatus 1 can include:

[0105] A determination unit 11 is configured to determine a plurality of microservices related to access information in a microservice access instruction transmitted by a client; determine a plurality of memory information corresponding to the plurality of microservices; and determine a plurality of service degradation priorities according to a service call relationship and the plurality of memory information;

[0106] An acquisition unit 12 is configured to acquire the service call relationship between the plurality of microservices;

[0107] An execution unit 13 is configured to execute a microservice degradation operation according to the plurality of service degradation priorities.

[0108] In some embodiments of the present application, the determining unit 11 is configured to determine a plurality of memory information corresponding to the plurality of microservices; and determine the plurality of service degradation priorities according to the service calling relationship and the plurality of memory information.

[0109] In some embodiments of the present application, the determining unit 11 is configured to determine a total memory of the plurality of microservices according to the plurality of memory information; determine a ratio between the plurality of memory information and the total memory respectively to obtain a plurality of memory ratios; and determine the plurality of service degradation priorities according to the plurality of memory ratios and the service calling relationship.

[0110] In some embodiments of the present application, the determining unit 11 is configured to determine a core microservice in the plurality of microservices; determine an association degree between each microservice in the plurality of microservices and the core microservice in the service calling relationship to obtain a plurality of association degree values; and determine the plurality of service degradation priorities corresponding to the plurality of microservices according to the plurality of memory ratios, a memory ratio coefficient, an association degree coefficient and the plurality of association degree values.

[0111] The obtaining unit 12 is configured to obtain a memory ratio coefficient and an association degree coefficient.

[0112] In some embodiments of the present application, the determining unit 11 is configured to determine a first number of each group of target core microservices corresponding to each microservice from a plurality of core microservices according to the service calling relationship to obtain a plurality of first numbers; and determine the plurality of association degree values according to the plurality of first numbers and a number of the core microservices.

[0113] In some embodiments of the present application, the determining unit 11 is configured to determine a remaining service priority corresponding to a remaining microservice from the plurality of service degradation priorities; the remaining microservice is a microservice other than a core microservice and an associated microservice in the plurality of microservices; and the associated microservice is a microservice backwardly associated with the core microservice.

[0114] The obtaining unit 12 is configured to obtain a first memory ratio corresponding to the remaining microservice from the plurality of memory ratios.

[0115] The executing unit 13 is configured to perform a degradation operation of a corresponding level on the remaining microservice according to a corresponding relationship between a preset memory ratio and a preset degradation level, the first memory ratio and the remaining service priority.

[0116] In some embodiments of the present application, the apparatus further comprises a removing unit.

[0117] The determining unit 11 is used to determine multiple first service priorities corresponding to the core microservice from the multiple service degradation priorities; and to determine a second service priority corresponding to the associated microservice from the multiple service degradation priorities.

[0118] The removal unit is used to remove the plurality of first service priorities and second service priorities from the plurality of service degradation priorities to obtain the remaining service priorities.

[0119] In some embodiments of this application, the apparatus further includes an establishment unit;

[0120] The acquisition unit 12 is used to acquire the first backward-associated microservice corresponding to the first microservice from the microservice registry; the first microservice is all the microservices included in the microservice registry; the first microservice includes the plurality of microservices;

[0121] The establishment unit is used to establish a backward association relationship between the first microservice and the first backward association microservice;

[0122] Accordingly, the acquisition unit 12 is used to acquire the service call relationship from the backward association relationship.

[0123] It should be noted that, in practical applications, the aforementioned determining unit 11, obtaining unit 12, and executing unit 13 can be implemented by the processor 14 on the service degradation device 1, specifically by a CPU (Central Processing Unit), MPU (Microprocessor Unit), DSP (Digital Signal Processor), or Field Programmable Gate Array (FPGA), etc.; the aforementioned data storage can be implemented by the memory 15 on the service degradation device 1.

[0124] This application embodiment also provides a service degradation device 1, such as... Figure 11 As shown, the service degradation device 1 includes a processor 14, a memory 15, and a communication bus 16. The memory 15 communicates with the processor 14 through the communication bus 16. The memory 15 stores programs executable by the processor 14. When the program is executed, the processor 14 performs the service degradation method as described above.

[0125] In practical applications, the memory 15 can be a volatile memory, such as a Random-Access Memory (RAM), or a non-volatile memory, such as a Read-Only Memory (ROM), a flash memory, a Hard Disk Drive (HDD) or a Solid-State Drive (SSD), or a combination of the above kinds of memories, and provides instructions and data to the processor 14.

[0126] The embodiment of the present application provides a computer readable storage medium, which has a computer program, and the program is executed by the processor 14 to implement the service degradation method.

[0127] It can be understood that the service degradation apparatus acquires the service calling relationship among the plurality of microservices, determines the plurality of service degradation priorities corresponding to the plurality of microservices according to the plurality of memory information corresponding to the plurality of microservices and the service calling relationship, and executes the microservice degradation operation on the plurality of service degradation priorities according to the plurality of service degradation priorities, that is, the degradation operation is first executed on the remaining microservices except the core microservice and the associated microservice associated with the core microservice, and the dependency between the remaining microservices and the core microservice is weak, so that the core microservice is not affected when the degradation operation is executed on the remaining microservices, so that the access process corresponding to the microservice access instruction can be normally executed, and the access efficiency during microservice access is improved.

[0128] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can be in the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer usable program code.

[0129] The present application is described with reference to flowcharts and / or block diagrams according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1apparatus for performing the functions specified in the flow or flows and / or blocks. Figure 1

[0130] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow Figure 1 apparatus for performing the functions specified in the flow or flows and / or blocks. Figure 1

[0131] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions that are executed on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 apparatus for performing the functions specified in the flow or flows and / or blocks. Figure 1

[0132] The above description is only preferred embodiments of the present application, and not intended to limit the protection scope of the present application.​​​

Claims

1. A service degradation method, characterized in that, The method includes: Upon receiving a microservice access instruction transmitted by a client, identify multiple microservices related to the access information in the access instruction; Obtain the service call relationships between the multiple microservices; Determine multiple memory information corresponding to the multiple microservices; Based on the service call relationship and the multiple memory information, determine the service degradation priority and perform microservice degradation operation according to the service degradation priority; The step of determining the service degradation priority based on the service call relationship and the multiple memory information includes: The total memory of the multiple microservices is determined based on the multiple memory information. The ratios between the plurality of memory information and the total memory are determined to obtain the plurality of memory percentages; Based on the memory percentages and service call relationships, the service degradation priority is determined. The step of determining the service degradation priority based on the multiple memory percentages and the service call relationships includes: Identify the core microservice among the multiple microservices; and in the service call relationship, determine the degree of association between each of the multiple microservices and the core microservice, obtaining multiple degree of association values; Obtain the memory usage ratio and correlation coefficient; Based on the multiple memory percentages, the memory percentage coefficient, the correlation coefficient, and the multiple correlation values, the service degradation priorities corresponding to the multiple microservices are determined.

2. The method according to claim 1, characterized in that, The number of core microservices is multiple. In the service call relationship, the degree of association between each of the multiple microservices and the core microservice is determined, resulting in multiple association degree values, including: Based on the service call relationship, a first number of target core microservices corresponding to each microservice is determined from multiple core microservices, resulting in multiple first numbers; The multiple association degree values ​​are determined based on the multiple first quantities and the number of core microservices.

3. The method according to claim 1, characterized in that, The step of performing microservice degradation operations according to the multiple service degradation priorities includes: The remaining service priorities are determined from the multiple service degradation priorities; the remaining microservices are the microservices other than the core microservice and related microservices; the related microservices are the microservices that are backward associated with the core microservice. Obtain the first memory percentage corresponding to the remaining microservice from the multiple memory percentages; Based on the correspondence between the preset memory percentage and the preset degradation level, the first memory percentage, and the priority of the remaining services, the remaining microservices are subjected to a degradation operation of the corresponding level.

4. The method according to claim 3, characterized in that, Determining the remaining service priority corresponding to the remaining microservice from the plurality of service degradation priorities includes: From the multiple service degradation priorities, multiple first service priorities corresponding to the core microservice are determined; The second service priority corresponding to the associated microservice is determined from the plurality of service degradation priorities; The remaining service priorities are obtained by removing the first service priority and the second service priority from the plurality of service degradation priorities.

5. The method according to claim 1, characterized in that, Before obtaining the service call relationships between the multiple microservices, the method further includes: Obtain the first backward-associated microservice corresponding to the first microservice from the microservice registry; the first microservice is all the microservices included in the microservice registry; the first microservice includes the multiple microservices. Establish a backward association relationship between the first microservice and the first backward-associated microservice; Accordingly, obtaining the service call relationship between the multiple microservices includes: The service call relationship is obtained from the backward association relationship.

6. A service degradation device, characterized in that, The device includes: The determining unit is configured to, upon receiving a microservice access instruction transmitted by a client, determine multiple microservices related to the access information in the access instruction; determine multiple memory information corresponding to the multiple microservices; and determine the degrading priority of the multiple services based on the service call relationship and the multiple memory information. The acquisition unit is used to acquire the service call relationships between the multiple microservices; The execution unit is used to perform microservice degradation operations according to the multiple service degradation priorities; The determining unit is configured to: determine the total memory of the multiple microservices based on the multiple memory information; determine the ratio between the multiple memory information and the total memory to obtain the multiple memory percentages; determine the service degradation priority based on the multiple memory percentages and the service call relationship; determine the core microservice among the multiple microservices; and determine the degree of association between each microservice and the core microservice in the service call relationship to obtain multiple association degree values; and determine the service degradation priority corresponding to the multiple microservices based on the multiple memory percentages, the memory percentage coefficient, the association degree coefficient, and the multiple association degree values. The acquisition unit is used to acquire the memory proportion coefficient and the correlation coefficient.

7. A service degradation device, characterized in that, The device includes: The system includes a memory, a processor, and a communication bus, wherein the memory communicates with the processor via the communication bus, and the memory stores a service degradation program executable by the processor. When the service degradation program is executed, the method described in any one of claims 1 to 5 is performed by the processor.

8. A storage medium storing a computer program thereon for use in a service degradation device, characterized in that, When executed by a processor, the computer program implements the method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Service degradation processing method and apparatus

    CN107592219A

  • Service degradation processing method and device

    CN113254203A