Method and device for processing graphics card failure in virtual cloud environment
By monitoring and synchronizing graphics card failure events and expelling services on the faulty graphics card, the deficiencies in graphics card failure handling in the virtual cloud environment are solved, and the stable operation of the virtual framework and real-time update of graphics card resources are achieved.
Patent Information
- Application Number
- CN202110384811.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-10
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-04-10
AI Technical Summary
In the virtual cloud environment, the existing technology lacks effective graphics card failure processing methods, resulting in the virtual framework being unable to operate stably, failing to shield faulty graphics cards, and affecting service availability.
By monitoring graphics card failure events, synchronizing graphics card resource information, and evicting services on the faulty graphics card in the virtual cloud environment, ensuring that newly created services do not use the faulty graphics card, the adjacency matrix is used to store graphics card resource information, combined with the apiserver and daemonset mechanisms of kubernetes. Monitor and handle graphics card failures in real time.
It realizes real-time monitoring and processing of graphics card faults in the virtual cloud environment, ensures the stable operation of the virtual framework, shields faulty graphics cards, and ensures the normal operation of services and real-time updates of resources.
Smart Images

Figure CN113157476B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of processing graphics card failures, and in particular to a method and device for processing graphics card failures in a virtual cloud environment. Background Art
[0002] In actual use, graphics card failures often occur. Graphics card failures during normal use will cause service unavailability. Services running on this graphics card should no longer continue to provide services and need to be dispatched. However, there is currently no relevant way in the industry to handle GPU graphics card failures in virtual cloud environments such as Kubernetes environments.
[0003] Previously, the physical machine GPU cluster had its own faulty graphics card shielding solution. When migrating to a virtualized cloud environment based on Kubernetes and containers, one of the characteristics of virtualization is that the application and server are decoupled and assigned by the scheduler. The specific host machine where the application runs is also uncertain and will often be migrated by the scheduler. For the client, all it can perceive is an entry address, and it has no idea about the subsequent operating environment. Therefore, the faulty graphics card shielding solution that works in a physical machine environment is invalid. There is no graphics card fault handling method for the cloud environment in the prior art, and it needs to be redesigned for the cloud environment.
[0004] In addition, for the existing virtualized architecture, the scheduling process cannot shield graphics card failures, resulting in the new architecture being unable to run stably.
[0005] In view of this, the present invention is proposed. Summary of the invention
[0006] The purpose of the present invention is to provide a shielding solution for faulty graphics cards in a virtual cloud environment to ensure stable operation of a virtual framework.
[0007] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:
[0008] The present invention provides a method for processing a graphics card failure in a virtual cloud environment, comprising:
[0009] Monitor change events that indicate graphics card failure;
[0010] Performing data synchronization processing on the stored graphics card resource information according to the change event, the graphics card resource information including the topological structure between cluster nodes, graphics cards and services in the virtual cloud environment and graphics card status information;
[0011] Based on the synchronized graphics card resource information, subsequent processing is performed on the graphics card failure in the virtual cloud environment, and the graphics card resource information is synchronously updated.
[0012] As an optional implementation manner of the present invention, an adjacency matrix is used to store the graphics card resource information; and the synchronization processing is to perform data synchronization processing on the adjacency matrix.
[0013] As an optional implementation manner of the present invention, the virtual cloud environment is a virtual cloud environment based on Kubernetes; the processing method further comprises: obtaining graphics card fault information, and creating a configuration file in a namespace to record the graphics card fault information;
[0014] The monitoring of the change event representing the graphics card failure includes: monitoring the change event of the configuration file under the namespace;
[0015] Optionally, a long connection is maintained with the apiserver component of kubernetes to receive change events of configuration files under the namespace.
[0016] As an optional implementation manner of the present invention, the obtaining of graphics card fault information and creating a configuration file in a namespace to record the graphics card fault information includes:
[0017] Step S1001, starting a graphics card detection program on each GPU machine;
[0018] Step S1002, the graphics card detection program periodically obtains all graphics card fault information;
[0019] Step S1003: if the graphics card fault information is obtained, then creating the configuration file in the namespace;
[0020] Optionally, in step S1001, a graphics card detection program is started on each GPU machine by starting a daemonset of kubernetes;
[0021] Optionally, in step S1002, the graphics card detection program periodically obtains all graphics card fault information through an API interface of the graphics card driver.
[0022] As an optional implementation manner of the present invention, the data synchronization processing of the stored graphics card resource information according to the change event includes one or more of the following:
[0023] Determine whether the change event is a new fault event, if it is a new fault event, obtain the IP address and graphics card number list of the faulty graphics card, and store the IP address and the graphics card number in the graphics card resource information;
[0024] Determine whether the change event is a graphics card state change event, if it is a graphics card state change event, obtain the IP address and graphics card number list of the graphics card to be modified, modify the graphics card resource information based on the IP address and graphics card number list of the graphics card to be modified, and change the graphics card state;
[0025] Determine whether the change event is a fault deletion event. If it is a fault deletion event, obtain the IP address of the graphics card corresponding to the fault to be deleted, and delete the corresponding fault data in the graphics card resource information based on the IP address.
[0026] As an optional implementation manner of the present invention, the subsequent processing of the graphics card failure in the virtual cloud environment includes:
[0027] When assigning graphics cards to newly created services, the faulty graphics card is no longer used;
[0028] Evict existing services on the faulty graphics card.
[0029] As an optional implementation manner of the present invention, the expelling existing services on the faulty graphics card includes: in a virtual cloud environment of Kubernetes, when obtaining graphics card fault information by subscribing to a change event representing the graphics card fault in the namespace, deleting the existing services on the faulty graphics card, and synchronizing the service change information to the graphics card resource information;
[0030] Optionally, when storing the graphics card resource information in an adjacency matrix, the expelling existing services on the faulty graphics card includes:
[0031] Subscribe to a configuration file change event under the namespace, and determine the type of the change event, wherein the configuration file is a file that is created in the namespace to record the graphics card fault information when the graphics card fault information is obtained;
[0032] When the received change event is a configuration file creation event or a configuration file modification event, the faulty graphics card information involved in the change event is obtained, and it is determined whether the total faulty graphics cards of the GPU machine involved in the change event exceeds a set value. If so, the adjacency matrix is traversed to delete the services on all graphics cards of the corresponding GPU machine, and the GPU machine is deleted, so that Kubernetes completes the subsequent migration and restart operation of the faulty graphics card service; if not, the corresponding service list of the faulty graphics card involved in the change event is found in the adjacency matrix and deleted, so that Kubernetes completes the subsequent migration and restart operation of the deleted service.
[0033] As an optional implementation manner of the present invention, in a virtual cloud environment of Kubernetes, when the graphics card resource information is stored in an adjacency matrix, the faulty graphics card is no longer used when allocating a graphics card to a newly created service, including:
[0034] When the newly created service starts the graphics card allocation, the adjacency matrix is obtained, the GPU machine is traversed, and the available graphics card resources are obtained, and the available graphics card resources have filtered out the faulty graphics card;
[0035] Determine whether the available graphics card resources are sufficient, select an available graphics card to allocate the newly created service, search the adjacency matrix for the GPU machine and graphics card number corresponding to the graphics card allocated to the newly created service, and update the service list.
[0036] The embodiment of the present invention also provides a device for processing a graphics card failure in a virtual cloud environment, including:
[0037] A data processing module, used to store graphics card resource information in the virtual cloud environment, and when a change event representing a graphics card failure is monitored, perform data synchronization processing on the stored graphics card resource information according to the type of the change event, wherein the graphics card resource information includes the topological structure between cluster nodes, graphics cards and services, and graphics card status information;
[0038] The subsequent processing module is used to perform subsequent processing on the graphics card failure in the virtual cloud environment based on the synchronized graphics card resource information, and synchronously update the graphics card resource information through the data processing module.
[0039] As an optional implementation of this embodiment, the virtual cloud environment is a virtual cloud environment based on Kubernetes, and the processing device further includes: a probe module, which is used to obtain graphics card fault information of each GPU machine and create a configuration file in the namespace to record the graphics card fault information;
[0040] Optionally, when the data processing module monitors a configuration file change event: determines whether the configuration file change event is a configuration file creation event, and if so, obtains the IP address and graphics card number list of the faulty graphics card contained in the creation event, and stores the faulty graphics card information into the graphics card resource information according to the IP address and the graphics card number; determines whether the configuration file change event is a graphics card status change event, and if so, obtains the IP address and graphics card number list pointed to by the graphics card status change event, modifies the graphics card resource information based on the IP address and graphics card number list, and changes the graphics card status; determines whether the configuration file change event is a configuration file deletion event, and if so, obtains the IP address and graphics card number of the graphics card pointed to by the configuration file deletion event, and deletes the corresponding fault data in the graphics card resource information based on the IP address and the graphics card number;
[0041] Optionally, the subsequent processing module includes an evictor module, and the evictor module is used to delete existing services on the faulty graphics card when a graphics card fault is obtained by subscribing to a configuration file change event of the namespace, and synchronize service change information to the graphics card resource information;
[0042] Optionally, the subsequent processing module includes a scheduling module, the scheduling module is used to allocate a graphics card for the newly created service, and when starting the graphics card allocation, the scheduling module obtains available graphics card resources according to the graphics card resource information, the available graphics card resources have filtered out faulty graphics cards, and determines whether the available graphics card resources are sufficient, selects an available graphics card to allocate the newly created service, and updates the service list of the corresponding graphics card in the graphics card resource information;
[0043] Further optionally, the data processing module uses an adjacency matrix to store the graphics card resource information;
[0044] Further optionally, the data processing module globally starts a single instance, registers a namespace and listens to configuration file change events under the namespace; and determines the type of the change event, and performs data synchronization processing on the adjacency matrix according to the type of the change event; optionally, the data processing module receives configuration file change events under the namespace by maintaining a long connection with the apiserver of the kubernetes system;
[0045] Further optionally, the probe module is deployed using daemonset, and the main process is:
[0046] Start the corresponding judgment program on each GPU machine, loop to judge each graphics card, call the driver API interface to judge the graphics card status, if the graphics card is judged to be healthy, return to the loop judgment step, if the graphics card is judged to be unhealthy, create / modify / delete the configuration file resource containing the node IP and graphics card in the namespace of the probe module;
[0047] Optionally, the evictor module starts a single instance globally, shares a namespace with the data processing module, and subscribes to change events of configuration files under the namespace. When the change event received is a new event or a modified event, it is determined whether the number of faulty graphics cards of this new event or modified event exceeds a set value. If so, the adjacency matrix is traversed to delete the corresponding service lists of all graphics cards of the corresponding GPU machine. If not, the corresponding service list of the graphics card is found in the adjacency matrix and deleted;
[0048] Optionally, the scheduling module starts a single instance globally, and when the newly created service starts graphics card allocation, the adjacency matrix is obtained, the GPU machines are traversed, the faulty graphics cards are filtered out, it is determined whether the graphics card resources are sufficient, an available graphics card is selected to allocate the newly created service, and then the corresponding GPU machine and graphics card are searched in the adjacency matrix to update the service list.
[0049] The present invention also provides an electronic device, including a processor and a memory, wherein the memory is used to store a computer executable program, and when the computer program is executed by the processor, the processor executes any of the above-mentioned methods for processing graphics card failures in a virtual cloud environment.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] The method for processing graphics card failure in a virtual cloud environment of the present invention stores graphics card resource information in the virtual environment, such as the topological structure and status between cluster nodes, graphics cards and services; monitors change events that characterize graphics card failures, and when a change event is monitored, data synchronization processing can be performed on the stored graphics card resource information according to the change event, thereby realizing real-time update of the graphics card resource information; then, based on the synchronized graphics card resource information, subsequent processing is performed on the graphics card failure in the virtual cloud environment, and the service or cluster node corresponding to the faulty graphics card can be processed according to the change event of the graphics card failure, thereby shielding the faulty graphics card and ensuring the stable operation of the virtual framework; and the graphics card resource information is synchronously updated to ensure that the graphics card resource information is updated in real time, real-time monitoring is performed on the virtual cloud environment, and real-time monitoring and real-time processing are performed on the graphics card failure in the virtual cloud environment.
[0052] Through the solution of the present invention, related functions can also be provided to other modules for querying and modifying IP, graphics card number and service data.
[0053] In view of the scenario where a graphics card fails in a virtual environment, the present invention can expel existing services on the failed graphics card according to graphics card resource information stored in the virtual cloud environment; and control new services not to use the failed graphics card.
[0054] The present invention can shield faulty graphics cards in a virtual environment, thereby ensuring stable operation of the virtual framework. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 A flowchart of a method for processing a graphics card failure in a virtual cloud environment according to some embodiments of the present invention;
[0056] Figure 2A flowchart of obtaining graphics card fault information and creating a configuration file in a namespace to record the graphics card fault information in a method for processing a graphics card fault in a virtual cloud environment according to some embodiments of the present invention;
[0057] Figure 3 A flowchart of performing data synchronization processing on stored graphics card resource information according to the change event in a method for processing a graphics card failure in a virtual cloud environment according to some embodiments of the present invention;
[0058] Figure 4 A schematic diagram of a global processing flow of a method for processing a graphics card failure in a virtual cloud environment according to some embodiments of the present invention;
[0059] Figure 5 A schematic diagram of a storage method of an adjacency matrix of a data processing module according to some embodiments of the present invention;
[0060] Figure 6 A flowchart of an evictor module for evict existing services on a faulty graphics card according to some embodiments of the present invention;
[0061] Figure 7 A flowchart of a new service created by a scheduling module according to some embodiments of the present invention;
[0062] Figure 8 A flowchart of the operation of a probe module according to some embodiments of the present invention. DETAILED DESCRIPTION
[0063] To make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be described clearly and completely in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them.
[0064] Therefore, the following detailed description of the embodiments of the present invention is not intended to limit the scope of the invention claimed for protection, but merely represents some embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features and technical solutions in the embodiments may be combined arbitrarily.
[0066] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0067] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "upper", "lower", etc. is based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the invention product is usually placed when in use, or the orientation or positional relationship commonly understood by those skilled in the art. Such terms are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0068] This embodiment provides a method for handling graphics card failures in a virtual cloud environment. Figure 1 As shown, the method includes:
[0069] Step 101: monitor a change event indicating a graphics card failure.
[0070] This step monitors whether the graphics card in the virtual cloud environment has a fault, and obtains the graphics card fault information required for subsequent graphics card fault processing. There are many specific implementation methods for the monitoring, because it has no impact on the implementation effect of this solution, it is not limited in this embodiment. Generally, those skilled in the art can design according to specific circumstances. For example, in a virtual cloud environment implemented using the kubernetes system, it is possible to maintain a long connection with the apiserver to receive change events of the configuration files under the namespace; and create a config file resource in the namespace in advance when a graphics card fault is detected to provide an implementation basis.
[0071] Step 102: Perform data synchronization processing on the stored graphics card resource information according to the change event, wherein the graphics card resource information includes the topological structure between cluster nodes, graphics cards and services in the virtual cloud environment and graphics card status information.
[0072] This embodiment stores the topological structure between cluster nodes, graphics cards and services in the virtual cloud environment and graphics card status information in advance in the graphics card resource information.
[0073] When a change event representing a graphics card failure is monitored, this step obtains the graphics card failure information from the change event and performs data synchronization processing on the graphics card resource information used to store graphics card related information in the virtual cloud environment. After the data synchronization processing, the graphics card failure information can be recorded in a timely manner to facilitate subsequent graphics card failure processing.
[0074] Step 103: Based on the synchronized graphics card resource information, perform subsequent processing on the graphics card failure in the virtual cloud environment, and synchronously update the graphics card resource information.
[0075] This step performs subsequent processing on the graphics card failure in the virtual cloud environment based on the synchronized graphics card resource information, and synchronously updates the graphics card resource information if necessary. The subsequent processing of the graphics card failure here can mainly include: no longer using the faulty graphics card when allocating graphics cards for newly created services; and expelling existing services on the faulty graphics card. The faulty graphics card refers to a graphics card that is faulty and cannot work normally and is included in the change event that represents the graphics card failure.
[0076] The method for handling graphics card failure in a virtual cloud environment of the present embodiment stores graphics card resource information in the virtual environment, such as the topological structure and status between cluster nodes, graphics cards and services; monitors change events that represent graphics card failures, and when a change event is monitored, performs data synchronization processing on the stored graphics card resource information according to the change event, thereby achieving real-time update of the graphics card resource information; then, based on the synchronized graphics card resource information, subsequent processing is performed on the graphics card failure in the virtual cloud environment, and the service or cluster node corresponding to the faulty graphics card can be processed according to the change event of the graphics card failure, thereby shielding the faulty graphics card and ensuring the stable operation of the virtual framework; and synchronously updates the graphics card resource information to ensure that the graphics card resource information is updated in real time, and performs real-time monitoring and real-time processing on the graphics card failure in the virtual cloud environment.
[0077] As an optional implementation of this embodiment, this embodiment may use an adjacency matrix to store the graphics card resource information; the synchronization processing is to perform data synchronization processing on the adjacency matrix.
[0078] For example, see Figure 5 FIG. 1 is a schematic diagram of using an adjacency matrix to store the graphics card resource information. The graphics card resource information in this example includes the graphics card number, whether the graphics card is faulty, the total video memory, name, used video memory, and service information running on the graphics card.
[0079] In some embodiments, the virtual cloud environment in this embodiment is a virtual cloud environment based on Kubernetes; the processing method further includes:
[0080] Step S100, obtaining graphics card fault information, and creating a configuration file in a namespace to record the graphics card fault information;
[0081] The monitoring of the change event representing the graphics card failure in step 101 includes: monitoring the change event of the configuration file under the namespace. It should be noted that different virtual environment systems can selectively select different files as carriers, as long as they can record the results of the graphics card failure detection and share the graphics card information changes, and are not limited to the configuration file described in this embodiment.
[0082] Optionally, in a virtual cloud environment based on Kubernetes, a long connection can be maintained with the apiserver component of Kubernetes to receive change events of configuration files under the namespace.
[0083] For example, see Figure 2 As shown, in step S100 of this embodiment, obtaining graphics card fault information and creating a configuration file in a namespace to record the graphics card fault information may include:
[0084] Step S1001, starting a graphics card detection program on each GPU machine;
[0085] Step S1002, the graphics card detection program periodically obtains all graphics card fault information;
[0086] Step S1003: if the graphics card fault information is obtained, then creating the configuration file in the namespace;
[0087] Optionally, in step S1001, a graphics card detection program can be started on each GPU machine by starting a daemonset of kubernetes.
[0088] Optionally, in step S1002, the graphics card detection program can periodically obtain all graphics card fault information through the API interface of the graphics card driver. The specific detection period can be determined by those skilled in the art according to actual conditions. Alternatively, the optimal period is determined based on experiments to achieve a balance between system overhead and function realization. API interface, API is the abbreviation of Application Programming Interface, which means application program interface. The API interface allows the software designed by programmers to call the built-in program of the graphics card, so that the software can automatically communicate with the hardware driver, thereby greatly improving the design efficiency of the program. Programmers only need to write program code that conforms to the interface to give full play to the existing functions of the graphics card, and no longer need to understand the specific performance and parameters of the hardware, which greatly simplifies the efficiency of program development.
[0089] Further, see Figure 3 As shown, in step S102 of this embodiment, the data synchronization processing of the stored graphics card resource information according to the change event may include one or more of the following:
[0090] Determine whether the change event is a new fault event. If it is a new fault event, obtain the IP address and graphics card number list of the faulty graphics card, store the IP address and the graphics card number in the graphics card resource information, and change the graphics card state;
[0091] Determine whether the change event is a graphics card state change event, if it is a graphics card state change event, obtain the IP address and graphics card number list of the graphics card to be modified, and modify the graphics card resource information based on the IP address and graphics card number list of the graphics card to be modified;
[0092] Determine whether the change event is a fault deletion event. If it is a fault deletion event, obtain the IP address of the graphics card corresponding to the fault to be deleted, and delete the corresponding fault data in the graphics card resource information based on the IP address.
[0093] In the method for processing a graphics card failure in a virtual cloud environment of this embodiment, the subsequent processing of the graphics card failure in the virtual cloud environment described in step S103 includes: when allocating a graphics card for a newly created service, no longer using the faulty graphics card; and expelling existing services on the faulty graphics card.
[0094] Furthermore, the expulsion of existing services on the faulty graphics card in this embodiment may include: in the virtual cloud environment of Kubernetes, by subscribing to the change event of the namespace representing the graphics card failure, deleting the existing services on the faulty graphics card, and synchronizing the service change information to the graphics card resource information. In this way, when a faulty graphics card is found, the existing services on the faulty graphics card can be expelled in time to avoid service failure and data loss.
[0095] See also Figure 6 As shown, when the graphics card resource information is stored in the adjacency matrix, the step includes:
[0096] Subscribe to a configuration file change event in the namespace, and determine the type of the change event, wherein the configuration file is a file that records the graphics card fault information and is created in the namespace when the graphics card fault information is obtained.
[0097] This embodiment records the graphics card fault information through a configuration file, and the configuration file can be shared under the namespace, so as to realize the shared call and synchronization of the graphics card fault information. The content of the configuration file of this embodiment is determined by the developer according to the specific usage scenario and the object of the record. For example, the config file can be used as the configuration file in the K8s environment. The config file is provided by K8s. What we need to do is to use this function to update and maintain the relationship between the machine, the graphics card, and the service working on the graphics card. The content of the config file configuration can be determined by the developer according to the needs.
[0098] When the received change event is a configuration file creation event or a configuration file modification event, obtain the faulty graphics card information involved in the change event, and determine whether the total faulty graphics cards of the machine involved in the change event exceeds a set value. If so, traverse the adjacency matrix, delete the services on all graphics cards of the corresponding machine, and delete the machine, so that kubernetes completes the subsequent faulty graphics card service migration and restart operation;
[0099] If not, then find the service list corresponding to the faulty graphics card involved in the change event in the adjacency matrix and delete it, so that kubernetes completes the subsequent migration and restart operation of the deleted service.
[0100] In the Kubernetes environment, when the above "delete the services on all graphics cards of the corresponding machine and delete the machine", Kubernetes will automatically complete the subsequent migration and restart operation of the faulty graphics card service; when "find the service list corresponding to the faulty graphics card involved in the change event and delete it", Kubernetes will automatically complete the subsequent migration and restart operation of the deleted service. This embodiment uses the original function of Kubernetes to complete node deletion and service expulsion.
[0101] In this embodiment, when a configuration file creation event or a configuration file modification event occurs, the service running on the faulty graphics card associated with the configuration file creation event or the configuration file modification event is migrated and restarted to ensure the normal and stable operation of the service. For machines with too many faulty graphics cards, the machines need to be deleted to remind relevant personnel to perform maintenance.
[0102] Optionally, it is determined whether the number of faulty graphics cards of the GPU machine exceeds half after the configuration file creation event or the configuration file modification event, that is, the above setting value may be half of the total number of graphics cards of the GPU machine.
[0103] See also Figure 7 The method for handling a graphics card failure in a virtual cloud environment of this embodiment, in a virtual cloud environment of Kubernetes, when the graphics card resource information is stored in an adjacency matrix, when allocating a graphics card for a newly created service, the faulty graphics card is no longer used, including:
[0104] When starting graphics card allocation for a newly created service, the adjacency matrix is obtained, the GPU machine is traversed, and available graphics card resources are obtained, where the available graphics card resources have filtered out faulty graphics cards;
[0105] Determine whether the available graphics card resources are sufficient, select an available graphics card to allocate the newly created service, search the adjacency matrix for the corresponding machine and graphics card number of the graphics card allocated with the newly created service, and update the service list.
[0106] The method for handling graphics card failures in a virtual cloud environment of this embodiment can provide healthy graphics card allocation services for newly created services, ensure the stable operation of newly created services, and maximize graphics card resource configuration, thereby improving the stability and efficiency of system operation.
[0107] See also Figure 4 As shown, specifically, this embodiment provides a method for processing graphics card failure in a virtual environment based on kubernetes (K8s for short), including a data processing module, a probe module, a scheduling module and an evictor module. This implementation adopts creating a configuration file (config file) in a namespace to record the received graphics card failure information, and obtains the graphics card failure information by monitoring the change event of the configuration file under the namespace.
[0108] The data processing module stores the cluster nodes, graphics cards and service topology in the form of an adjacency matrix. The data processing module of this embodiment can be a model layer, which adopts a single instance deployment method. The data processing module starts a single instance globally, registers a namespace and listens to the change event of the config file under the namespace; judges the change event, and performs data synchronization processing on the adjacency matrix according to the type of the change event.
[0109] This embodiment classifies the change events and the corresponding processing flow is as follows:
[0110] If the change event is a new event (indicating a new fault), the config file is parsed through the split method, the IP and graphics card number list is obtained from the config file, and the IP and graphics card number are stored in the adjacency matrix.
[0111] Preferably, the card number data of the faulty graphics card is stored in an adjacency matrix according to IP grouping.
[0112] If the change event is a modification event, the config file is parsed through the split method, the IP and graphics card number list is obtained from the config file, the adjacency matrix is traversed and compared, the changed graphics card is found, and the status data is updated (recording the failure or restoring normality)
[0113] If it is a deletion event: Get the IP from the config file through the split method, and update the data under this IP to restore to normal
[0114] Preferably, the data processing module can group by IP, traverse the groups and compare with the adjacency matrix, find the changed graphics card, and update the status data: record the graphics card failure or the graphics card recovery.
[0115] In order to monitor the change events under the namespace of the data processing module, the data processing module described in this embodiment receives the change events of the config file under the namespace by maintaining a long connection with the apiserver of kubernetes.
[0116] The data processing module of this embodiment can also provide methods to other modules for querying and modifying IP, graphics card number, and service data:
[0117] 1. Provide query function: traverse the adjacency matrix, query the graphics card information list and the running service list by IP or IP + graphics card number.
[0118] 2. Provide service deletion function: traverse the adjacency matrix, and choose to delete the service list of all graphics cards on a node or delete the service list on a specified graphics card by IP or IP+graphics card number.
[0119] 3. Provide node deletion function: traverse the adjacency matrix, delete all graphics card service lists on a node by entering the IP, and delete the node.
[0120] 4. Provide adding function: traverse the adjacency matrix and add the service list of a specified graphics card on a node through the method of IP+graphics card number+service.
[0121] See also Figure 4 As shown, the probe module is deployed in daemonset deployment mode (daemonset is a concept of Kubernetes, which starts a daemon process on each server that meets the requirements).
[0122] The main responsibilities of the probe module in this embodiment are: checking the status of the graphics card of this node, organizing data and passing it to the data module. The data structure is as follows:
[0123] config file structure:
[0124] apiVersion:v1
[0125] kind:ConfigMap
[0126] metadata:
[0127] name:unhealthy-GPU-192.168.1.123
[0128] data:
[0129] GPUs: "1,7".
[0130] See also Figure 8 As shown, the main process of the probe module in this embodiment includes:
[0131] Step S101, start daemonset, and start the corresponding detection program on each GPU machine;
[0132] Step S102, loop to check each graphics card: the program loops to obtain all graphics card error information through the graphics card driver API. If normal, it will sleep and wait for the next detection, and repeat step S102; if abnormal, execute step S103.
[0133] Step S103, creating a config file resource including the node IP and graphics card in the namespace of the probe module.
[0134] Preferably, the detection procedure in step S101 can be started regularly, or detected once at a predetermined interval.
[0135] For a faulty graphics card in a virtual cloud environment, when a graphics card failure is detected, existing services on the faulty graphics card need to be expelled, and newly created services will no longer be allocated to the faulty graphics card.
[0136] See also Figure 4 As shown, the evictor module of this embodiment is used to evict services that have been running on a faulty graphics card.
[0137] The evictor module can delete existing services on the faulty graphics card by subscribing to the change event of the config file, and synchronize the service change information to the data layer (adjacency matrix). The deployment mode of the evictor module in this embodiment is single instance deployment.
[0138] The evictor module starts a single instance globally, shares a namespace with the data processing module, and subscribes to change events of the config file under the namespace. When a change event is received, a judgment is made: when it is determined that the change event is a new event or a modification event, whether the number of faulty graphics cards of this new event or modification event exceeds a set value. If so, the adjacency matrix is traversed to delete services on all graphics cards of the corresponding machine, and the machine is deleted, so that Kubernetes completes the subsequent migration and restart operation of the faulty graphics card service; if not, the service list corresponding to the faulty graphics card involved in the change event is found in the adjacency matrix and deleted, so that Kubernetes completes the subsequent migration and restart operation of the deleted service.
[0139] Preferably, it is determined whether the number of faulty graphics cards on the GPU machine exceeds half after the current fault new event or graphics card status change event.
[0140] Specifically, the evictor module processes change events as follows:
[0141] For new events: Use the split method to obtain the number of graphics cards for this event, and determine whether the number of faulty graphics cards on the machine exceeds the set value. If the result is yes, the machine offline process is performed; if the result is no, the service process is expelled.
[0142] For graphics card status change events: use the split method to obtain the list of faulty graphics cards for this event, use the data processing module to obtain the faulty graphics cards, combine the two sets of data, and determine whether the number of faulty graphics cards exceeds the set value. If the judgment result is yes, perform the machine offline process. If the judgment result is no, perform the eviction service process.
[0143] The machine offline process includes: calling the method of deleting the node in the data processing module, deleting all services of the machine, and removing the node from the adjacency matrix (further, Kubernetes will complete the migration and restart of the expelled service), and deleting the machine node from Kubernetes (Kubernetes will remove the machine from the cluster).
[0144] Furthermore, the management personnel can be notified by email to return the machine for repair.
[0145] The service expulsion process includes: calling the service deletion method of the data processing module with the IP and the card number of the faulty graphics card as parameters to delete the service running on the faulty graphics card. Further, kubernetes will complete the migration and restart operation of the deleted service.
[0146] In the scenario where a graphics card fails in a virtual environment, the process that needs to be handled includes the process of new services no longer using the failed graphics card. Figure 4 As shown, the scheduling module is used to allocate graphics cards to the newly created services, and the deployment mode is single instance deployment.
[0147] See also Figure 7 As shown, the main process of the scheduling module in this embodiment includes:
[0148] Step S201, starting a single instance globally to share a namespace with the data processing module;
[0149] Step S202: starting graphics card allocation for the newly created service, including:
[0150] Step S2021, obtaining an adjacency matrix, traversing GPU machines, filtering faulty graphics cards, determining whether graphics card resources are sufficient, and selecting an available graphics card;
[0151] Step S2022, the binding phase, searches for the corresponding machine and graphics card in the adjacency matrix and updates the service list.
[0152] Among them, the scheduling module and the data processing module share the namespace.
[0153] When allocating the graphics card, the final available graphics card can be selected by pre-selection and sorting (sorting by scoring, preferably Top1). The pre-selection includes obtaining the adjacency matrix through the query method provided by the data processing module, traversing all GPU nodes, judging whether the graphics card resources (quantity and video memory) are sufficient, and judging whether the card is faulty (faulty graphics cards will be filtered out at this step), so that the new service will not be scheduled to the faulty graphics card.
[0154] In step S2022, the IP, graphics card number and service information are used as parameters to call the adding method provided by the data processing module. The method traverses the adjacency matrix, finds the corresponding IP and graphics card, and appends the service to the service list of this graphics card.
[0155] This embodiment is elaborated in detail based on the virtual environment of K8s. For virtual cloud environments other than K8s, the idea of this solution is also applicable. However, what needs to be modified is that config, which records graphics card information in files under a specific namespace, is a specific implementation in the K8s environment. For other virtualization implementation methods, such as mesos, targeted modifications are required, such as implementing a custom scheduler module, recording graphics card information in external storage instead of monitoring files, etc.; for the data module and evictor module in this embodiment, in other forms of virtualization environments, their functions may be integrated into the scheduler module, depending on the specific implementation method.
[0156] The config file of this embodiment only records the results of graphics card fault detection, and is used to share the carrier of graphics card information changes with other modules such as scheduler and evictor. The working status of the graphics card itself is provided by the graphics card driver. For K8s, the most appropriate way to register the graphics card status information is in the form of a config file in a specific namespace, which can be easily perceived by other modules. The adjacency matrix method is also a data structure that we think is more suitable for storing graphics cards and the service association relationship working on them. As for other possible forms, for example, it can also be placed in the general kv storage and stored in the form of key-list, so that it can be perceived by the entire cluster.
[0157] See also Figure 4 As shown, this embodiment also provides a processing device for a graphics card failure in a virtual cloud environment, including:
[0158] A data processing module, used to store graphics card resource information in the virtual cloud environment, and when a change event representing a graphics card failure is monitored, perform data synchronization processing on the stored graphics card resource information according to the type of the change event, wherein the graphics card resource information includes the topological structure between cluster nodes, graphics cards and services, and graphics card status information;
[0159] The subsequent processing module performs subsequent processing on the graphics card failure in the virtual cloud environment based on the synchronized graphics card resource information, and the data processing module synchronously updates the graphics card resource information.
[0160] As an optional implementation of this embodiment, the virtual cloud environment is a virtual cloud environment based on Kubernetes.
[0161] The data storage module stores the cluster nodes, graphics card and service topology structure and graphics card status information in the form of an adjacency matrix;
[0162] Optionally, the processing device further includes a probe module, which is used to obtain graphics card fault information of each GPU machine and create a configuration file in the namespace to record the graphics card fault information.
[0163] It is possible to loop through each GPU machine to determine whether each graphics card is faulty. If it is determined to be faulty, the probe module creates / modifies / deletes a file resource containing the node IP and the corresponding graphics card fault in its namespace.
[0164] Optionally, the subsequent processing module includes an evictor module, which deletes existing services on the faulty graphics card by subscribing to the change event of the namespace representing the graphics card failure, and synchronizes the service change information to the graphics card resource information;
[0165] Optionally, the subsequent processing module includes a scheduling module, which obtains the adjacency matrix, traverses the GPU machine, obtains graphics card resources, and the graphics card resources have filtered out faulty graphics cards when the newly created service starts graphics card allocation; determines whether the graphics card resources are sufficient, selects an available graphics card to allocate the newly created service, and searches the adjacency matrix for the corresponding machine and graphics card number of the graphics card allocated to the newly created service, and updates the service list.
[0166] As an optional implementation of this embodiment, the data processing module receives change events of configuration files under the namespace by maintaining a long connection with the apiserver of the kubernetes system; the data processing module starts a single instance globally, registers the namespace and listens to change events of graphics card failures under the namespace; determines the change event, and performs data synchronization processing on the adjacency matrix according to the type of the change event;
[0167] The probe module starts daemonset, starts the corresponding judgment program on each GPU machine, loops to judge each graphics card, calls the driver API interface to judge the graphics card status, and if it is judged to be healthy, returns to the loop judgment step; if it is judged to be unhealthy, creates / modifies / deletes the config file resources containing the node IP and graphics card in the namespace of the probe module;
[0168] The evictor module starts a single instance globally, shares a namespace with the data processing module, and subscribes to the change event of the config file under the namespace. When the change event received is a new event or a modification event, it is determined whether the number of faulty graphics cards of this new event or modification event exceeds the set value. If so, the adjacency matrix is traversed to find the corresponding service list of all graphics cards of the corresponding machine and delete them. If not, the corresponding service list of the graphics card is found in the adjacency matrix and deleted.
[0169] The scheduling module starts a single instance globally, starts graphics card allocation for the newly created service, obtains the adjacency matrix, traverses the GPU machines, filters the faulty graphics cards, determines whether the graphics card resources are sufficient, selects an available graphics card, and in the binding phase, searches for the corresponding machine and graphics card in the adjacency matrix and updates the service list.
[0170] An electronic device of this embodiment includes a processor and a memory, wherein the memory is used to store a computer executable program. When the computer program is executed by the processor, the processor executes any one of the methods for processing a graphics card failure in a virtual cloud environment described in the above embodiments.
[0171] A computer-readable medium of this embodiment stores a computer-executable program. When the computer-executable program is executed, the method for processing a graphics card failure in a virtual cloud environment described in any one of the above embodiments is implemented.
[0172] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described in the present invention. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the above specific implementation methods. Therefore, any modification or equivalent replacement of the present invention; and all technical solutions and improvements thereof that do not depart from the spirit and scope of the invention are included in the scope of the claims of the present invention.
Claims
1. A method for processing a graphics card failure in a virtual cloud environment, characterized in that: include: Monitor change events that indicate graphics card failure; Performing data synchronization processing on the stored graphics card resource information according to the change event, the graphics card resource information including the topological structure between cluster nodes, graphics cards and services in the virtual cloud environment and graphics card status information; Based on the synchronized graphics card resource information, subsequent processing is performed on the graphics card failure in the virtual cloud environment, and the graphics card resource information is synchronously updated; Adopting an adjacency matrix to store the graphics card resource information; the synchronization processing is to perform data synchronization processing on the adjacency matrix; The virtual cloud environment is a virtual cloud environment based on Kubernetes; The processing method further includes: obtaining graphics card fault information, and creating a configuration file in a namespace to record the graphics card fault information; The monitoring of the change event indicating the graphics card failure includes: monitoring the change event of the configuration file under the namespace; By maintaining a persistent connection with the Kubernetes API server component, the configuration file change events under the namespace are received. The obtaining of graphics card fault information and creating a configuration file in a namespace to record the graphics card fault information includes: Step S1001, starting a graphics card detection program on each GPU machine; Step S1002, the graphics card detection program periodically obtains all graphics card fault information; Step S1003: if the graphics card fault information is obtained, then create the configuration file in the namespace; In step S1001, the graphics card detection program is started on each GPU machine by starting the daemonset of kubernetes; In step S1002, the graphics card detection program periodically obtains all graphics card fault information through the graphics card driver API interface; The performing data synchronization processing on the stored graphics card resource information according to the change event includes one or more of the following: Determine whether the change event is a new fault event, if it is a new fault event, obtain the IP address and graphics card number list of the faulty graphics card, and store the IP address and the graphics card number in the graphics card resource information; Determine whether the change event is a graphics card state change event, if it is a graphics card state change event, obtain the IP address and graphics card number list of the graphics card to be modified, modify the graphics card resource information based on the IP address and graphics card number list of the graphics card to be modified, and change the graphics card state; Determine whether the change event is a fault deletion event, if it is a fault deletion event, obtain the IP address of the graphics card corresponding to the fault to be deleted, and delete the corresponding fault data in the graphics card resource information based on the IP address; The subsequent processing of the graphics card failure in the virtual cloud environment includes: When assigning graphics cards to newly created services, the faulty graphics card is no longer used; Evict existing services on the faulty graphics card.
2. The method for processing a graphics card failure in a virtual cloud environment according to claim 1, characterized in that: The expelling of existing services on the faulty graphics card includes: in a virtual cloud environment of Kubernetes, when graphics card failure information is obtained by subscribing to a change event in the namespace that represents the graphics card failure, deleting the existing services on the faulty graphics card, and synchronizing the service change information to the graphics card resource information.
3. The method for processing a graphics card failure in a virtual cloud environment according to claim 2, characterized in that: When storing the graphics card resource information in the adjacency matrix, the expelling of the existing services on the faulty graphics card includes: Subscribe to a configuration file change event under the namespace, and determine the type of the change event, wherein the configuration file is a file that is created in the namespace to record the graphics card fault information when the graphics card fault information is obtained; When the received change event is a configuration file creation event or a configuration file modification event, the faulty graphics card information involved in the change event is obtained, and it is determined whether the total faulty graphics cards of the GPU machine involved in the change event exceeds a set value. If so, the adjacency matrix is traversed, the services on all graphics cards of the corresponding GPU machine are deleted, and the GPU machine is deleted, so that Kubernetes completes the subsequent migration and restart operation of the faulty graphics card service; if not, the corresponding service list of the faulty graphics card involved in the change event is found in the adjacency matrix and deleted, so that Kubernetes completes the subsequent migration and restart operation of the deleted service.
4. The method for processing a graphics card failure in a virtual cloud environment according to claim 1, characterized in that: In a virtual cloud environment of Kubernetes, when the graphics card resource information is stored in an adjacency matrix, the faulty graphics card is no longer used when allocating a graphics card to a newly created service, including: When the newly created service starts the graphics card allocation, the adjacency matrix is obtained, the GPU machine is traversed, and the available graphics card resources are obtained, and the available graphics card resources have filtered out the faulty graphics card; Determine whether the available graphics card resources are sufficient, select an available graphics card to allocate the newly created service, search the adjacency matrix for the GPU machine and graphics card number corresponding to the graphics card allocated with the newly created service, and update the service list.
5. A device for processing graphics card failure in a virtual cloud environment, characterized in that: include: A data processing module, configured to store graphics card resource information in the virtual cloud environment, and when a change event indicating a graphics card failure is detected, perform data synchronization processing on the stored graphics card resource information according to the type of the change event, wherein the graphics card resource information includes a topological structure between cluster nodes, graphics cards, and services, and graphics card status information; A subsequent processing module, used to perform subsequent processing on the graphics card failure in the virtual cloud environment based on the synchronized graphics card resource information, and synchronously update the graphics card resource information through the data processing module; The virtual cloud environment is a virtual cloud environment based on Kubernetes. The processing device further includes: a probe module, which is used to obtain graphics card fault information of each GPU machine and create a configuration file in a namespace to record the graphics card fault information; When the data processing module monitors a configuration file change event: determines whether the configuration file change event is a configuration file creation event, if so, obtains the IP address and graphics card number list of the faulty graphics card contained in the creation event, and stores the faulty graphics card information into the graphics card resource information according to the IP address and the graphics card number; determines whether the configuration file change event is a graphics card status change event, if so, obtains the IP address and graphics card number list pointed to by the graphics card status change event, modifies the graphics card resource information based on the IP address and graphics card number list, and changes the graphics card status; determines whether the configuration file change event is a configuration file deletion event, if so, obtains the IP address and graphics card number of the graphics card pointed to by the configuration file deletion event, and deletes the corresponding fault data in the graphics card resource information based on the IP address and the graphics card number; The data processing module uses an adjacency matrix to store the graphics card resource information; The data processing module starts a single instance globally, registers a namespace and listens to configuration file change events in the namespace; determines the type of the change event, and performs data synchronization processing on the adjacency matrix according to the type of the change event; the data processing module receives configuration file change events in the namespace by maintaining a long connection with the apiserver of the kubernetes system; The probe module is deployed using daemonset, and the main process is: Start the corresponding judgment program on each GPU machine, loop to judge each graphics card, call the driver API interface to judge the graphics card status, if the graphics card is judged to be healthy, return to the loop judgment step, if the graphics card is judged to be unhealthy, create / modify / delete the configuration file resources containing the node IP and graphics card in the namespace of the probe module.
6. The device for processing graphics card failure in a virtual cloud environment according to claim 5, characterized in that: The subsequent processing module includes an evictor module, which is used to delete existing services on the faulty graphics card and synchronize service change information to the graphics card resource information when a graphics card fault is obtained by subscribing to a configuration file change event of the namespace.
7. The device for processing graphics card failure in a virtual cloud environment according to claim 6, characterized in that: The evictor module starts a single instance globally, shares a namespace with the data processing module, and subscribes to change events of configuration files under the namespace. When the change event received is a new event or a modification event, it is determined whether the number of faulty graphics cards for this new event or modification event exceeds a set value. If so, the adjacency matrix is traversed to delete the corresponding service lists of all graphics cards of the corresponding GPU machine. If not, the corresponding service list of the graphics card is found in the adjacency matrix and deleted.
8. The device for processing graphics card failure in a virtual cloud environment according to claim 5, characterized in that: The subsequent processing module includes a scheduling module, which is used to allocate graphics cards for newly created services. When starting graphics card allocation, the scheduling module obtains available graphics card resources according to the graphics card resource information, the available graphics card resources have filtered out faulty graphics cards, and determines whether the available graphics card resources are sufficient, selects an available graphics card to allocate the newly created service, and updates the service list of the corresponding graphics card in the graphics card resource information.
9. The device for processing graphics card failure in a virtual cloud environment according to claim 8, characterized in that: The scheduling module starts a single instance globally. When the newly created service starts graphics card allocation, the adjacency matrix is obtained, the GPU machines are traversed, the faulty graphics cards are filtered out, and it is determined whether the graphics card resources are sufficient. An available graphics card is selected to allocate the newly created service, and then the corresponding GPU machine and graphics card are searched in the adjacency matrix to update the service list.
