A Network Card Selection Method, System, Electronic Device and Medium

By selecting and releasing resources based on the status and traffic information of the network card when working with multiple IB network cards, the problems of waste of network card resources and unbalanced traffic are solved, and the total service bandwidth is increased.

CN115733800BActive Publication Date: 2025-06-24JINAN INSPUR DATA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211448029.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2025-06-24
Estimated Expiration
2042-11-18

AI Technical Summary

Technical Problem

When multiple IB network cards are working, some network cards are not used, resulting in wasting of resources such as registered memory, and unbalanced traffic in each network card, resulting in a decrease in the total service bandwidth.

Method used

By determining whether to store the network card in the list of network cards to be selected based on the IP address information of the network card connection object and the status information of the network card, it is also possible to release the resources occupied by the other network cards outside the list of network cards to be selected. Based on the traffic information of each network card in the list of selected network cards, the target network card is obtained to achieve balanced traffic allocation.

Benefits of technology

It effectively avoids the waste of network card resources, ensures balanced allocation of traffic, and increases the total bandwidth of the service.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115733800B_ABST
    Figure CN115733800B_ABST
Patent Text Reader

Abstract

The present application discloses a network card selection method, system, electronic device and medium, mainly related to the technical field of network cards. The method includes: selecting network cards according to the IP address information of the network card connection object and the status information of the network cards, and storing them in the list of candidate network cards; releasing the occupied resources of the remaining network cards except the list of candidate network cards; obtaining the target network card according to the traffic information of each network card in the list of candidate network cards; through the above method, when selecting the target network card, it will be selected according to the traffic information, and the resources occupied by the unused network cards will be released. It avoids the waste of resources such as memory registered by idle network cards and the problem of uneven traffic of working network cards, and improves the total bandwidth of the service; among them, the network card selection system, electronic device and medium provided by the present application correspond to the above method and have the same effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of network cards, and particularly to a network card selection method, system, electronic device, and medium. Background Art

[0002] There are mainly three protocols for Remote Direct Memory Access (RDMA) technology, namely InfiniBand (IB), RoCE, and iWARP protocols. Among them, the RDMA network based on the InfiniBand protocol has the best performance and requires dedicated IB network cards and IB switches. Among them, an IB network card needs to register a separate piece of memory, and this memory is exclusive to the IB network card.

[0003] However, the IB network card does not support the combination of RDMA traffic during use. When there are multiple IB network cards in the environment, multiple registered memories need to be allocated to the IB network cards within one process. However, some IB network cards are not used, resulting in waste of resources such as the memory registered by the IB network card; while some IB network cards are frequently used, and the traffic used by this IB network card will be a lot, and the traffic used by other IB network cards is less, resulting in uneven traffic among the IB network cards and a decrease in the total service bandwidth.

[0004] Therefore, how to make the traffic distribution more balanced when selecting an IB network card and avoid waste of related resources such as memory is an urgent problem to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a network card selection method, system, electronic device, and medium; to solve the problem that when multiple network cards are working, some network cards are not used, resulting in waste of resources such as the memory registered by the network card; and the uneven use of traffic in each working network card leads to a decrease in the total service bandwidth.

[0006] To solve the above technical problems, this application provides a network card selection method, including:

[0007] Judging whether to store the network card in the list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card;

[0008] Releasing the occupied resources of the remaining network cards outside the list of candidate network cards;

[0009] Obtaining the traffic information of each network card in the list of candidate network cards;

[0010] Obtaining the target network card from the list of candidate network cards according to the traffic information.

[0011] Preferably, if there is a newly added network card in the list of candidate network cards, obtaining the traffic information of each network card in the list of candidate network cards includes:

[0012] Control each original network card in the list of candidate network cards to disconnect a preset number of RDMA connections, allocate the traffic corresponding to the disconnected RDMA connections to the newly added network card, and obtain the traffic information of each network card in the list of candidate network cards.

[0013] Preferably, the preset number is determined based on the quantity information of the network cards in the list of candidate network cards and the traffic information of the original network cards.

[0014] Preferably, the status information includes: connected status, unconnected status; judging whether to store the network card in the list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card includes:

[0015] Store the network cards in the connected state in the list of available network cards;

[0016] Store the network cards in the unconnected state in the list of unavailable network cards;

[0017] Select the network cards in the list of available network cards that have the same network segment as the IP address of the network card connection object, and store the network cards in the list of candidate network cards.

[0018] Preferably, when the list of unavailable network cards is not empty, it further includes:

[0019] Create a network card status monitoring thread to monitor the status information of the network cards in the list of unavailable network cards;

[0020] When the status of the network card changes from the unconnected state to the connected state, change the network card from the list of unavailable network cards to the list of available network cards.

[0021] Preferably, releasing the occupied resources of the remaining network cards outside the list of candidate network cards includes:

[0022] Release the registered memory of the remaining network cards outside the list of candidate network cards and disconnect the RDMA connections on the remaining network cards.

[0023] Preferably, obtaining the target network card from the list of candidate network cards according to the traffic information includes:

[0024] Obtain the target network card from the list of candidate network cards according to the relationship between the process of the network card connection object and the CPU and the traffic information;

[0025] Obtaining the target network card from the list of candidate network cards according to the relationship between the process of the network card connection object and the CPU and the traffic information includes:

[0026] Judge whether the process of the network card connection object is bound to the CPU;

[0027] If not, sort the network cards in the list of candidate network cards according to the traffic volume, and select the network card with the smallest traffic load as the target network card;

[0028] If so, determine whether the node values of each network card in the list of candidate network cards match the node value of the CPU core corresponding to the process;

[0029] If they match, remove the unmatched network cards from the list of candidate network cards, and enter the step of sorting each network card in the list of candidate network cards according to the traffic volume, and selecting the network card with the smallest traffic load as the target network card;

[0030] If they do not match, enter the step of sorting each network card in the list of candidate network cards according to the traffic volume, and selecting the network card with the smallest traffic load as the target network card.

[0031] To solve the above technical problem, the present application also provides a network card selection system, including:

[0032] A judgment module, configured to judge whether to store the network card in the list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card;

[0033] A release module, configured to release the occupied resources of the remaining network cards outside the list of candidate network cards;

[0034] A first acquisition module, configured to acquire the traffic information of each network card in the list of candidate network cards;

[0035] A second acquisition module, configured to acquire the target network card from the list of candidate network cards according to the traffic information.

[0036] To solve the above technical problem, the present application also provides an electronic device, including a memory for storing a computer program;

[0037] A processor, configured to implement the steps of the above network card selection method when executing the computer program.

[0038] To solve the above technical problem, the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above network card selection method are implemented.

[0039] The network card selection method provided by the present application includes: selecting a network card according to the IP address information of the network card connection object and the status information of the network card, and storing it in the list of candidate network cards; releasing the occupied resources of the remaining network cards except the list of candidate network cards; acquiring the target network card according to the traffic information of each network card in the list of candidate network cards. Through the above method, when selecting the target network card, the resources of the network card devices irrelevant to the process are released, avoiding the waste of resources such as the memory registered for the network card, and selecting the target network card according to the traffic information of the network card, so as to effectively utilize the relatively idle network card, avoid the problem of uneven traffic of the working network card, and improve the total bandwidth of the service.

[0040] The present application also provides a network card selection system, an electronic device, and a computer-readable storage medium, which correspond to the above network card selection method and have the same beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] To more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0042] Figure 1 It is a flowchart of a network card selection method provided by an embodiment of the present application;

[0043] Figure 2 It is a flowchart corresponding to a specific application scenario of a network card selection method provided by an embodiment of the present application;

[0044] Figure 3 It is a structural diagram of a network card selection system provided by an embodiment of the present application;

[0045] Figure 4 It is a structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0046] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.

[0047] The core of the present application is to provide a network card selection method, system, electronic device, and medium, which mainly relate to the technical field of network cards and are mainly applied to the process of system selecting network cards for processing; it is used to solve the problem that when multiple network cards are working, some network cards are not used, resulting in waste of resources such as the registered memory of the network card and uneven traffic usage in each working network card, leading to a decrease in the total service bandwidth.

[0048] To enable those skilled in the art to better understand the solution of the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.

[0049] Remote Direct Memory Access (RDMA) technology can quickly move data from one system to the memory of a remote system without any impact on the operating system. It features high bandwidth, low CPU consumption, low latency, etc., and is widely used in the fields of high-performance computing and high-performance storage. There are mainly three types of RDMA protocols, namely InfiniBand (IB), RoCE, and iWARP protocols. Among them, the RDMA network based on the InfiniBand protocol has the best performance and requires dedicated IB network cards and IB switches.

[0050] The IB network card registers a separate memory, which is exclusive to the network card and can be directly used by the network card. However, when the IB network card is in use, it does not support the combination with RDMA. When there are multiple network cards in the environment, multiple registered memories need to be allocated to the network cards within one process. But in actual use, some IB network cards are not used, which results in the waste of resources such as the memory registered by the IB network card. And some IB network cards are frequently used, and the traffic used by these IB network cards is a lot, while the traffic used by other IB network cards is less, thus leading to the problem of uneven traffic among IB network cards and a decrease in the total business bandwidth.

[0051] This application provides a network card selection method. By selecting a target network card according to the traffic information of each network card and releasing the resources occupied by the unused network cards, the memory and traffic within the network card are managed to solve the above problems. Among them, this method is based on the Linux platform and interacts with multiple network cards. As Figure 1 shown, this method specifically includes:

[0052] S10: According to the IP address information of the network card connection object and the status information of the network card, determine whether to store the network card in the list of candidate network cards.

[0053] The network card connection object is the device that the network card needs to establish a connection with, such as a computer, a server, etc. Specifically, a connection can be established between a port of the device and a port of the network card. Obtaining the Internet Protocol (IP) address information of the interconnected networks of the connection object enables data transmission between different hosts through the address information of this protocol, which is used to achieve data transmission between the network card and the connection object. Among them, the status information of the network card can include but is not limited to: the IP address information of the network card, the port connection status information of the network card, the RDMA connection list on the network card, and the non-uniform memory access node (numa node) value information of the network card.

[0054] The network card can be an IB network card or other types of network cards, which is not limited here. The network card is stored in the list of candidate network cards by storing the relevant information of the network card in the list of candidate network cards. The list of candidate network cards stores the relevant information of all network cards that can perform data transmission with the connection object. The target network card that is most suitable for connecting to the connection object can be found in this list. Not every network card can be stored in the list of candidate network cards. Since not all network cards in a device are available, it is necessary to judge whether the network card is available according to the status information of the network card. For available network cards, not all of them can perform data transmission with the connection object. It is necessary to further select network cards with the same IP address as the connection object from the available network cards, and store the network cards that meet the above conditions in the list of candidate network cards.

[0055] S11: Release the occupied resources of the other network cards outside the list of candidate network cards.

[0056] The other network cards refer to all other network cards that have not been added to the list of candidate network cards; the occupied resources are the memory resources allocated before a network card is used and resources such as the traffic used by the network card; by releasing the occupied resources of the other network cards in a timely manner, the memory occupancy of the process can be effectively reduced, and more traffic resources can be provided for the network cards in the list of candidate network cards for use.

[0057] S12: Obtain the traffic information of each network card in the list of candidate network cards.

[0058] To obtain the traffic information of each network card in the list of candidate network cards, specifically, the traffic information of the receiving and sending of each network card port can be queried through the interface of the Linux system. The traffic information of the network card port can be monitored in real time, and the obtained traffic information can be saved in the above-mentioned status information.

[0059] S13: Obtain the target network card from the list of candidate network cards according to the traffic information.

[0060] The purpose of selecting a network card is to be able to process the process in the connection object of the network card. Each network card in the list of candidate network cards can process this process. However, considering whether the network card can process a process in a timely manner, at this time, it is judged through the traffic information. If the traffic used by the network card is relatively large at this moment, it proves that the network card is processing other processes. Therefore, other network cards with less traffic used at this moment are selected to process this process; the network card with less traffic used is the target network card, which can effectively improve the efficiency of processing this process. At the same time, further considering the problem of uneven traffic used by the network card, the service bandwidth is also improved.

[0061] On the other hand, considering that there may be a binding relationship between the target network card and the process, that is, the process can be processed quickly through a specific network card. The specific binding relationship is as follows: Determine whether the process is bound to the core of the central processing unit (CPU). If so, the network card related to the CPU core binding can be further searched, and the efficiency of processing the process can be further improved through this network card. The specific processing method will not be described here.

[0062] For the network card selection method provided in this embodiment, when selecting the target network card, the resources of the network card devices irrelevant to the process are released, avoiding the waste of resources such as the registered memory by these network cards, and the target network card is selected according to the traffic information of the network card, so that the relatively idle network cards can be effectively utilized, avoiding the problem of unbalanced traffic of the working network cards, and improving the total bandwidth of the service.

[0063] Based on the above embodiment, it is specified that if there is a newly added network card in the list of candidate network cards, obtaining the traffic information of each network card in the list of candidate network cards includes: controlling each original network card in the list of candidate network cards to disconnect a preset number of RDMA connections, and allocating the traffic corresponding to the disconnected RDMA connections to the newly added network card, and obtaining the traffic information of each network card in the list of candidate network cards.

[0064] In step S10, the network cards that meet the requirements are continuously added to the list of candidate network cards; when the total bandwidth of the traffic used by all network cards is relatively high, it is also necessary to control the traffic allocated to each network card to be relatively balanced. Therefore, as the number of network cards changes, it is necessary to adjust the traffic information of each network card in the list of candidate network cards to avoid the situation where the original network cards continuously occupy the traffic and the newly added network cards cannot be allocated traffic.

[0065] The traffic allocated to each network card is specifically reflected in the number of RDMA connections on that network card, and each RDMA connection occupies a certain amount of traffic. Therefore, in this embodiment, when there is a newly added network card in the list of candidate network cards, it is controlled that each original network card disconnects a preset number of RDMA connections, so that each original network card can allocate a certain amount of traffic to the new network card. On the basis of controlling that the original network card can still allocate a certain amount of traffic, the newly added network card can also be allocated traffic. By further controlling the preset number, the traffic of the newly added network card is made the same as that of each original network card, so as to achieve the balance of traffic among the network cards and improve the total bandwidth. The preset number can be the default number set by the system or the user, such as each network card disconnects one or two RDMA connections; it can also be that the system detects the number of original network cards and newly added network cards, and further calculates the number of connections to be disconnected for each network card according to the traffic occupied by the RDMA connection. For example, if there are 5 original network cards and 1 newly added network card, then each original network card may allocate the traffic of disconnecting one connection to the newly added network card. If there are 3 original network cards and 2 newly added network cards, then each original network card may need to allocate the traffic of disconnecting two connections to the newly added network card.

[0066] If a certain network card is the main network card, it is necessary to keep its traffic at a high level all the time. Therefore, the RDMA link on this network card can be not disconnected; only the above steps are performed on the remaining original network cards to allocate traffic to the new network card.

[0067] On the basis of the above embodiment, this embodiment defines how to specifically allocate traffic to the newly added network card, so that the traffic occupied by each network card is more balanced, thereby improving the total bandwidth of the service.

[0068] On the basis of the above embodiment, it is further defined that the preset number is determined by the number information of the network cards in the list of candidate network cards and the traffic information of the original network cards.

[0069] The number information of the network cards includes: the total number of network cards, the number of newly added network cards, the number of original network cards, etc.; the traffic information of the original network cards includes: the traffic used by each original network card, and the traffic corresponding to the RDMA connection on the network card; specifically, the number of RDMA connections to be disconnected for each original network card = {the traffic used by each original network card * [1 - (the number of newly added network cards / the total number of network cards)]} / the average traffic corresponding to the RDMA connection on each original network card; according to the above formula, the number of RDMA connections to be disconnected for each original network card is calculated, so as to ensure the balance of the traffic used by each network card; the average traffic corresponding to the RDMA connection can be calculated by the number of bytes of the message of the information to be transmitted and the transmission time.

[0070] By defining the preset number of connections to be disconnected for each network card, this embodiment further ensures the balance of the traffic used by each network card and improves the total bandwidth of the service.

[0071] As a preferred embodiment, it is defined that the status information includes: connected state, unconnected state; it is further defined that step S10 includes: storing the network cards in the connected state in the available network card list; storing the network cards in the unconnected state in the unavailable network card list; selecting from the available network card list the network cards that have the same network segment as the IP address of the network card connection object, and storing the network cards in the candidate network card list.

[0072] In this embodiment, it is defined that the status information includes the connection state of the network card. That is, whether the port of the network card is connected to the peer; among them, the network card with the port not connected is an unavailable network card, and this network card is stored in the unavailable network card list, while the network card with the port connected successfully is an available network card and is stored in the available network card list. The list in which the network card is stored will change according to the connection state of the network card. Not every network card in the available network card list can be connected to the connection object. It is necessary to further screen from the available network card list the network cards that have the same IP address as the connection object, and put this part of the network cards into the candidate network card list.

[0073] In this embodiment, it is defined that the network card will be stored in the available and unavailable network card lists according to the status information first, to avoid storing the unconnected network card in the candidate network card list, and screen the network cards that can be connected to the connection object according to the IP address to ensure the availability of the network card.

[0074] On the basis of the above embodiment, because the network card will change according to the change of its status information and its availability will also change, so this embodiment defines that when the unavailable network card list is not empty, it further includes: creating a network card status monitoring thread to monitor the status information of the network cards in the unavailable network card list; when the status of the network card changes from the unconnected state to the connected state, changing the network card from the unavailable network card list to the available network card list.

[0075] Create a corresponding monitoring thread to monitor whether there are unconnected network cards. For example, for a certain unconnected network card, if its port connection state is changed to a connected network card through user or system operation, this thread needs to obtain this change information in time and change this network card from the unavailable network card list to the available network card list in time, so as to ensure that all the network cards in the available network card list and the candidate network card list are available network cards. Among them, this monitoring thread can further monitor the connected network cards. If its status information becomes the unconnected state, this network card also needs to be stored in the unavailable network card list in time to avoid affecting the candidate network card list.

[0076] In this embodiment, it is defined that the status of the network card is monitored through the monitoring thread, so as to ensure the accuracy of the network card information in the available network card list, and further improve the accuracy of the network card information in the candidate network card list, and avoid the problem that the connection object is connected to the unconnected network card.

[0077] Based on the above embodiments, it is defined that step S11 includes: releasing the registered memory of the other network cards outside the list of candidate network cards and disconnecting the RDMA connections on the other network cards.

[0078] The occupied resources of a network card include the resources of its registered memory and the RDMA connection on the network card. By releasing the registered memory and disconnecting the RDMA connection on the network card, the memory and traffic of the network card are released, so as to provide more traffic for each network card in the list of candidate network cards for use, and at the same time avoid wasting the registered memory of unused network cards.

[0079] Based on the above embodiments, step S13 is further defined, and this step specifically includes:

[0080] According to the relationship between the process of the network card connection object and the CPU and the traffic information, obtain the target network card from the list of candidate network cards; specifically, this step includes:

[0081] Judge whether the process of the network card connection object is bound to the CPU core;

[0082] If not, sort the network cards in the list of candidate network cards according to the traffic volume, and select the network card with the smallest traffic load as the target network card;

[0083] If so, judge whether the node values of the network cards in the list of candidate network cards match the node values of the CPU cores corresponding to the process;

[0084] If they match, remove the unmatched network cards from the list of candidate network cards, and enter the step of sorting the network cards in the list of candidate network cards according to the traffic volume and selecting the network card with the smallest traffic load as the target network card;

[0085] If they do not match, enter the step of sorting the network cards in the list of candidate network cards according to the traffic volume and selecting the network card with the smallest traffic load as the target network card.

[0086] Wherein the process is the process that the network card connection object needs to connect to the network card. As described in the above embodiments, a network card has a binding relationship with the core of the CPU, that is, each core in a CPU only processes the process bound to itself. Of course, the cores of the CPU can also process a process at the same time, but this will cause the process to switch between multiple CPU cores, resulting in problems such as slow processing efficiency.

[0087] Among them, whether the process in the connection object can be efficiently processed is related to the network card on the one hand and the relationship between the CPU and the network card handling the process connection on the other hand. The relationship between the process of the network card connection object and the CPU is that there is a core-binding relationship between the process and the CPU. Specifically, the process is matched with the core under the CPU. If a process does not have relevant information about binding to the CPU core, the network cards in the candidate network card list are directly sorted according to the traffic volume used by each network card, and the network card with less traffic volume is selected as the target network card. If there is a core-binding relationship between the process and the CPU core, this relationship is specifically reflected in the value of the core-binding cpu numa node of the process. For example, if the value is -1, it proves that there is no core-binding relationship for this process; if it is not -1, it proves that there is a core-binding relationship. Further, a network card having a binding relationship with the process is selected from the candidate network card list, that is, the core-binding cpu numa node of the process matches the numa node of the network card device. If it exists, the unmatched network cards need to be removed from the candidate network card list. The unmatched network cards can be stored in the unavailable network card list or a list of network cards to be destroyed can be created for storage. And a network card with less traffic volume is selected as the target network card from the new candidate network card list. If it does not exist, any network card can process this process, and only a network card with less traffic volume needs to be selected as the target network card.

[0088] In this embodiment, a preferred method for finding the target network card is defined. By determining whether the process is bound to the CPU and the network card, if so, a target network card is further selected from the network cards having the same binding relationship with the process according to the load traffic volume of the network card, and the network card with the smallest load traffic volume is selected as the target network card. The selection method of this embodiment can effectively improve the processing efficiency of the process.

[0089] This application also provides an embodiment of the network card selection method in a specific application scenario; as Figure 2 shown, this method specifically includes in this application scenario: S20: In response to a request of the network card connection object, store the network card in the available network card list and the unavailable network card list according to the status information; S21: Select the corresponding network card from the available network card list according to the IP address information of the network card connection object and store it in the candidate network card list; S22: Release the registered memory of the network cards other than those in the candidate network card list and disconnect the RDMA connections on the other network cards; S23: Screen each network card in the candidate network card list according to the relationship between the process of the network card connection object and the CPU; S24: Obtain the traffic information of each network card in the candidate network card list, and obtain the target network card from the screened candidate network card list according to the traffic information.

[0090] In this embodiment, each step corresponds to the above embodiment and will not be described here. Among them, the network card status information can be managed by setting a network card information management module; the traffic information can be collected and statistically analyzed by a traffic statistics module. The registered memory of the network card and the RDMA connection on the network card can be managed by a network card resource management module. A network card selection policy can be set to store the selection of the target network card in steps S24 and S25. Among them, step S23 is an optional step. If the process of the network card connection object does not have a core-binding relationship with the CPU, step S24 can be directly entered.

[0091] The network card selection method provided in this embodiment corresponds to the above embodiment and has the same beneficial effects as the above embodiment.

[0092] In the above embodiment, the network card selection method is described in detail. The present application also provides an embodiment corresponding to the network card selection device. It should be noted that the present application describes the embodiments of the device part from two perspectives, one is from the perspective of functional modules, and the other is from the perspective of hardware.

[0093] From the perspective of functional modules, the present application also provides an embodiment corresponding to a network card selection system, as Figure 3 shown. The system includes:

[0094] A judgment module 10, configured to judge whether to put a network card into a list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card;

[0095] A release module 11, configured to release the occupied resources of the other network cards outside the list of candidate network cards;

[0096] A first acquisition module 12, configured to acquire the traffic information of each network card in the list of candidate network cards;

[0097] A second acquisition module 13, configured to acquire a target network card from the list of candidate network cards according to the traffic information.

[0098] Since the embodiments of the network card selection system part correspond to the embodiments of the method part, the network card selection system may further include:

[0099] A creation module, configured to create a network card status monitoring thread to monitor the status information of the network cards in the unavailable network card list;

[0100] A change module, configured to change the network card from the unavailable network card list to the available network card list when the status of the network card changes from the unconnected state to the connected state.

[0101] The network card selection system provided in this embodiment corresponds to the above method, so it has the same beneficial effects as the above method.

[0102] From a hardware perspective; this embodiment provides an electronic device; Figure 4 The structural diagram of the electronic device provided by another embodiment of the present application is as Figure 4 shown. The electronic device includes: a memory 20 for storing computer programs;

[0103] a processor 21 for implementing the steps of the network card selection method mentioned in the above embodiments when executing the computer program.

[0104] The electronic device provided by this embodiment may include, but is not limited to, a smart phone, a tablet computer, a laptop computer, or a desktop computer, etc.

[0105] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may further include an artificial intelligence (AI) processor, and the AI processor is used to process computational operations related to machine learning.

[0106] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201. After the computer program is loaded and executed by the processor 21, the related steps of the network card selection method disclosed in any of the foregoing embodiments can be implemented. In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, etc., and the storage method may be transient storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data included in the network card selection method.

[0107] In some embodiments, the electronic device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0108] Those skilled in the art can understand that Figure 4 the structure shown in does not constitute a limitation on the electronic device, and it may include more or fewer components than shown in the figure.

[0109] The electronic device provided by the embodiment of the present application includes a memory and a processor. When the processor executes the program stored in the memory, the following method can be implemented: a network card selection method.

[0110] The electronic device provided by this embodiment corresponds to the above method, so it has the same beneficial effects as the above method.

[0111] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0112] It can be understood that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0113] The computer-readable storage medium provided in this embodiment corresponds to the above network card selection method, so it has the same beneficial effects as the above method.

[0114] The above has introduced in detail the network card selection method, system, electronic device and medium provided by this application. Each embodiment in the specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method part. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of this application, several improvements and modifications can still be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0115] It should also be noted that in this specification, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the said element.

Claims

1. A network card selection method, characterized in that, including: judging whether to store the network card in a list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card; releasing the occupied resources of the remaining network cards outside the list of candidate network cards; obtaining the traffic information of each network card in the list of candidate network cards; obtaining a target network card from the list of candidate network cards according to the traffic information; if there is a newly added network card in the list of candidate network cards, then the obtaining the traffic information of each network card in the list of candidate network cards includes: controlling each original network card in the list of candidate network cards to disconnect a preset number of RDMA connections, allocating the traffic corresponding to the disconnected RDMA connections to the newly added network card, and obtaining the traffic information of each network card in the list of candidate network cards; wherein, the quantity information of the network cards includes the total quantity of network cards, the quantity of newly added network cards, and the quantity of original network cards, and the traffic information of the original network cards includes the traffic used by each original network card and the traffic corresponding to the RDMA connections on the original network cards; the preset number is determined by the quantity information of the network cards in the list of candidate network cards and the traffic information of the original network cards; wherein, the calculation formula of the preset number is: preset number = {traffic used by each original network card * [1 - (quantity of newly added network cards / total quantity of network cards)]} / average traffic corresponding to the RDMA connections on each original network card; wherein, the average traffic corresponding to the RDMA connections is determined by calculating the number of bytes of the message of the required transmission information and the transmission time; the judging whether to store the network card in the list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card includes: storing the network cards with the status information in the connected state and having the same network segment as the IP address of the network card connection object in the list of candidate network cards.

2. The network card selection method according to claim 1, wherein the status information includes: connected state, unconnected state; the judging whether to store the network card in the list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card includes: storing the network cards in the connected state in a list of available network cards; storing the network cards in the unconnected state in a list of unavailable network cards; selecting the network cards having the same network segment as the IP address of the network card connection object from the list of available network cards and storing the network cards in the list of candidate network cards.

3. The network card selection method according to claim 2, wherein when the list of unavailable network cards is not empty, it further includes: creating a network card status monitoring thread to monitor the status information of the network cards in the list of unavailable network cards; when the status of the network card changes from the unconnected state to the connected state, changing the network card from the list of unavailable network cards to the list of available network cards.

4. The network card selection method according to claim 1, wherein the releasing the occupied resources of the remaining network cards outside the list of candidate network cards includes: releasing the registered memory of the remaining network cards outside the list of candidate network cards and disconnecting the RDMA connections on the remaining network cards.

5. The network card selection method according to any one of claims 1 to 4, characterized in that the obtaining a target network card from the list of candidate network cards according to the traffic information includes: obtaining a target network card from the list of candidate network cards according to the relationship between the process of the network card connection object and the CPU and the traffic information; Obtaining a target network card from the list of candidate network cards according to the relationship between the process of the network card connection object and the CPU and the traffic information includes: Judging whether the process of the network card connection object is bound to a core of the CPU; If not, sorting each network card in the list of candidate network cards according to the traffic volume, and selecting the network card with the smallest traffic load as the target network card; If so, judging whether the node value of each network card in the list of candidate network cards matches the node value of the CPU core corresponding to the process; If they match, removing the network cards that do not match from the list of candidate network cards, and entering the step of sorting each network card in the list of candidate network cards according to the traffic volume, and selecting the network card with the smallest traffic load as the target network card; If they do not match, entering the step of sorting each network card in the list of candidate network cards according to the traffic volume, and selecting the network card with the smallest traffic load as the target network card.

6. A network card selection system, characterized in that, Including: A judging module, configured to judge whether to store the network card in the list of candidate network cards according to the IP address information of the network card connection object and the status information of the network card; A releasing module, configured to release the occupied resources of the other network cards outside the list of candidate network cards; A first obtaining module, configured to obtain the traffic information of each network card in the list of candidate network cards; A second obtaining module, configured to obtain a target network card from the list of candidate network cards according to the traffic information; The network card selection system is specifically configured to: Control each original network card in the list of candidate network cards to disconnect a preset number of RDMA connections, allocate the traffic corresponding to the disconnected RDMA connections to the newly added network cards, and obtain the traffic information of each network card in the list of candidate network cards; wherein, the quantity information of the network cards includes the total quantity of the network cards, the quantity of the newly added network cards, and the quantity of the original network cards, and the traffic information of the original network cards includes the traffic used by each original network card and the traffic corresponding to the RDMA connections on the original network cards; The preset number is determined by the quantity information of the network cards in the list of candidate network cards and the traffic information of the original network cards; wherein, the calculation formula of the preset number is: Preset number = {traffic used by each original network card * [1 - (quantity of newly added network cards / total quantity of network cards)]} / average traffic corresponding to the RDMA connections on each original network card; Wherein, the average traffic corresponding to the RDMA connection is calculated and determined by the number of bytes of the message of the required transmission information and the transmission time; The judging module is specifically configured to: Store the network cards with the status information in the connected state and having the same network segment as the IP address of the network card connection object in the list of candidate network cards.

7. An electronic device, characterized in that, Including a memory for storing a computer program; A processor, configured to implement the steps of the network card selection method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the network card selection method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Distributed storage network integration method and system

    CN106412039A

  • Delay request device and method for distributing CPU resources to physical network adapter

    CN107147714A

  • Information processing method and device and storage medium

    CN111343731A