Resource management method and related equipment
By dynamically selecting queues and transmission contexts, the problem of excessive memory usage by RDMA connections is solved, and larger-scale network device interconnection and performance improvement are achieved.
Patent Information
- Application Number
- CN202410288025.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2025-09-12
AI Technical Summary
The RDMA connections between network devices of artificial intelligence computing power on the cloud occupy too much memory, resulting in limited network device scale and hindering the expansion of computing power.
By dynamically selecting queues and transmission contexts, fixed memory resources are reduced. Dynamic resource management methods are adopted to flexibly bind queues and transmission contexts to reduce memory usage.
It reduces memory usage without affecting connection availability, supports larger-scale interconnection of network devices, and improves network performance and resource utilization.
Smart Images

Figure CN120639713A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource management method and related equipment. Background Art
[0002] With the continuous development of artificial intelligence (AI) technology, the scale of AI computing power in the cloud is constantly expanding. To ensure high-performance computing and the scale of computing power expansion in the cloud, the network devices responsible for providing computing power on the cloud need to maintain high-performance network communication, and the scale of interconnected network devices is also gradually increasing.
[0003] Remote Direct Memory Access (RDMA) technology is a key enabler for high-performance network communications. RDMA allows hardware-based management of communication connection status and host-side address access permissions through network interfaces. Data path processing during communication requires minimal involvement from the host's central processing unit (CPU) or operating system, enabling high throughput and low latency network transmission.
[0004] RDMA-enabled network devices provide memory resources to cache the connection information required to establish RDMA connections and the data that needs to be transmitted over these connections. When network devices are interconnected on a large scale, RDMA connections consume a large amount of memory and are costly. Excessive memory costs limit the scale of interconnected network devices and hinder the further development of cloud computing power. Therefore, while meeting the data transmission requirements between network devices, reducing the memory usage of RDMA connections is a technical challenge that needs to be addressed. Summary of the Invention
[0005] This application provides a resource management method that aims to dynamically select the queues and transmission contexts required for this data transmission, reduce fixed memory resources, and reduce the number of queues and the restrictions on the number of transmission context caches imposed by the memory occupied by the queues, thereby helping to overcome the limitations of insufficient memory on the connection scale of network devices. This application also provides corresponding apparatus, computing devices, computing device clusters, computer-readable storage media, and computer code products.
[0006] In the first aspect, the present application provides a resource management method, which is applied to a sending end. In a specific implementation, the sending end obtains a message indicating a data transmission task. The message includes destination information and data information. Among them, the destination information is used to identify the target destination of this data transmission task. The data information is used to identify the data transmitted to the target destination. The target queue for caching messages for this data transmission task and the target transmission context for establishing a connection between the sending end and the target destination are selected from a pre-established resource pool. In this way, a suitable target queue and target transmission context can be selected based on the needs of executing the data transmission task. Dynamically selecting the target queue and target transmission context based on communication needs can avoid the problem of continuous memory occupation caused by static resource configuration to a certain extent, thereby supporting the interconnection of larger-scale network devices. After determining the target queue and target transmission context, a message is obtained from the target queue, and a data packet consisting of data and target transmission context is sent to the target destination according to the message.
[0007] In one possible implementation, when selecting a destination queue, priority is given to the queue serving the target destination. Specifically, if the resource pool includes the queue serving the target destination, the target queue is selected from the queues serving the target destination. Using the queue serving the target destination as the target queue allows the queue serving the target destination to be reused, eliminating the need to recreate the queue and configure the queue's destination information, reducing performance loss and conserving resources. If the target queue is currently bound to a transmission context, the transmission context bound to the target queue is used as the target transmission context. This prioritizes the reuse of the binding relationship between the target queue and the transmission context, reducing performance loss caused by unbinding and establishing bindings between the queue and the transmission context, and conserving processing resources. If the target queue is not currently bound to any other transmission context, the target transmission context is selected from the resource pool. In some possible implementations, when selecting a target queue from the queues serving the target destination, a queue that meets an availability condition is selected as the target queue. The availability condition is that the number of messages currently processed by the queue is less than a threshold. The number of messages currently processed by the queue is the number of messages processed by the queue since its creation. Selecting a queue that meets the availability conditions as the target queue can limit the maximum number of messages that the queue can process during a single binding, which helps achieve queue load balancing.
[0008] In one possible implementation, if none of the queues at the target destination meet the availability criteria, a queue that meets the availability criteria is selected from the queue resource pool as the target queue. If the queue at the target destination cannot be reused, a queue that meets the availability criteria is selected from the queue resource pool as the target queue. This allows the queue that processes fewer messages to be selected as the target queue for this cached message, while queues that process more messages are decommissioned. This facilitates the subsequent release of queue resources, improves the balance of queue usage, and achieves queue load balancing.
[0009] If the target queue is not currently bound to a transport context, an appropriate transport context is selected as the target transport context based on the binding priority. The binding priority is positively correlated with the resource reuse of the transport context. This allows the selection of an appropriate transport context based on the resource reuse of the transport context.
[0010] Furthermore, a transmission context of first priority is a transmission context that is not bound to a queue and has a connection established with a target destination. A transmission context of second priority is a transmission context that has no connection established. A transmission context of third priority is a transmission context that is not bound and has a connection established with another destination. The first priority is higher than the second priority, and the second priority is higher than the third priority.
[0011] If the transmission context resource pool includes a transmission context of the first priority, a target transmission context is selected from the transmission context of the first priority. The target transmission context selected from the transmission context of the first priority reuses the already established connection with the target destination, eliminating the need to reestablish a connection between the sender and the destination. This saves connection establishment costs and reduces performance loss on both the sender and the destination.
[0012] If the transmission context resource pool does not include the first-priority transmission context but includes the second-priority transmission context, the target transmission context is selected from the second-priority transmission context. Selecting the target transmission context from the transmission contexts with no established connection prioritizes maintaining connections, minimizes disconnecting established connections, reduces performance loss caused by frequent disconnections, reduces latency caused by disconnecting existing connections, improves network bandwidth utilization, and fully utilizes network resources.
[0013] If the transport context resource pool does not include the first-priority and second-priority transport contexts, but does include the third-priority transport context, the target transport context is selected from the third-priority transport context. Using the third-priority transport context as the lowest-priority transport context for binding prioritizes maintaining existing connections when sufficient transport context resources are available, reducing the frequency of disconnections.
[0014] For a target transmission context selected from the transmission contexts of the first priority, the second priority, or the third priority, the target queue is bound to the selected target transmission context.
[0015] If the target transmission context is a transmission context of the second priority or the third priority, the target transmission context is also used to establish a connection between the sender and the target destination. Furthermore, if the target transmission context is a transmission context of the third priority, before establishing a connection between the sender and the target destination, the sender is disconnected from the other destinations in order to establish a connection between the sender and the target destination.
[0016] In one possible implementation, before the data transmission task indicated by the completion message is executed, the target transmission context remains bound to the target queue, so as to facilitate normal processing of the data transmission task indicated by the message.
[0017] In one possible implementation, after the data transmission task indicated by the completion message is executed, if the target queue meets the unbinding condition, the binding between the target queue and the target transmission context is released. This can promptly release the memory resources occupied by the transmission context and the queue, and release the fixed binding relationship between the transmission context and the queue. The transmission context and the queue can be flexibly bound based on needs without establishing a fixed binding relationship, reducing the number of queues caused by fixed binding and the restrictions on the number of transmission context caches occupied by the queues. In one possible implementation, as an example, the unbinding condition is that the message processing is completed and the target queue does not include any cached messages.
[0018] In a possible implementation, the resource pool includes a queue resource pool and a transmission context resource pool.
[0019] In a second aspect, the present application provides a resource management device, which is applied to a sending end and includes:
[0020] A message processing module, configured to obtain a message indicating a data transmission task, wherein the message includes destination information and data information, wherein the destination information is used to identify a target destination, and the data information is used to identify data to be transmitted to the target destination;
[0021] A resource management module, configured to select a target queue and a target transmission context from a resource pool according to the destination information, wherein the target queue is used to cache the message, and the target transmission context is used to establish a connection between the sending end and the target destination;
[0022] The message processing module is further configured to obtain the message from the target queue, and send a data packet consisting of the data and the target transmission context to the target destination according to the message.
[0023] In a possible implementation, the resource management module is specifically configured to:
[0024] Selecting a target queue from the queues in the resource pool that serve the target destination;
[0025] If the target queue is currently bound to a transmission context, the transmission context bound to the target queue is selected as the target transmission context;
[0026] If the target queue is not currently bound to a transmission context, a target transmission context is selected from the resource pool.
[0027] In a possible implementation, the resource management module is configured to select a target queue from queues in the resource pool that serve the target destination, including:
[0028] The resource management module is used to select a queue that meets the availability condition from the queues serving the target destination to obtain the target queue, where the availability condition includes that the number of messages currently processed cumulatively by the queue is less than a quantity threshold.
[0029] In a possible implementation, the resource management module is further configured to:
[0030] If none of the queues serving the target destination meet the availability conditions, select a queue from the resource pool that meets the availability conditions.
[0031] In a possible implementation, the resource management module is configured to select a target transmission context from the resource pool if the target queue is not currently bound to a transmission context, including:
[0032] The resource management module is used to select a target transmission context according to the binding priority of the transmission context included in the resource pool if the target queue is not currently bound to the transmission context, and the binding priority of the transmission context is positively correlated with the resource reuse degree of the transmission context.
[0033] In a possible implementation, the resource management module is configured to select a target transmission context according to the binding priority of the transmission contexts included in the resource pool, including:
[0034] The resource management module is used to select a target transmission context from the transmission context of the first priority if the transmission context resource pool includes a transmission context of the first priority, the transmission context of the first priority is not bound to a queue and is connected to the target destination; if the transmission context resource pool does not include the transmission context of the first priority, select a target transmission context from the transmission context of the second priority, the transmission context of the second priority is not connected; if the transmission context resource pool does not include the transmission context of the first priority and the transmission context of the second priority, select a target transmission context from the transmission context of the third priority, the transmission context of the third priority is connected to other destinations, and the other destinations are destinations other than the target destination.
[0035] In a possible implementation, the target transmission context is the transmission context of the first priority, the transmission context of the second priority, or the transmission context of the third priority, and the resource management module is further configured to:
[0036] Bind the target transmission context to the target queue.
[0037] In a possible implementation, the target transmission context is the transmission context of the second priority or the transmission context of the third priority, and the resource management module is further configured to:
[0038] The target transmission context is used to establish a connection between the sending end and the target destination end.
[0039] In a possible implementation, the target transmission context is a transmission context of a third priority, and the resource management module is further configured to:
[0040] Before establishing a connection between the sending end and the target destination end by using the target transmission context, disconnecting the sending end from the other destination end.
[0041] In a possible implementation, before the data transmission task indicated by the message is completed, the target transmission context remains bound to the target queue.
[0042] In a possible implementation, the resource management module is further configured to:
[0043] If the target queue meets the unbinding condition, the target queue is unbound from the target transmission context.
[0044] In a possible implementation, the unbinding condition is that the data transmission task indicated by the message is completed, and the target queue does not include any cached messages.
[0045] In a possible implementation, the resource pool includes a queue resource pool and a transmission context resource pool.
[0046] In a third aspect, the present application provides a computing device comprising at least one processor and at least one memory; the at least one memory is used to store instructions, and the at least one processor executes the instructions stored in the at least one memory, so that the computing device executes the resource management method in the above-mentioned first aspect or any possible implementation of the first aspect. It should be noted that the memory can be integrated into the processor or can be independent of the processor. The at least one computing device may also include a bus. The processor is connected to the memory via the bus. The memory may include a readable memory and a random access memory.
[0047] In a fourth aspect, the present application provides a computing device cluster, the computing device cluster includes at least one computing device, the at least one computing device includes at least one processor and at least one memory; the at least one memory is used to store instructions, and the at least one processor executes the instructions stored in the at least one memory, so that the computing device executes the resource management method in the above-mentioned first aspect or any possible implementation of the first aspect. It should be noted that the memory can be integrated into the processor or can be independent of the processor. The at least one computing device may also include a bus. The processor is connected to the memory via a bus. The memory may include a readable memory and a random access memory.
[0048] In a fifth aspect, the present application provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on at least one computing device, the at least one computing device executes the resource management method described in any one of the above aspects or any one of the implementations of any one of the aspects.
[0049] In a sixth aspect, the present application provides a computer program product comprising instructions, which, when executed on at least one computing device, enables the at least one computing device to execute the resource management method described in any one of the above aspects or any one of the implementations of any one of the aspects.
[0050] Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1A schematic diagram of the system architecture of a server provided in an embodiment of the present application;
[0052] Figure 2 A flowchart of a resource management method provided in an embodiment of the present application;
[0053] Figure 3 A flowchart of a method for selecting a target queue provided in an embodiment of the present application;
[0054] Figure 4 A flowchart of a method for selecting a target transmission context from a transmission context resource pool provided in an embodiment of the present application;
[0055] Figure 5 A flowchart of another resource management method provided in an embodiment of the present application;
[0056] Figure 6 A schematic diagram of a resource usage process provided in an embodiment of the present application;
[0057] Figure 7 A schematic diagram of the structure of a resource management device provided in an embodiment of the present application;
[0058] Figure 8 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0059] Figure 9 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0060] Figure 10 A schematic diagram of the structure of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The following will describe the solutions in the embodiments provided in this application in conjunction with the drawings in this application.
[0062] The terms "first," "second," and the like in the specification, claims, and drawings of this application are used to distinguish similar objects, and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate. This is merely a way of distinguishing objects with the same attributes in the embodiments of this application.
[0063] First, some technical terms involved in the embodiments of this application are introduced.
[0064] RDMA technology transfers data directly from the memory of one computer to another. Direct means that data can be read and written to remote memory just like accessing local memory, bypassing the complex Transmission Control Protocol (TCP) / Internet Protocol (IP) network stack of traditional Ethernet. This eliminates the need to copy data between application memory and the kernel, reduces CPU consumption, minimizes transmission latency, and achieves high-performance network transmission.
[0065] RDMA supports three types of queues: the send queue (SQ), the receive queue (RQ), and the completion queue (CQ). The send queue and receive queue are work queues (WQ). The network device's software submits a work request (WR) to the work queue. Each element in the work queue is called a work queue element (WQE). The RDMA-capable hardware in the network device retrieves the WQE from the work queue for processing. After the hardware completes processing, it places a work completion (WC) in the completion queue (CQ). The software retrieves the WC from the completion queue to confirm that the WR processing is complete.
[0066] The transport context (TPC) contains the context information of the connection, that is, the information for managing the RDMA connection. Each RDMA connection has a corresponding transport context.
[0067] Network devices, such as servers, need to provide a certain amount of memory to store RDMA connection information, such as caching the TPC used to establish RDMA connections. The amount of memory occupied by connection information is related to the scale of the interconnection between network devices.
[0068] As an example, the amount of memory occupied by the connection information of a single connection is 16 kilobytes (KB). The fixed information included in the connection information, such as network location information, occupies 128 bytes (B) of memory. A network device, as a node, supports interconnection with a cluster of 4,000 (K) nodes. The network device supports 2K processes.
[0069] Taking a single connection as an example, if static resource allocation is used to establish a static connection between processes and maintain the connection for a long time, 4K × 2K × 16KB of memory, or 128 gigabytes (GB), is required. If only fixed information in the connection is statically allocated, and the rest is dynamically allocated, a single connection requires at least 4K × 2K × 128B of memory, or approximately 1GB. This shows that static resource allocation requires a large amount of fixed memory resources, while dynamic resource allocation can reduce the memory resources occupied by connection information without affecting connection availability.
[0070] Currently, the industry commonly uses Dynamically-connected Transport Service (DCT) and Dynamic Context Attachment (DCA) technologies to achieve dynamic management of connection resources.
[0071] DCT dynamically establishes and disconnects connections based on the destination server requested by the user and the current server connectivity. Resources are requested before establishing a connection and released after disconnecting, enabling dynamic resource management. Dynamic connection establishment and disconnection reduces memory usage by connection information and the send queue. However, frequent connection establishment and disconnection can degrade device performance. Establishing a connection for a new transmission task takes time, leading to high transmission latency and low network bandwidth utilization. DCT is particularly ineffective in congested scenarios.
[0072] The principle of DCA is to divide connection information into long-term network context and short-term forwarding context, statically allocating resources for network context and dynamically allocating resources for forwarding context to reduce memory usage. However, storing network context still requires continuous memory usage, which limits the scale of interconnections supported by network devices. Furthermore, forwarding context and queues are fixedly bound to each other. The memory occupied by a single forwarding context is much smaller than that occupied by a single queue. As a result, the number of forwarding contexts that a network device can cache is limited by the number of queues and the large amount of memory occupied by the queues. This can lead to insufficient memory for caching forwarding contexts, hindering connection establishment and degrading network performance.
[0073] In view of this, embodiments of the present application provide a resource management method. This method is applied to a sending end. The sending end is a network device, such as a server. The sending end obtains a message indicating a data transmission task. The message includes destination information and data information. The destination information is used to identify the target destination. The data information is used to identify the data to be transmitted to the target destination. A target queue for caching the message and a target transmission context for establishing a connection between the sending end and the target destination are selected from a resource pool. This method enables dynamic selection of queues and transmission contexts to be bound based on data transmission requirements, reducing fixed memory usage and helping to alleviate limitations on network device connection scale caused by insufficient memory. A message is obtained from the target queue, and a data packet consisting of the data and the target transmission context is sent to the target destination based on the message, thereby achieving data transmission. This method enables dynamic selection of the queues and transmission contexts required for the current data transmission from the resource pool based on data transmission requirements, enabling flexible selection of queues and transmission contexts and reducing fixed memory usage. Furthermore, transmission contexts and queues can be flexibly bound as needed, eliminating the need for fixed binding relationships. This reduces the limitations on the number of queues and the memory occupied by queues that are imposed on the number of transmission contexts due to fixed binding relationships.
[0074] In one possible application scenario, the resource management method provided in the embodiment of the present application can be applied to a server supporting RDMA on the cloud. Figure 1As shown, this figure is a schematic diagram of the system architecture of a server provided by an embodiment of the present application. The server's software structure includes application software and a network card driver. The network card driver includes a resource management module and a message processing module. The server's hardware structure includes host memory and a network card. The network card supports RDMA. The host memory includes a resource pool. The resource pool includes, for example, a queue resource pool and a transmission context resource pool. The queue resource pool and the transmission context resource pool can be configured during process initialization. The server's network card includes a queue resource management module, a transmission context resource management module, a dynamic connection establishment module, and a forwarding module. The resource management module of the server's network card driver is used to control the host memory and control the network card to run the queue resource management module and the TPC resource management module. The message processing module of the network card driver is used to control the network card to process messages issued by the software. The queue resource management module of the network card is used to manage the queue resource pool and provide functions such as applying for queue resources, binding queues to transmission contexts, releasing queue resources, and querying queue resource status. The TPC resource management module of the network card is used to manage the TPC resource pool and provide functions such as binding queues to TPCs, releasing TPC resources, and querying TPC resource status. The network card's dynamic connection establishment module is used to query available connections based on user-requested messages, establish new connections based on the relevant connection protocols, and provide disconnection functionality. The network card's forwarding module is used to send messages based on the user's requested message and the selected queue and TPC.
[0075] Taking the message processing process as an example, a user triggers the generation of a message indicating a data transmission task through the server's application software. The network interface card driver's message processing module is responsible for receiving the message sent by the application software. The network interface card driver's resource management module is responsible for selecting a target queue and target transmission context from a resource pool based on the destination information. For example, the network interface card's queue resource management module is responsible for selecting a target queue from the queue resource pool. The target queue is used to buffer messages. The network interface card's TPC resource management module is responsible for selecting a target transmission context from the transmission context resource pool. The target transmission context is bound to the target queue during this message transmission. The selected target transmission context is used to establish a connection between the sender and the target destination. If the target transmission context has already established a connection between the sender and the target destination, the network interface card's forwarding module sends a data packet consisting of data and the target transmission context to the target destination. If the target transmission context has not established a connection between the sender and the target destination, the dynamic connection establishment module uses the target transmission context to establish a connection between the sender and the target destination. If the target transmission context has already established a connection between the sender and the target destination, the dynamic connection establishment module first disconnects the sender from the other destination and then uses the target transmission context to establish a connection between the sender and the target destination. The message processing module of the network card driver is used to drive the network card to transmit data based on the target queue and target transmission context. After establishing a connection between the sending end and the target destination, the network card's forwarding module sends a data packet consisting of data and the target transmission context to the target destination. The queue resource management module is also used to unbind the target queue from the target transmission context when the target queue meets the unbinding conditions, thereby reclaiming resources. This allows the next data transmission to select a queue and transmission context binding based on the data transmission needs. This enables flexible and dynamic binding of queues and transmission contexts, effectively reducing the limit imposed by the queue's memory on the transmission context's memory.
[0076] Based on the above server architecture, the present application provides a resource management method. The resource management method provided by the embodiment of the present application is introduced below with reference to the accompanying drawings.
[0077] See also Figure 2 A flow chart of a resource management method is shown, the method comprising the following steps:
[0078] S201: Acquire a message indicating data transmission, where the message includes destination information and data information. The destination information is used to identify a target destination, and the data information is used to identify data to be transmitted to the target destination.
[0079] A message indicating data transmission can be triggered by a user of a service provided by a server. The message is used to instruct data transmission to a target destination. The message includes destination information and data information. The destination information identifies the target destination. Based on the destination information, the target destination for the data transmission can be determined. The destination information may include, for example, the network address of the target destination. The message also includes data information. The data information identifies the data to be transmitted. The data information may, for example, describe a buffer for storing the data to be transmitted.
[0080] In the scenario where the sending end supports RDMA, a received message needs to be written into a work queue as a WQE so that hardware, such as a network card, can obtain the WQE from the work queue and process it.
[0081] S202: Selecting a target queue for caching messages and a target transmission context for establishing a connection between a sending end and a target destination end from a resource pool.
[0082] A resource pool is a queue and transmission context resource pool built based on memory resources. As an example, a resource pool includes a queue resource pool and a transmission context resource pool. The queue resource pool is a queue resource pool built based on memory resources, used to provide the memory resources required by queues. The transmission context resource pool is a transmission context resource pool built based on memory resources, used to provide memory resources for caching transmission contexts. It should be noted that in scenarios where the sending end supports RDMA, the queue refers to the sending queue. Queues are used to cache messages that require hardware processing, namely WEQs.
[0083] The resource pool can be initialized during the management process. As an example, the total amount of resources in the resource pool, the maximum amount of resources for each resource, and resource status are set according to user needs and resource limitations. User needs can be determined based on the configuration instructions issued by the user. Resource limitations can be determined based on the resource conditions of the network device itself. Among them, the total amount of resources in the resource pool refers to the total amount of memory resources occupied by the resource pool. As an example, in the case where the resource pool includes a queue resource pool and a transmission context resource pool, the total amount of resources in the resource pool includes the sum of the memory amount of the memory resources occupied by the queue resource pool and the memory amount of the memory resources occupied by the transmission context resource pool. The maximum amount of resources for each resource refers to the maximum amount of memory that can be allocated to each resource. For example, the maximum amount of memory that can be allocated to each queue and the maximum amount of memory that can be allocated to each transmission context.
[0084] Resource status can be determined based on the resource type. For example, for a queue, resource status includes available, unavailable, bound, and unbound. Available means the queue can cache new messages. Unavailable means the queue cannot cache new messages. Bound means the queue is currently bound to a transport context. Unbound means the queue is not currently bound to a transport context. A queue's resource status is initialized to available and unbound. A queue's resource status is updated based on queue usage. Using a queue's resource status facilitates queue management and facilitates the timely release of queue memory resources.
[0085] For a transport context, resource states include bound, unbound, connected, and disconnected. The bound state indicates that the transport context is currently bound to a queue. The unbound state indicates that the transport context is not currently bound to a queue. The connected state indicates that a connection has been established with the destination using the transport context. The disconnected state indicates that a connection with the destination has not yet been established using the transport context. The transport context resource state is initialized to the unconnected and unbound states. The transport context resource state is updated as the transport context is used. The transport context resource state facilitates transport context management and helps to promptly release memory resources occupied by the transport context.
[0086] The target queue selected from the resource pool is used to buffer messages, allowing the hardware to retrieve messages from the target queue and execute the data transfer task indicated by the message. The selected target transmission context is used to bind the target queue during the current message processing. The selected target transmission context meets the requirements of this data transfer and is used to establish a connection between the sender and the target destination.
[0087] The embodiments of the present application do not limit possible implementation methods of selecting a target queue and a target transmission context from a resource pool.
[0088] In one possible implementation, a target queue and target transmission context are arbitrarily selected from a resource pool. For example, a queue capable of caching a message is selected from the resource pool and used as the target queue. The target queue is configured using the destination information included in the message so that it serves the target destination. The message is written to the target queue, caching the message in the target queue. A transmission context capable of establishing a connection between the sender and the target destination is selected from the resource pool as the target transmission context.
[0089] The selection method may include, for example, using a preset selection algorithm to select a target queue and target transmission context from the resource pool. The preset selection algorithm may be, for example, a Least Recently Used (LRU) algorithm. Another example is traversing queues in the resource pool and selecting a queue that can cache messages as the target queue. Traversing transmission contexts in the resource pool and selecting a transmission context that can be used to establish a connection between the sender and the target destination as the target transmission context.
[0090] In another possible implementation, a queue serves a specific destination. The queue can cache messages related to the served destination. For queues that are not configured with a served destination, the queue can be configured using the destination information. For queues that are configured with a served destination, the destination served by the queue can be determined by querying the queue's destination information.
[0091] If the resource pool includes a queue for a configured destination, use the destination information included in the message to query the resource pool for the queue that serves the target destination. If the queue that serves the target destination is found in the resource pool, select the target queue from the queues that serve the target destination. Write the message to the target queue, that is, cache it in the target queue. If the queue that serves the target destination is not found in the resource pool, select a queue in the resource pool that can be used to cache messages as the target queue. Configure the target queue using the destination information included in the message. Write the message to the target queue.
[0092] By selecting a target queue from the queues at the service target destination, the queue at the service target destination can be reused without having to create the queue again and configure the destination information of the queue, thereby reducing performance loss and saving resources.
[0093] As an example, see Figure 3 As shown, this figure is a flow chart of a method for selecting a target queue provided by an embodiment of the present application, including steps S301-S305:
[0094] S301: Searching for a queue serving a target destination in a queue resource pool.
[0095] Using the destination information included in the message, search the queue resource pool to see if there is a queue that serves the target destination.
[0096] S302: If the queue resource pool includes the queue of the service target destination, determine whether the queue of the service target destination meets the availability condition.
[0097] The availability condition is that the number of messages currently processed by the queue is less than the threshold. The number of messages processed by a queue is the number of messages retrieved by the sending hardware from that queue. Taking the WQE cached in a send queue as an example, the number of messages processed by a queue is the number of WQEs that the hardware has retrieved and processed from that send queue. The number of messages currently processed by a queue is the number of messages processed by the queue since its creation. The threshold, also known as the queue depth, refers to the number of messages in the queue. The queue depth is a pre-set parameter for the queue.
[0098] In one possible implementation, the resource status of the queue is updated based on the relationship between the number of messages that the queue has currently processed and the number threshold. When the number of messages that the queue has currently processed is less than the number threshold, the resource status of the queue is in an available state. When the number of messages that the queue has currently processed is equal to the number threshold, the resource status of the queue is in an unavailable state. Whether the queue meets the availability condition is determined by querying the resource status of the queue. If the resource status of the queue is in an available state, the queue meets the availability condition. If the resource status of the queue is in an unavailable state, the queue does not meet the availability condition.
[0099] Using available conditions can limit the maximum number of messages a queue can process during a single binding, which helps achieve queue load balancing.
[0100] S303: If there is a queue at the service target destination end that meets the availability condition, a target queue is selected from the queues at the service target destination end that meets the availability condition.
[0101] In this way, the queue that processes fewer messages can be selected as the target queue for this cached message, and the queue that processes more messages can be stopped, which facilitates the subsequent release of queue resources, improves the balance of queue use, and achieves queue load balancing.
[0102] S304: If none of the queues at the target destination satisfy the availability condition, or the queue resource pool does not include the queue at the target destination, a queue satisfying the availability condition is selected from the queue resource pool as the target queue.
[0103] As an example, queues in the queue resource pool, excluding the queue serving the target destination, are traversed to determine whether the queues meet availability criteria. Queues that meet the availability criteria are selected as target queues. As another example, queues that meet the availability criteria are first determined, and then a preset selection algorithm is used to select the target queue from the queues that meet the availability criteria. The preset selection algorithm is, for example, LRU.
[0104] S305: If the queue resource pool does not include a queue that meets the availability condition, the target queue selection fails.
[0105] If the queue resource pool does not include a queue that meets the availability criteria, it indicates that all queues included in the current queue resource pool are unavailable. In one possible implementation, a processing result indicating failed message processing is generated and feedback is provided to the user for subsequent processing. In another possible implementation, a queue is selected again while waiting for the conditions for reprocessing the message to be met. The conditions for reprocessing the message can be set based on the needs of message processing. For example, the condition for reprocessing the message can be a preset interval. In another example, the condition for reprocessing the message can be that the queue resource pool includes a queue that meets the availability criteria.
[0106] After selecting the target queue, it is necessary to further select a target transmission context. The embodiment of the present application does not limit the possible implementation methods of selecting the target transmission context from the resource pool.
[0107] See also Figure 4 As shown in FIG, this figure is a flow chart of a method for selecting a target transmission context from a resource pool provided by an embodiment of the present application. It includes steps S401-S405:
[0108] S401: Determine whether the selected target queue is currently bound to a transmission context.
[0109] The target queue selected from the queue resource pool may already have a transmission context bound to it. In one possible implementation, whether the target queue is bound to the transmission context is determined by querying the resource status of the target queue. If the resource status of the target queue is bound, it is determined that the target queue has already been bound to the transmission context.
[0110] S402: If the selected target queue is currently bound to a transmission context, the transmission context currently bound to the target queue is selected as the target transmission context.
[0111] The transmission context bound to the target queue is a transmission context that has established a binding relationship with the target queue.
[0112] By using the transmission context that is already bound to the target queue as the target transmission context, the binding relationship between the target queue and the already bound transmission context can be reused without re-establishing the binding relationship between the target queue and the transmission context, thus saving processing resources and reducing performance loss.
[0113] S403: If the selected target queue is not currently bound with a transmission context, a target transmission context is selected according to the binding priority of the transmission contexts included in the resource pool.
[0114] The binding priority of a transmission context is positively correlated with the resource reuse degree of the transmission context. Specifically, the higher the resource reuse degree of a transmission context, the higher the binding priority of the transmission context. The lower the resource reuse degree of a transmission context, the lower the binding priority of the transmission context. The resource reuse degree of a transmission context can be determined based on the resource status of the transmission context. As an example, the resource reuse degree of a transmission context that is connected to a target destination and is not bound is the highest. The resource reuse degree of a transmission context that is not connected is medium. The resource reuse degree of a transmission context that is connected to other destinations is the lowest.
[0115] Specifically, as an example, the binding priorities of a transmission context include a first priority, a second priority, and a third priority. A transmission context of the first priority is not bound to a queue and is connected to a target destination. A transmission context of the second priority is not connected. A transmission context of the third priority is connected to another destination. The first priority is higher than the second priority, and the second priority is higher than the third priority.
[0116] S403 includes the following steps, see Figure 4 The dotted box includes the following parts:
[0117] S4031: Determine whether the transmission context resource pool includes a transmission context of the first priority, where the transmission context of the first priority is an unbound transmission context that has established a connection with a target destination.
[0118] If the target queue has no transmission context bound to it, an appropriate transmission context must be selected from the transmission context resource pool and bound to the target queue. The transmission context resource pool may include transmission contexts with established connections. The transmission context resource pool searches for a transmission context that has established a connection with the target destination but is not bound to it. This transmission context that has established a connection with the target destination but is not bound to it is referred to as a first-priority transmission context. This first-priority transmission context is the highest-priority transmission context for establishing a binding relationship with the target queue.
[0119] As an example, the transmission context of the first priority can be determined by querying the resource status of the transmission context.
[0120] For a transmission context for establishing a connection, the destination end for establishing a connection using the transmission context can be determined by querying the destination end information included in the transmission context.
[0121] S4032: If the transmission context resource pool includes the transmission context of the first priority, select a target transmission context from the transmission context of the first priority.
[0122] It should be noted that there can be multiple first-priority transmission contexts. If multiple first-priority transmission contexts exist, any first-priority transmission context is selected as the target transmission context. Selecting the target transmission context from unbound transmission contexts that have established a connection with the target destination allows the reuse of the already established connection with the target destination, eliminating the need to re-establish a connection between the sender and the destination, saving the cost of establishing a connection and reducing performance loss on both the sender and the destination.
[0123] The target transmission context is selected from the transmission contexts of the first priority and is not bound to the target queue, that is, no binding relationship is established with the target queue. S404 is executed to establish a binding relationship between the target transmission context and the target queue, that is, to bind the target transmission context to the target queue.
[0124] S4033: If the transmission context resource pool does not include the transmission context of the first priority, determine whether the transmission context resource pool includes the transmission context of the second priority, where the transmission context of the second priority is a transmission context for which no connection is established.
[0125] In some cases, the transport context resource pool does not include a transport context capable of supporting a multiplexed connection. A target transport context is selected from the transport contexts for which a connection has not been established. The target transport context selected from the transport contexts for which a connection has not been established is a transport context with a second priority. The binding priority of the transport context with a second priority is lower than the binding priority of the transport context with a first priority.
[0126] S4034: If the transmission context resource pool includes the transmission context of the second priority, select a target transmission context from the transmission context of the second priority.
[0127] The embodiment of the present application does not limit the method of selecting the target transport context from the unconnected transport context. As an example, the transport contexts included in the transport context resource pool are traversed, and after finding the unconnected transport context, the found unconnected transport context is used as the target transport context.
[0128] For a target transmission context selected from the transmission contexts to which a connection has not been established, S404 is executed to establish a binding relationship between the target transmission context and the target queue, and S405 is executed to establish a connection with the target destination.
[0129] Selecting the target transmission context from the transmission context of unestablished connections can prioritize maintaining connections, minimize disconnecting established connections, reduce performance loss caused by frequent disconnections, reduce the delay caused by disconnecting existing connections, improve network bandwidth utilization, and fully utilize network resources.
[0130] S4035: If the transmission context resource pool does not include the transmission context of the second priority, determine whether the transmission context resource pool includes the transmission context of the third priority. The transmission context of the third priority is an unbound transmission context that has established a connection with another destination.
[0131] If the transport context resource pool does not include any transport contexts that can support multiplexing connections or any transport contexts for which no connection has been established, the target transport context is selected from transport contexts that are connected to other destinations but not bound. Other destinations are destinations other than the target destination. Transport contexts that are connected to other destinations and not bound are transport contexts of the third priority. The binding priority of a transport context of the third priority is lower than the binding priority of a transport context of the second priority.
[0132] S4036: If the transmission context resource pool includes the transmission context of the third priority, select a target transmission context from the transmission context of the third priority.
[0133] By using the transport context that has already established a connection with another destination as the transport context with the lowest binding priority, the existing connection can be maintained first when there are sufficient transport context resources, thus reducing the frequency of disconnection.
[0134] The embodiments of the present application do not limit the possible implementation methods of selecting the target transmission context from the third priority transmission context. As an example, a preset selection algorithm is used to select the target transmission context from the third priority transmission context. The preset selection algorithm is, for example, an LRU algorithm. The LRU algorithm can be used to select a transmission context that has not been used for a long time as the target transmission context from the transmission context that has established a connection with other destination ends but has not established a binding relationship, thereby reducing the impact on the frequently used transmission context. As another example, the transmission context resources are traversed, and the first third priority transmission context found is used as the target transmission context.
[0135] For a transmission context that has not been bound and has established a connection with another destination, the target transmission context is selected and S404 is executed to establish a binding relationship between the target transmission context and the target queue. A disconnect operation is then performed on the target transmission context. For example, disconnection is achieved by sending a disconnect request to the destination. After disconnection, S405 is executed to establish a connection with the target destination.
[0136] The method of selecting the target transport context is determined in descending order of binding priority, so that the already created transport context can be maintained first, the already established connections can be reused as much as possible, and the frequency of disconnection can be reduced, thereby reducing the performance loss of the device caused by frequent disconnection and establishment of connections.
[0137] S4037: If the transmission context resource pool does not include the third priority transmission context, selection of the target transmission context fails.
[0138] In a possible implementation, a processing result of message processing failure is generated and fed back to the user so that the user can perform subsequent processing.
[0139] In another possible implementation, the target transmission context is reselected while waiting for the conditions for reprocessing the message to be met. The conditions for reprocessing the message can be set based on the needs of message processing. For example, the conditions for reprocessing the message can be a preset interval. For another example, the conditions for reprocessing the message can be met when the transmission context resource pool includes a transmission context that can be selected. S404: Bind the target transmission context to the target queue.
[0140] In one possible implementation, a queue identifier of the target queue, such as a queue number, is configured in the target transmission context to bind the target transmission context to the target queue. Furthermore, in some possible implementations, if the target queue and the target transmission context each have resource status parameters, the resource status of the target queue and the target transmission context is updated to a bound state.
[0141] Before the data transmission task indicated by the completion message is executed, the target transmission context remains bound to the target queue, so that the data transmission task indicated by the completion message can be completed by using the target transmission context and the target queue.
[0142] S405: Establish a connection with the target destination using the target transmission context.
[0143] The destination information included in the data transmission request is used to update the destination information included in the target transmission context. A connection establishment message carrying the destination information and the sending end information, ie, the local end information, is sent to the destination end.
[0144] After receiving the connection establishment message, the destination can use the sender information included in the connection establishment message to update the destination's local transmission context, thereby establishing a connection between the sender and the destination. The established connection is, for example, a reliable connection. The sender information includes the sender information required to establish the connection. As an example, the sender information includes the sender's network address and a buffer index. The specific format of the connection establishment message can be determined based on the network transmission protocol.
[0145] After successfully selecting the target queue and target transmission context, the data transmission task is executed using the target queue and target transmission context. After the data transmission task message is completed, the target queue and target transmission context for this binding are selected from the queue resource pool and transmission context resource pool. This allows for dynamic binding of the target queue and target transmission context based on the communication requirements of the data being transmitted. This can, to a certain extent, avoid the problem of persistent memory usage caused by static resource configuration, thereby supporting the interconnection of larger network devices.
[0146] S203: Obtain a message from the target queue, and send a data packet consisting of data and target transmission context to the destination end according to the message.
[0147] After successfully selecting the target queue and target transmission context, establishing a binding relationship between the target queue and the target transmission context, and establishing a connection with the destination, the cached message is obtained from the target queue and the data transmission task indicated by the message is executed.
[0148] Obtain the data and target transmission context identified by the data information of the message. Packetize the data and the target transmission context to generate a data packet. Send the data packet to the destination end so that the destination end can obtain the data and process the data using the target transmission context. For example, reliable communication can be used to implement the data packet transmission.
[0149] In some possible implementations, after the data transmission task indicated by the execution message is completed, it is determined whether the binding relationship between the target queue and the target transmission context can be released.
[0150] See also Figure 5 As shown in the figure, this figure is a flow chart of another resource management method provided in an embodiment of the present application.
[0151] In addition to the above S201-S203, Figure 5 Also includes S204.
[0152] S204: If the target queue meets the unbinding condition, unbind the target queue from the target transmission context.
[0153] After message processing is complete, the target queue is determined to have met the unbinding conditions. Unbinding conditions are pre-set conditions that trigger the unbinding of the target queue from the target transport context. Unbinding conditions can be set based on the need to free up resources associated with the target queue and the target transport context. For example, the unbinding conditions are that message processing is complete and the target queue contains no cached messages awaiting processing.
[0154] See also Figure 6 As shown, this figure is a schematic diagram of a resource management process provided by an embodiment of the present application. For an acquired WQE, a target queue is first selected from the queue resource pool, and then a target transmission context is selected from the transmission context resource pool. The WQE is cached in the target queue. The target queue and the target transmission context are bound. The WQE is processed using the target queue and the target transmission context. If the unbinding conditions are met, the target queue and the target transmission context are unbound, thereby releasing resources.
[0155] This allows the target queue and target transport context to be unbound when the unbinding conditions are met, enabling dynamic binding between the transport context and the queue. This not only allows for the timely release of memory resources occupied by the transport context and queue, but also allows for the unbinding of the fixed transport context and queue. This allows for flexible binding between the transport context and queue, eliminating the need for a fixed binding. This reduces the number of queues and the memory restrictions imposed on the transport context cache by fixed bindings.
[0156] The present application also provides a resource management device, which is applied to the sending end, such as Figure 7 Shown, including:
[0157] A message processing module 701 is configured to obtain a message indicating a data transmission task, wherein the message includes destination information and data information, wherein the destination information is used to identify a target destination, and the data information is used to identify data to be transmitted to the target destination;
[0158] A resource management module 702 is configured to select a target queue and a target transmission context from a resource pool according to the destination information, wherein the target queue is used to cache the message and the target transmission context is used to establish a connection between the sender and the target destination;
[0159] The message processing module 701 is further configured to obtain the message from the target queue, and send a data packet consisting of the data and the target transmission context to the target destination according to the message.
[0160] In a possible implementation, the resource management module 702 is specifically configured to:
[0161] Selecting a target queue from the queues in the resource pool that serve the target destination;
[0162] If the target queue is currently bound to a transmission context, the transmission context bound to the target queue is selected as the target transmission context;
[0163] If the target queue is not currently bound to a transmission context, a target transmission context is selected from the resource pool.
[0164] In a possible implementation, the resource management module 702 is configured to select a target queue from queues in the resource pool that serve the target destination, including:
[0165] The resource management module 702 is configured to select a queue that meets an availability condition from the queues serving the target destination to obtain a target queue. The availability condition includes that the number of messages currently processed by the queue is less than a quantity threshold.
[0166] In a possible implementation, the resource management module 702 is further configured to:
[0167] If none of the queues serving the target destination satisfy the availability condition, a queue satisfying the availability condition is selected from the resource pool to obtain the target queue.
[0168] In a possible implementation, the resource management module 702 is configured to select a target transmission context from the resource pool if the target queue is not currently bound to a transmission context, including:
[0169] The resource management module 702 is used to select a target transmission context according to the binding priority of the transmission context included in the resource pool if the target queue is not currently bound to the transmission context. The binding priority of the transmission context is positively correlated with the resource reuse degree of the transmission context.
[0170] In a possible implementation, the resource management module 702 is configured to select a target transmission context according to the binding priority of the transmission contexts included in the resource pool, including:
[0171] The resource management module 702 is used to select a target transmission context from the transmission context of the first priority if the transmission context resource pool includes a transmission context of the first priority, the transmission context of the first priority is not bound to a queue and is connected to the target destination; if the transmission context resource pool does not include the transmission context of the first priority, select a target transmission context from the transmission context of the second priority, the transmission context of the second priority is not connected; if the transmission context resource pool does not include the transmission context of the first priority and the transmission context of the second priority, select a target transmission context from the transmission context of the third priority, the transmission context of the third priority is connected to other destinations, and the other destinations are destinations other than the target destination.
[0172] In a possible implementation, the target transmission context is the transmission context of the first priority, the transmission context of the second priority, or the transmission context of the third priority, and the resource management module 702 is further configured to:
[0173] Bind the target transmission context to the target queue.
[0174] In a possible implementation, the target transmission context is the transmission context of the second priority or the transmission context of the third priority, and the resource management module 702 is further configured to:
[0175] The target transmission context is used to establish a connection between the sending end and the target destination end.
[0176] In a possible implementation, the target transmission context is a transmission context of the third priority, and the resource management module 702 is further configured to:
[0177] Before establishing a connection between the sending end and the target destination end by using the target transmission context, disconnecting the sending end from the other destination end.
[0178] In a possible implementation, before the data transmission task indicated by the message is completed, the target transmission context remains bound to the target queue.
[0179] In a possible implementation, the resource management module 702 is further configured to:
[0180] If the target queue meets the unbinding condition, the target queue is unbound from the target transmission context.
[0181] In a possible implementation, the unbinding condition is that the data transmission task indicated by the message is completed, and the target queue does not include any cached messages.
[0182] In a possible implementation, the resource pool includes a queue resource pool and a transmission context resource pool.
[0183] The message processing module 701 and the resource management module 702 can be implemented in software or hardware. For example, the implementation of the message processing module 701 will be described below using the message processing module 701 as an example. Similarly, the implementation of the resource management module 702 can refer to the implementation of the message processing module 701.
[0184] As an example of a software functional unit, the message processing module 701 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the message processing module 701 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.
[0185] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0186] As an example of a hardware functional unit, the message processing module 701 may include at least one computing device, such as a server. Alternatively, the message processing module 701 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0187] The multiple computing devices included in message processing module 701 can be distributed in the same region or in different regions. The multiple computing devices included in message processing module 701 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in message processing module 701 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.
[0188] It should be noted that, in other embodiments, the message processing module 701 can be used to execute any step in the resource management method, and the resource management module 702 can be used to execute any step in the resource management method. The steps that the message processing module 701 and the resource management module 702 are responsible for implementing can be specified as needed. The full functions of the resource management device are realized by respectively implementing different steps in the resource management method through the message processing module 701 and the resource management module 702.
[0189] The present application also provides a computing device 800. Figure 8 As shown, computing device 800 includes a bus 802, a processor 804, a memory 806, and a communication interface 808. Processor 804, memory 806, and communication interface 808 communicate with each other via bus 802. Computing device 800 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 800.
[0190] The bus 802 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 802 may include a path for transmitting information between various components of the computing device 800 (eg, memory 806, processor 804, communication interface 808).
[0191] The processor 804 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0192] The memory 806 may include volatile memory, such as random access memory (RAM). The processor 804 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0193] The memory 806 stores executable program codes, and the processor 804 executes the executable program codes to respectively implement the functions of the message processing module 701 and the resource management module 702, thereby implementing the resource management method. That is, the memory 806 stores instructions for executing the resource management method.
[0194] Alternatively, the memory 806 stores executable codes, and the processor 804 executes the executable codes to respectively implement the functions of the aforementioned resource management device, thereby implementing the resource management method. That is, the memory 806 stores instructions for executing the resource management method.
[0195] The communication interface 808 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or a communication network.
[0196] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0197] like Figure 9 As shown, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the resource management method.
[0198] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store some instructions for executing the resource management method. In other words, the combination of one or more computing devices 800 can jointly execute the instructions for executing the resource management method.
[0199] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster can store different instructions, each for executing a portion of the functions of the resource management apparatus. In other words, the instructions stored in the memory 806 in different computing devices 800 can implement the functions of one or more modules in the message processing module 701 and the resource management module 702.
[0200] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network, which may be a wide area network or a local area network. Figure 10 A possible implementation is shown. Figure 10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, the connection to the network is achieved through a communication interface in each computing device. In this possible implementation, the memory 806 in computing device 800A stores instructions for executing the functions of message processing module 701. Simultaneously, the memory 806 in computing device 800B stores instructions for executing the functions of resource management module 702.
[0201] Figure 10 The connection method between the computing device clusters shown may be based on the resource management method provided in this application, so it is considered that the functions implemented by the resource management module 702 are handed over to the computing device 800B for execution.
[0202] It should be understood that Figure 10The functionality of the computing device 800A shown in FIG. 8 may also be implemented by multiple computing devices 800. Similarly, the functionality of the computing device 800B may also be implemented by multiple computing devices 800.
[0203] Embodiments of the present application also provide a computer program product comprising instructions. The computer program product may be software or a program product comprising instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the resource management method.
[0204] The present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device, or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the resource management method.
[0205] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A resource management method, characterized in that: The method is applied to a transmitting end, and the method includes: Acquire a message indicating a data transmission task, the message including destination information and data information, the destination information being used to identify a target destination, and the data information being used to identify data to be transmitted to the target destination; Selecting a target queue and a target transmission context from a resource pool according to the destination information, wherein the target queue is used to cache the message, and the target transmission context is used to establish a connection between the sending end and the target destination; The message is obtained from the target queue, and a data packet consisting of the data and the target transmission context is sent to the target destination according to the message.
2. The method according to claim 1, characterized in that The selecting a target queue and a target transmission context from a resource pool according to the destination information includes: Selecting a target queue from the queues in the resource pool that serve the target destination; If the target queue is currently bound to a transmission context, the transmission context bound to the target queue is selected as the target transmission context; If the target queue is not currently bound to a transmission context, a target transmission context is selected from the resource pool.
3. The method according to claim 2, characterized in that The selecting a target queue from the queues serving the target destination included in the resource pool includes: A queue that meets an availability condition is selected from the queues serving the target destination to obtain a target queue, wherein the availability condition includes that the number of messages currently processed cumulatively by the queue is less than a quantity threshold.
4. The method according to claim 3, characterized in that The method further comprises: If none of the queues serving the target destination satisfy the availability condition, a queue satisfying the availability condition is selected from the resource pool to obtain the target queue.
5. The method according to claim 2, characterized in that If the target queue is not currently bound to a transmission context, selecting a target transmission context from the resource pool includes: If the target queue is not currently bound to a transmission context, a target transmission context is selected according to the binding priority of the transmission context included in the resource pool. The binding priority of the transmission context is positively correlated with the resource reuse degree of the transmission context.
6. The method according to claim 5, characterized in that The selecting the target transmission context according to the binding priority of the transmission context included in the resource pool includes: If the transmission context resource pool includes a transmission context of a first priority, selecting a target transmission context from the transmission context of the first priority, the transmission context of the first priority is not bound to a queue and is connected to the target destination; If the transmission context resource pool does not include the transmission context of the first priority, selecting a target transmission context from the transmission context of the second priority, and the transmission context of the second priority has no connection established; If the transmission context resource pool does not include the transmission context of the first priority and the transmission context of the second priority, the target transmission context is selected from the transmission context of the third priority, and the transmission context of the third priority establishes a connection with other destination ends, and the other destination ends are destination ends that are not the target destination ends.
7. The method according to claim 6, characterized in that The target transmission context is the transmission context of the first priority, the transmission context of the second priority, or the transmission context of the third priority, and the method further includes: Bind the target transmission context to the target queue.
8. The method according to claim 6 or 7, characterized in that The target transmission context is the transmission context of the second priority, or the transmission context of the third priority, and the method further includes: The target transmission context is used to establish a connection between the sending end and the target destination end.
9. The method according to claim 8, characterized in that The target transmission context is a transmission context of a third priority. Before establishing a connection between the transmitting end and the target destination end by using the target transmission context, the method further includes: Disconnect the sending end from the other destination end.
10. The method according to any one of claims 1 to 9, characterized in that Before the data transmission task indicated by the message is completed, the target transmission context remains bound to the target queue.
11. The method according to any one of claims 1 to 10, characterized in that The method further comprises: If the target queue meets the unbinding condition, the target queue is unbound from the target transmission context.
12. The method according to claim 11, characterized in that The unbinding condition is that the data transmission task indicated by the message is completed and the target queue does not include any cached messages.
13. The method according to any one of claims 1 to 12, characterized in that The resource pool includes a queue resource pool and a transmission context resource pool.
14. A resource management device, characterized in that: The device is applied to a transmitting end, and includes: A message processing module, configured to obtain a message indicating a data transmission task, wherein the message includes destination information and data information, wherein the destination information is used to identify a target destination, and the data information is used to identify data to be transmitted to the target destination; A resource management module, configured to select a target queue and a target transmission context from a resource pool according to the destination information, wherein the target queue is used to cache the message, and the target transmission context is used to establish a connection between the sending end and the target destination; The message processing module is further configured to obtain the message from the target queue, and send a data packet consisting of the data and the target transmission context to the target destination according to the message.
15. The device according to claim 14, characterized in that The resource management module is specifically used to: Selecting a target queue from the queues in the resource pool that serve the target destination; If the target queue is currently bound to a transmission context, the transmission context bound to the target queue is selected as the target transmission context; If the target queue is not currently bound to a transmission context, a target transmission context is selected from the resource pool.
16. The device according to claim 15, characterized in that The resource management module is configured to select a target queue from the queues serving the target destination included in the resource pool, including: The resource management module is used to select a queue that meets the availability condition from the queues serving the target destination to obtain the target queue, where the availability condition includes that the number of messages currently processed cumulatively by the queue is less than a quantity threshold.
17. The device according to claim 16, characterized in that The resource management module is further configured to: If none of the queues serving the target destination satisfy the availability condition, a queue satisfying the availability condition is selected from the resource pool to obtain the target queue.
18. The device according to claim 15, characterized in that The resource management module is configured to select a target transmission context from the resource pool if the target queue is not currently bound to a transmission context, including: The resource management module is used to select a target transmission context according to the binding priority of the transmission context included in the resource pool if the target queue is not currently bound to the transmission context, and the binding priority of the transmission context is positively correlated with the resource reuse degree of the transmission context.
19. The device according to claim 18, characterized in that The resource management module is configured to select a target transmission context according to the binding priority of the transmission contexts included in the resource pool, including: The resource management module is used to select a target transmission context from the transmission context of the first priority if the transmission context resource pool includes a transmission context of the first priority, the transmission context of the first priority is not bound to a queue and is connected to the target destination; if the transmission context resource pool does not include the transmission context of the first priority, select a target transmission context from the transmission context of the second priority, the transmission context of the second priority is not connected; if the transmission context resource pool does not include the transmission context of the first priority and the transmission context of the second priority, select a target transmission context from the transmission context of the third priority, the transmission context of the third priority is connected to other destinations, and the other destinations are destinations other than the target destination.
20. The device according to claim 19, characterized in that The target transmission context is the transmission context of the first priority, the transmission context of the second priority, or the transmission context of the third priority, and the resource management module is further configured to: Bind the target transmission context to the target queue.
21. The device according to claim 19 or 20, characterized in that The target transmission context is the transmission context of the second priority, or the transmission context of the third priority, and the resource management module is further configured to: The target transmission context is used to establish a connection between the sending end and the target destination end.
22. The device according to claim 21, characterized in that The target transmission context is a transmission context of the third priority, and the resource management module is further configured to: Before establishing a connection between the sending end and the target destination end by using the target transmission context, disconnecting the sending end from the other destination end.
23. The device according to any one of claims 14 to 22, characterized in that Before the data transmission task indicated by the message is completed, the target transmission context remains bound to the target queue.
24. The device according to any one of claims 14 to 23, characterized in that The resource management module is further configured to: If the target queue meets the unbinding condition, the target queue is unbound from the target transmission context.
25. The device according to claim 24, characterized in that The unbinding condition is that the data transmission task indicated by the message is completed and the target queue does not include any cached messages.
26. The device according to any one of claims 14 to 25, characterized in that The resource pool includes a queue resource pool and a transmission context resource pool.
27. A computing device, characterized in that The computing device includes a processor and a memory: The memory is used to store instructions; The processor is configured to cause the computing device cluster to execute the method according to any one of claims 1 to 13 according to the instructions.
28. A computing device cluster, characterized in that: The computing device cluster includes at least one computing device, each computing device including a processor and a memory: The memory is used to store instructions; The processor is configured to cause the computing device cluster to execute the method according to any one of claims 1 to 13 according to the instructions.
29. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, which, when executed on a computing device, enable the computing device to perform the method according to any one of claims 1 to 13.
30. A computer code product comprising instructions which, when executed on a computing device, cause the computing device to perform the method according to any one of claims 1 to 13.