Service risk assessment method and device, electronic equipment and storage medium
By obtaining the names and mapping relationships of service instances and calculating the number and distribution uniformity of service instances on physical machines, the problem of being unable to pre-assess service risks in existing technologies is solved, risk assessment and distribution adjustment before hardware failure is achieved, and system stability is improved.
Patent Information
- Application Number
- CN202510768931.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-09-16
AI Technical Summary
Existing technologies are unable to effectively pre-assess the risk level of services before physical machine hardware failures, resulting in service instance interruptions when hardware failures occur.
By obtaining the name of the target service and the name of the service instance, the mapping relationship is used to determine the number of service instances running on each physical machine, the difference and variance values are calculated, the risk level of the service is evaluated, and the distribution of service instances is adjusted to be uniform in high-risk situations.
It achieves effective prediction and assessment of service risk levels before hardware failure, reduces the impact of hardware failure on service instances, and improves system stability and reliability.
Smart Images

Figure CN120653524A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a service risk assessment method, device, electronic device, and storage medium. Background Art
[0002] In current computer technology, programs with complex functions can be split into multiple services, which work together to realize the overall function of the program.
[0003] Each service can include multiple service instances, each providing the same functionality and providing redundancy and backup. Multiple service instances corresponding to the same service can be distributed across different physical machines. Specifically, service instances can run on physical machines, within virtual machines, or within containers within physical machines.
[0004] In existing technologies, when a physical machine experiences certain types of hardware failures (such as memory failures), the physical machine may not function properly, leading to interruptions in service instances running on that physical machine, which in turn creates certain risks. However, current technologies cannot effectively assess the risk level of services before a hardware failure occurs. Summary of the Invention
[0005] In view of this, embodiments of the present application provide a service risk assessment method, device, electronic device, and storage medium, which can effectively assess the risk level of a service in advance.
[0006] In the first aspect, an embodiment of the present application provides a service risk assessment method, including: obtaining the name of a target service, and based on the name of the target service, obtaining the names of all service instances included in the target service; determining the number of service instances running on each physical machine based on the name of each service instance and a first mapping relationship; the first mapping relationship is a mapping relationship between the name of each service instance and the identifier of the physical machine where each service instance is located; and determining the risk level of the target service based on the number of service instances running on each physical machine.
[0007] Optionally, determining the risk level of the target service based on the number of the service instances running on each physical machine includes: determining the maximum number of the service instances running on a single physical machine based on the number of the service instances running on each physical machine; calculating a first difference between the total number of the service instances and the maximum number; comparing the first difference with the current minimum number requirement for the service instances; and determining the risk level of the target service based on the comparison result.
[0008] Optionally, determining the risk level of the target service based on the number of the service instances running on each physical machine includes: calculating the variance value of the number of the service instances running on each physical machine; and determining the risk level of the target service based on the variance value.
[0009] Optionally, determining the risk level of the target service based on the number of the service instances running on each physical machine includes: determining the maximum number of the service instances running on a single cabinet based on the number of the service instances running on each physical machine; wherein each of the cabinets includes at least one physical machine; calculating a second difference between the total number of the service instances and the maximum number; comparing the second difference with the current minimum number requirement for the service instances; and determining the risk level of the target service based on the comparison result.
[0010] Optionally, determining the risk level of the target service based on the number of service instances running on each physical machine includes: determining the maximum number of the service instances running on a single cabinet column based on the number of the service instances running on each physical machine; wherein each of the cabinet columns includes at least one cabinet, and each of the cabinets includes at least one physical machine; calculating a third difference between the total number of the service instances and the maximum number; comparing the third difference with the current minimum number requirement for the service instances; and determining the risk level of the target service based on the comparison result.
[0011] Optionally, the method further includes: when the risk level of the target service is high risk, adjusting the distribution number of service instances included in the target service on each physical machine to make the distribution number of the service instances on each physical machine more even.
[0012] Optionally, before determining the number of the service instances running on each physical machine based on the name of each service instance and the first mapping relationship, the method further includes: detecting whether each service instance is in a healthy state based on the name of each service instance to obtain the name of the service instance in a healthy state; determining the number of the service instances running on each physical machine based on the name of each service instance and the first mapping relationship includes: determining the number of service instances in a healthy state running on each physical machine based on the name of each service instance in a healthy state and the first mapping relationship; determining the risk level of the target service based on the number of service instances running on each physical machine includes: determining the risk level of the target service based on the number of service instances in a healthy state running on each physical machine.
[0013] Optionally, the method also includes: in the event of a hardware failure on the first physical machine, obtaining the identifier of the first physical machine; obtaining the name of the service instance running on the first physical machine based on the identifier of the first physical machine; obtaining the name of the first service based on the name of the service instance running on the first physical machine; the first service is the service to which the service instance running on the first physical machine belongs; determining the total number of all service instances included in the first service based on the name of the first service; determining the risk level of the first service based on the total number of all service instances included in the first service, the number of service instances running on the first physical machine, and the current minimum number requirement for the service instances.
[0014] In the second aspect, an embodiment of the present application also provides a service risk level assessment device, including: an acquisition module, used to obtain the name of the target service, and according to the name of the target service, obtain the names of all service instances included in the target service; a first determination module, used to determine the number of the service instances running on each physical machine according to the name of each service instance and a first mapping relationship; the first mapping relationship is a mapping relationship between the name of each service instance and the identifier of the physical machine where each service instance is located; a second determination module, used to determine the risk level of the target service according to the number of the service instances running on each physical machine.
[0015] On the third aspect, an embodiment of the present application also provides an electronic device, which includes: a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the shell, and the processor and the memory are set on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory, and is used to execute the risk assessment method of any service provided by the embodiment of the present application.
[0016] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement a risk assessment method for any service provided by an embodiment of the present application.
[0017] The risk assessment method, device, electronic device and storage medium of the service provided by the embodiments of the present application can obtain the name of the target service by obtaining the name of the target service, and obtain the names of all service instances included in the target service according to the name of the target service. Then, according to the name of each of the service instances and the first mapping relationship, the number of the service instances running on each physical machine can be determined. And then, according to the number of the service instances running on each physical machine, the risk level of the target service can be determined. In this way, the embodiments of the present application can effectively evaluate the risk level of the service in advance before a hardware failure occurs on the physical machine based on the number of service instances running on each physical machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A schematic diagram of an application scenario of the risk assessment method for the service provided in the embodiments of the present application;
[0020] Figure 2 A schematic diagram of a flow chart of a risk assessment method for a service provided in an embodiment of the present application;
[0021] Figure 3 A schematic diagram of a structure of a risk assessment device for a service provided in an embodiment of the present application;
[0022] Figure 4 A schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0024] It should be clear that the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0025] In a first aspect, an embodiment of the present application provides a service risk assessment method that can pre-assess the risk level of a service.
[0026] like Figure 1As shown, the embodiment of the present application provides a specific application scenario of a service risk assessment method. The service risk assessment method provided by the embodiment of the present application can be specifically applied to Figure 1 The monitoring computer shown in is used to evaluate the risk level of a service to which a service instance running on a physical machine belongs, wherein the number of physical machines is usually multiple. Exemplarily, the monitoring computer may be a server.
[0027] The embodiment of the present application provides a service risk assessment method, the flow chart of the service risk assessment method is as follows: Figure 2 As shown, the following steps may be specifically included:
[0028] S21, obtaining a name of a target service, and according to the name of the target service, obtaining names of all service instances included in the target service.
[0029] In this step, when registering a service instance, a mapping relationship is established between the name of the service instance and the name of the service to which it belongs. For example, service A includes nine service instances, namely service instances A1 through A9. When registering service instance A1, the name of service instance A1 is mapped to the name of service A. The same applies to service instances A2 through A8, which will not be detailed here.
[0030] In the case where the target service is service A, after obtaining the name of service A, the monitoring computer can obtain the names of the nine service instances included in service A according to the pre-established mapping relationship.
[0031] S22: Determine the number of the service instances running on each physical machine according to the name of each service instance and a first mapping relationship; the first mapping relationship is a mapping relationship between the name of each service instance and the identifier of the physical machine where each service instance is located;
[0032] In this step, during the registration process of the service instance, a mapping relationship (ie, a first mapping relationship) between the name of the service instance and the identifier of the physical machine where the service instance is located can be automatically established.
[0033] Specifically, a service instance can run directly on a physical machine or in a virtual machine or container on a physical machine.
[0034] When a service instance runs directly on a physical machine, a mapping relationship can be established between the service instance name and the identifier of the physical machine where the service instance resides when registering the service instance. Specifically, the identifier of the physical machine can be the Internet Protocol Address (IP address) or Media Access Control Address (MAC address) of the physical machine.
[0035] If the service instance runs in a virtual machine or container on a physical machine, when registering the service instance, a mapping relationship can be established between the service instance name and the identifier of the virtual machine (or container), and a mapping relationship can be established between the identifier of the virtual machine (or container) and the identifier of the physical machine where the virtual machine resides. For example, the identifier of the virtual machine can be the virtual IP address of the virtual machine, and the identifier of the container can be the virtual IP address of the container.
[0036] Therefore, according to the name of each service instance and the aforementioned mapping relationship (ie, the first mapping relationship), the name of the physical machine where each service instance is located can be determined, and thus the number of service instances running on each physical machine can be calculated.
[0037] In a specific example, service instances A1 and A2 run on a physical machine M. When registering service instance A1, a mapping relationship can be established between the name of service instance A1 and the identifier of physical machine M. The same is true for service instance A2.
[0038] Service instances A3 and A4 run on physical machine N. When registering service instance A3, a mapping relationship can be established between the name of service instance A3 and the identifier of physical machine N. The same is true for service instance A4.
[0039] Service instances A5 to A9 run on physical machine P. When registering service instance A5, a mapping relationship can be established between the name of service instance A5 and the identifier of physical machine P. The same is true for service instances A6 to A9.
[0040] Based on this, and using the name of service instance A1 and the previously established mapping, we can determine that service instance A1 is running on physical machine M. Similarly, we can determine that service instance A2 is running on physical machine M. We can also determine that service instances A3 and A4 are running on physical machine N, and service instances A5 and A9 are running on physical machine P. Furthermore, we can determine that the number of service instances running on physical machine M is 2, the number of service instances running on physical machine N is 2, and the number of service instances running on physical machine P is 5.
[0041] S23: Determine the risk level of the target service according to the number of service instances running on each physical machine.
[0042] In this step, based on the number of service instances running on each physical machine, it can be determined whether the service instances on each physical machine are evenly distributed, and further the risk level of the target service when a hardware failure occurs can be determined.
[0043] The risk assessment method for services provided by the embodiments of the present application can obtain the name of the target service, and based on the name of the target service, obtain the names of all service instances included in the target service. Then, based on the names of each of the service instances and the first mapping relationship, the number of the service instances running on each physical machine can be determined. Furthermore, the risk level of the target service can be determined based on the number of service instances running on each physical machine. In this way, the embodiments of the present application can effectively assess the risk level of the service in advance before a hardware failure occurs on the physical machine based on the number of service instances belonging to the same service running on each physical machine.
[0044] Optionally, in one embodiment of the present application, determining the risk level of the target service based on the number of the service instances running on each physical machine (step S23) may include: determining the maximum number of the service instances running on a single physical machine based on the number of the service instances running on each physical machine; calculating a first difference between the total number of the service instances and the maximum number; comparing the first difference with the current minimum number requirement for the service instances; and determining the risk level of the target service based on the comparison result.
[0045] In an embodiment of the present application, after determining the number of service instances running on each physical machine, the maximum number of service instances running on a single physical machine can be determined. Continuing with the previous example, if it is determined that there are two service instances running on physical machine M, two service instances running on physical machine N, and five service instances running on physical machine P, it can be determined that physical machine P has the largest number of service instances running, i.e., the maximum number of service instances running on a single physical machine is five.
[0046] Then, the difference between the total number of service instances and the maximum number (i.e., the first difference) can be calculated. By comparing the first difference with the current minimum number requirement for service instances, a corresponding comparison result can be obtained. If, in the comparison result, the first difference is greater than or equal to the current minimum number requirement for service instances, it indicates that in the worst case of a hardware failure on a single physical machine (i.e., a hardware failure on physical machine P), the five service instances running on physical machine P will be interrupted, and the remaining four service instances can still meet the current minimum number requirement for service instances. Therefore, the risk level of the target service can be determined to be a low risk level.
[0047] Similarly, if in the comparison result, the first difference is less than the current minimum number requirement for service instances, it indicates that in the worst case scenario of a hardware failure on a single physical machine (that is, a hardware failure on physical machine P), the five service instances running on physical machine P will be interrupted, and the remaining four service instances cannot meet the current minimum number requirement for service instances. Therefore, it can be determined that the risk level of the target service is a high risk level.
[0048] Optionally, in one embodiment of the present application, determining the risk level of the target service based on the number of service instances running on each physical machine (step S23) may include: calculating the variance value of the number of service instances running on each physical machine; and determining the risk level of the target service based on the variance value.
[0049] In an embodiment of the present application, the variance value of the number of service instances running on each physical machine can be calculated. This variance value represents the uniformity of the distribution of the number of service instances on each physical machine. The smaller the variance value, the more uniform the distribution of service instances on each physical machine. In particular, if the variance value is 0, it indicates that the number of service instances on each physical machine is equal.
[0050] The variance value can then be compared with a preset variance threshold. If the variance value is greater than or equal to the preset variance threshold, it indicates that the distribution of service instances is relatively uneven, and the maximum number of service instances running on a single physical machine is generally large. If a hardware failure occurs on the physical machine running the maximum number of service instances, a large number of service instances will be interrupted. Therefore, the risk level of the target service can be determined to be high. Similarly, if the variance value is less than the preset threshold, it indicates that the distribution of service instances is relatively even, and the maximum number of service instances running on a single physical machine is generally small. If a hardware failure occurs on the physical machine running the maximum number of service instances, a small number of service instances will be interrupted. Therefore, the risk level of the target service can be determined to be low.
[0051] In a specific example, using the previous example, assuming that two service instances are running on physical machine M, two service instances are running on physical machine N, and five service instances are running on physical machine P, the variance of the number of service instances running on each physical machine can be calculated to be 2. If the variance threshold is 1.6, since this variance is greater than the variance threshold, the risk level of service A can be determined to be high.
[0052] Optionally, in one embodiment of the present application, determining the risk level of the target service based on the number of the service instances running on each physical machine (step S23) includes: determining the maximum number of the service instances running on a single cabinet based on the number of the service instances running on each physical machine; wherein each of the cabinets includes at least one physical machine; calculating a second difference between the total number of the service instances and the maximum number; comparing the second difference with the current minimum number requirement for the service instances; and determining the risk level of the target service based on the comparison result.
[0053] In this embodiment of the present application, the risk level of the target service when a hardware failure occurs in a cabinet can be evaluated from the cabinet dimension. Generally speaking, all physical machines in each cabinet are powered by the same power module. When a hardware failure occurs in this power module, all physical machines in the cabinet will not be able to operate normally.
[0054] After determining the number of service instances running on each physical machine, the number of service instances running on each cabinet can be determined in combination with the cabinet to which each physical machine belongs, and the maximum number of service instances running on a single cabinet can be determined.
[0055] Continuing with the previous example, if physical machines M and N are located in cabinet E, and physical machine P is located in cabinet F, then based on the number of service instances running on each physical machine, we can determine that the number of service instances running in cabinet E is 4, and the number of service instances running in cabinet F is 5. Therefore, we can determine that the maximum number of service instances running in a single cabinet (i.e., cabinet F) is 5.
[0056] Then, the difference between the total number of service instances and the maximum number (i.e., the second difference) can be calculated. By comparing the second difference with the current minimum number requirement for service instances, a corresponding comparison result can be obtained. If, in the comparison result, the second difference is greater than or equal to the current minimum number requirement for service instances, it indicates that in the worst case of a hardware failure in a single cabinet (i.e., a hardware failure in cabinet F), the 5 service instances running on cabinet F will be interrupted. At this time, the remaining 4 service instances running on cabinet E can still meet the current minimum number requirement for service instances (for example, the minimum number requirement is 3 service instances), so the risk level of the target service can be determined to be a low risk level.
[0057] Similarly, if in the comparison result, the second difference is less than the current minimum number requirement for service instances, it indicates that in the worst case of a hardware failure in a single cabinet (that is, a hardware failure in cabinet F), the five service instances running on cabinet F will be interrupted, and the remaining four service instances running on cabinet E cannot meet the current minimum number requirement for service instances (for example, the minimum number requirement is 6 service instances). Therefore, it can be determined that the risk level of the target service is a high risk level.
[0058] Optionally, in one embodiment of the present application, determining the risk level of the target service based on the number of service instances running on each physical machine (step S23) may include: determining the maximum number of the service instances running on a single cabinet column based on the number of the service instances running on each physical machine; wherein each of the cabinet columns includes at least one cabinet, and each of the cabinets includes at least one physical machine; calculating a third difference between the total number of the service instances and the maximum number; comparing the third difference with the current minimum number requirement for the service instances; and determining the risk level of the target service based on the comparison result.
[0059] In the embodiment of the present application, the risk level of the target service can be evaluated from the perspective of a cabinet row. Generally speaking, a cabinet row may include multiple cabinets, and each cabinet may include multiple physical machines.
[0060] After determining the number of service instances running on each physical machine, combined with the cabinets to which each physical machine belongs and the cabinet columns to which each cabinet belongs, the number of service instances running on each cabinet column can be determined, and then the maximum number of service instances running on a single cabinet can be determined.
[0061] Continuing with the previous example, physical machines M and N are located in cabinet E, which is located in cabinet row A. Physical machine P is located in cabinet F, which is located in cabinet row B. Based on the number of service instances running on each physical machine, we can determine that the number of service instances running in cabinet row A is 4, and the number of service instances running in cabinet row B is 5. Therefore, we can determine that the maximum number of service instances running in a single cabinet row (i.e., cabinet row B) is 5.
[0062] Then, the difference between the total number of service instances and the maximum number (i.e., the third difference) can be calculated. By comparing the third difference with the current minimum number requirement for service instances, a corresponding comparison result can be obtained. If, in the comparison result, the third difference is greater than or equal to the current minimum number requirement for service instances, it indicates that in the worst case of a hardware failure in a single cabinet row (i.e., a hardware failure in cabinet row B), the five service instances running in cabinet row B will be interrupted. At this time, the remaining four service instances running on cabinet row A can still meet the current minimum number requirement for service instances (for example, the minimum number requirement is three service instances), so it can be determined that the risk level of the target service is a low risk level.
[0063] Similarly, if in the comparison result, the third difference is less than the current minimum number requirement for service instances, it indicates that in the worst case of a hardware failure in a single cabinet row (that is, a hardware failure in cabinet row B), the five service instances running on cabinet row B will be interrupted, and the remaining four service instances running on cabinet row A cannot meet the current minimum number requirement for service instances (for example, the minimum number requirement is 6 service instances). Therefore, it can be determined that the risk level of the target service is a high risk level.
[0064] Optionally, in one embodiment of the present application, the method may further include: when the risk level of the target service is high risk, adjusting the distribution number of service instances included in the target service on each physical machine so that the distribution number of the service instances on each physical machine is more evenly distributed.
[0065] In an embodiment of the present application, if the risk level of a target service is determined to be high, the distribution of the number of service instances included in the target service on each physical machine can be adjusted to make the distribution of the service instances on each physical machine more even. Specifically, some service instances on a physical machine with a larger number of service instances can be migrated to a physical machine with a smaller number of service instances, thereby making the distribution of the service instances on each physical machine more even, thereby reducing the risk level of the target service.
[0066] In an example, service instance A5 can be migrated from physical machine P to physical machine M, and service instance A6 can be migrated from physical machine P to physical machine N, so that the number of service instances on the three physical machines is 3, thereby reducing the risk level of service A.
[0067] Optionally, in one embodiment of the present application, before determining the number of the service instances running on each physical machine according to the name of each service instance and the first mapping relationship (step S22), the method may further include: detecting whether each service instance is in a healthy state according to the name of each service instance, so as to obtain the name of the service instance in a healthy state;
[0068] Determining the number of the service instances running on each physical machine according to the name of each service instance and the first mapping relationship may include: determining the number of the service instances in a healthy state running on each physical machine according to the name of each service instance in a healthy state and the first mapping relationship;
[0069] Determining the risk level of the target service according to the number of the service instances running on each physical machine may include: determining the risk level of the target service according to the number of service instances in a healthy state running on each physical machine.
[0070] In the embodiment of the present application, since a service instance can only function normally when it is in a healthy state, when a service instance is in an unhealthy state, it indicates that the service instance cannot function normally, and therefore the service instance in the unhealthy state can be excluded. In order to filter the service instances in the unhealthy state, it is possible to first detect whether each service instance is in a healthy state based on the name of each service instance, thereby distinguishing between service instances in a healthy state and service instances in an unhealthy state, and then obtaining the name of the service instance in the healthy state.
[0071] Then, based on the name of each healthy service instance and the first mapping relationship, it can be determined on which physical machine each healthy service instance is located, and then the number of healthy service instances running on each physical machine can be calculated.
[0072] Furthermore, the risk level of the target service can be determined based on the number of healthy service instances running on each physical machine. Since unhealthy service instances are excluded, the risk level of the target service can be determined more accurately.
[0073] Optionally, in one embodiment of the present application, the method may further include: in the event of a hardware failure in the first physical machine, obtaining an identifier of the first physical machine; obtaining a name of the service instance running on the first physical machine based on the identifier of the first physical machine; obtaining a name of the first service based on the name of the service instance running on the first physical machine; the first service is a service to which the service instance running on the first physical machine belongs; determining the total number of all service instances included in the first service based on the name of the first service; determining the risk level of the first service based on the total number of all service instances included in the first service, the number of service instances running on the first physical machine, and the current minimum number requirement for the service instances.
[0074] In the embodiment of the present application, the first physical machine may be any physical machine. For example, the first physical machine may be the physical machine N in the above example.
[0075] When a hardware failure occurs on physical machine N, the names of the service instances running on physical machine N can be obtained based on the name of physical machine N, namely, the names of service instances A3 and A4. Then, based on the names of service instances A3 and A4, the names of the services to which both service instances A3 and A4 belong can be determined, namely, the name of service A.
[0076] Next, based on the name of service A, the names of all service instances included in service A, ie, the names of service instances A1 to A9, can be obtained, and then it can be determined that the total number of all service instances included in service A is 9.
[0077] Then, since the total number of all service instances included in service A is 9, and the number of service instances running on physical machine N is 2 (service instance A3 and service instance A4 respectively), it can be determined that when physical machine N fails, the number of remaining service instances that can operate normally is 7.
[0078] This risk level is compared with the current minimum requirement for the service instance to determine the risk level of service A. Specifically, if the current minimum requirement for the service instance is 5, since the number of remaining service instances that can operate normally is greater than the current minimum requirement, the risk level of service A can be determined to be low.
[0079] In an embodiment of the present application, when a hardware failure actually occurs in a physical machine, the risk level of the corresponding service can be evaluated.
[0080] In a second aspect, an embodiment of the present application provides a service risk level assessment device that can effectively assess the risk level of a service in advance.
[0081] like Figure 3 As shown, the risk level assessment device 3 of the service provided in the embodiment of the present application may include:
[0082] An acquisition module 31 is used to obtain the name of the target service, and based on the name of the target service, obtain the names of all service instances included in the target service; a first determination module 32 is used to determine the number of service instances running on each physical machine based on the name of each service instance and a first mapping relationship; the first mapping relationship is a mapping relationship between the name of each service instance and the identifier of the physical machine where each service instance is located; a second determination module 32 is used to determine the risk level of the target service based on the number of service instances running on each physical machine.
[0083] The risk level assessment device for a service provided by an embodiment of the present application can obtain the name of a target service and the names of all service instances included in the target service according to the name of the target service. Then, based on the name of each of the service instances and the first mapping relationship, the number of the service instances running on each physical machine can be determined. Furthermore, the risk level of the target service can be determined based on the number of the service instances running on each physical machine. In this way, the embodiment of the present application can effectively assess the risk level of the service in advance before a hardware failure occurs on the physical machine based on the number of service instances running on each physical machine.
[0084] On the third aspect, an embodiment of the present application provides an electronic device that can effectively assess the risk level of a service in advance.
[0085] like Figure 4 As shown, an electronic device provided by an embodiment of the present application may include: a shell 41, a processor 42, a memory 43, a circuit board 44 and a power supply circuit 45, wherein the circuit board 44 is placed inside the space enclosed by the shell 41, and the processor 42 and the memory 43 are arranged on the circuit board 44; the power supply circuit 45 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 43 is used to store executable program code; the processor 42 runs the program corresponding to the executable program code by reading the executable program code stored in the memory 43, so as to execute the risk assessment method of the service described in any of the aforementioned embodiments.
[0086] The specific execution process of the above steps by the processor 42 and the steps further executed by the processor 42 by running the executable program code can be found in the description of the above embodiment and will not be repeated here.
[0087] This electronic device exists in many forms, including but not limited to:
[0088] (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and are primarily designed to provide voice and data communications. These terminals include smartphones (e.g., iPhones), multimedia phones, feature phones, and low-end phones.
[0089] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access. These terminals include PDAs, MIDs, and UMPCs, such as the iPad.
[0090] (3) Portable entertainment devices: These devices can display and play multimedia content. These devices include audio and video players (such as iPods), handheld game consoles, e-books, smart toys, and portable car navigation devices.
[0091] (4) Service instance: A device that provides computing service instances. The composition of a service instance includes a processor, hard disk, memory, system bus, etc. The service instance is similar to the general computer architecture, but because it needs to provide highly reliable service instances, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0092] (5) Other electronic devices with data interaction functions.
[0093] Fourthly, an embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the risk assessment method of any service provided by the aforementioned embodiments, thereby also achieving the corresponding technical effects. This has been described in detail above and will not be repeated here.
[0094] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0095] Each embodiment in this specification is described in a related manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.
[0096] In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0097] For the convenience of description, the above device is described as being divided into various units / modules based on their functions. Of course, when implementing this application, the functions of each unit / module can be implemented in the same or multiple software and / or hardware.
[0098] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0099] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for assessing the risk level of a service, characterized in that: include: Obtain the name of the target service, and based on the name of the target service, obtain the names of all service instances included in the target service; Determine the number of the service instances running on each physical machine according to the name of each service instance and a first mapping relationship; the first mapping relationship is a mapping relationship between the name of each service instance and the identifier of the physical machine where each service instance is located; The risk level of the target service is determined according to the number of service instances running on each physical machine.
2. The method according to claim 1, characterized in that The determining the risk level of the target service according to the number of the service instances running on each physical machine includes: Determining the maximum number of service instances running on a single physical machine based on the number of service instances running on each physical machine; Calculating a first difference between the total number of service instances and the maximum number; comparing the first difference with a current minimum quantity requirement for the service instance; According to the comparison result, the risk level of the target service is determined.
3. The method according to claim 1, characterized in that The determining the risk level of the target service according to the number of the service instances running on each physical machine includes: Calculating the variance of the number of service instances running on each physical machine; A risk level of the target service is determined according to the variance value.
4. The method according to claim 1, wherein The determining the risk level of the target service according to the number of the service instances running on each physical machine includes: Determine the maximum number of service instances running on a single cabinet according to the number of service instances running on each physical machine; wherein each cabinet includes at least one physical machine; Calculating a second difference between the total number of the service instances and the maximum number; comparing the second difference with the current minimum quantity requirement for the service instance; According to the comparison result, the risk level of the target service is determined.
5. The method according to claim 1, wherein The determining the risk level of the target service according to the number of the service instances running on each physical machine includes: Determine the maximum number of service instances running on a single cabinet column according to the number of service instances running on each physical machine; wherein each cabinet column includes at least one cabinet, and each cabinet includes at least one physical machine; Calculating a third difference between the total number of the service instances and the maximum number; comparing the third difference with the current minimum quantity requirement for the service instance; According to the comparison result, the risk level of the target service is determined.
6. The method according to claim 1, wherein The method further comprises: When the risk level of the target service is high risk, the distribution quantity of the service instances included in the target service on each physical machine is adjusted to make the distribution quantity of the service instances on each physical machine more even.
7. The method according to claim 1, characterized in that Before determining the number of the service instances running on each physical machine according to the name of each service instance and the first mapping relationship, the method further includes: detecting whether each service instance is in a healthy state according to the name of each service instance, so as to obtain the name of the service instance in a healthy state; Determining the number of the service instances running on each physical machine according to the name of each service instance and the first mapping relationship includes: determining the number of the service instances in a healthy state running on each physical machine according to the name of each service instance in a healthy state and the first mapping relationship; Determining the risk level of the target service according to the number of the service instances running on each physical machine includes: determining the risk level of the target service according to the number of service instances in a healthy state running on each physical machine.
8. The method according to claim 1, characterized in that The method further comprises: When a hardware failure occurs on the first physical machine, obtaining an identifier of the first physical machine; Obtaining, according to the identifier of the first physical machine, a name of a service instance running on the first physical machine; Obtaining a name of the first service according to a name of the service instance running on the first physical machine; the first service is a service to which the service instance running on the first physical machine belongs; Determining, according to the name of the first service, the total number of all service instances included in the first service; The risk level of the first service is determined according to the total number of all service instances included in the first service, the number of service instances running on the first physical machine, and the current minimum number requirement for the service instances.
9. A service risk level assessment device, characterized in that: include: An acquisition module, configured to acquire the name of a target service, and based on the name of the target service, acquire the names of all service instances included in the target service; A first determination module is used to determine the number of the service instances running on each physical machine according to the name of each service instance and a first mapping relationship; the first mapping relationship is a mapping relationship between the name of each service instance and the identifier of the physical machine where each service instance is located; The second determining module is configured to determine the risk level of the target service according to the number of service instances running on each physical machine.
10. An electronic device, characterized in that: The electronic device includes: a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the service risk level assessment method according to any one of claims 1 to 8.