Movatterモバイル変換


[0]ホーム

URL:


CN114268654A - Network communication method, device, equipment, storage medium and program product - Google Patents

Network communication method, device, equipment, storage medium and program product
Download PDF

Info

Publication number
CN114268654A
CN114268654ACN202111421323.4ACN202111421323ACN114268654ACN 114268654 ACN114268654 ACN 114268654ACN 202111421323 ACN202111421323 ACN 202111421323ACN 114268654 ACN114268654 ACN 114268654A
Authority
CN
China
Prior art keywords
rdma
rpc
client
work queue
communication
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111421323.4A
Other languages
Chinese (zh)
Other versions
CN114268654B (en
Inventor
李毅伦
张培承
周祥为
秦文劭
万化
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Pudong Development Bank Co Ltd
Original Assignee
Shanghai Pudong Development Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Pudong Development Bank Co LtdfiledCriticalShanghai Pudong Development Bank Co Ltd
Priority to CN202111421323.4ApriorityCriticalpatent/CN114268654B/en
Publication of CN114268654ApublicationCriticalpatent/CN114268654A/en
Application grantedgrantedCritical
Publication of CN114268654BpublicationCriticalpatent/CN114268654B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Landscapes

Abstract

The present application relates to a network communication method, apparatus, device, storage medium and program product. The method comprises the steps of responding to a Remote Procedure Call (RPC) connection request sent by a client, and allocating remote direct data access (RDMA) network communication file descriptors; adding the RDMA network communication file descriptor into an RDMA completion queue corresponding to the RPC connection request, and establishing an RPC communication channel with the client; and performing RDMA communication with the client according to the RPC communication channel. The method can improve the network communication performance when the network transmission quantity is large and the throughput is high.

Description

Network communication method, device, equipment, storage medium and program product
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a network communication method, apparatus, device, storage medium, and program product.
Background
Remote Procedure Call (RPC) is a common communication method for distributed systems, and belongs to a main mode for accessing Remote distributed databases. The RPC mechanism and the RPC tool also provide means and convenience for the design of the distributed application program, and a user can directly use the RPC tool to design the distributed application program without knowing the details of the network structure and the protocol.
In the related art, most of RPC frames are network transmission modes oriented to TCP/IP, and the communication mode of TCP/IP is that a data sender is required to package data and perform data packet processing work of a plurality of series of multilayer network protocols, and then the data packet can be transmitted from a buffer area. After the data packet is transmitted to the data receiver, the data receiver needs to analyze a series of multi-layer protocols on the data packet and copy the analyzed data to the user mode buffer at the corresponding position, and the user application program can be called.
However, in a large-scale cluster with large network transmission amount, high throughput and low delay and a distributed cluster deployment area, the RPC communication mode using TCP/IP cannot meet the performance requirement of the system on communication.
Disclosure of Invention
In view of the above, it is necessary to provide a network communication method, apparatus, device, storage medium, and program product capable of improving the performance of communication in a high throughput situation with a large amount of network transmission.
In a first aspect, the present application provides a network communication method, including:
responding to a Remote Procedure Call (RPC) connection request sent by a client, and allocating remote direct data access (RDMA) network communication file descriptors;
adding the RDMA network communication file descriptor into an RDMA completion queue corresponding to the RPC connection request, and establishing an RPC communication channel with the client;
and performing RDMA communication with the client according to the RPC communication channel.
In one embodiment, prior to the allocating the remote direct data access RDMA network communication file descriptor, the method includes:
acquiring the state of the RDMA interception file descriptor in the completed RDMA work queue;
and if the state of the RDMA interception file descriptor is a readable state, determining that the client sends the RPC connection request.
In one embodiment, the method comprises:
after an RPC communication channel between the RDMA monitoring file and a client is established, setting the state of an RDMA monitoring file descriptor to be a writable state; the writable state represents a state in which the receiving client sends an RPC connection request.
In one embodiment, the method comprises: the adding the RDMA communication file descriptor to the corresponding RDMA completion work queue includes:
and adding the RDMA communication file descriptor into a socket set of the RDMA completion work queue corresponding to the RPC connection request.
In one embodiment, the method comprises:
calling a preset queue creating component to create at least one RDMA work queue; the RDMA work queue is used for the client to communicate with the server.
In one embodiment, the invoking a preset queue creating component to create at least one RDMA work queue includes:
checking and correcting the work queue parameters input by the user;
and if the work queue parameters are legal, creating resource information of the RDMA work queue, and applying for a cache space of the RDMA work queue to obtain the RDMA work queue.
In one embodiment, the method comprises:
after each sending and receiving event of the RDMA work queue is processed, the buffer space of the RDMA work queue is updated by calling an updating component.
In one embodiment, the RDMA communication with the client according to the RPC communication channel includes:
receiving a data reading request and/or a data writing request sent by a client through an RPC communication channel;
reading and fragmenting a data packet to be read in an RDMA work queue by calling a reading component; and/or writing and fragmenting the data packet to be written in the RDMA work queue by calling the writing component.
In one embodiment, the method comprises:
adding, by the polling component, the created RDMA event channel file descriptor to a polling set;
monitoring, by a network polling engine, polling RDMA event channel file descriptors in a polling set;
and if the RDMA event channel file descriptor has the event to be processed, processing the event to be processed according to the corresponding processing component.
In one embodiment, the method comprises: the events to be processed at least comprise read events, write events and error events.
In a second aspect, the present application further provides a network communication device, including:
a receive module to allocate remote direct data access (RDMA) communication file descriptors in response to a Remote Procedure Call (RPC) connection request sent by a client
The connection module is used for adding the RDMA communication file descriptor into an RDMA work queue corresponding to the RPC connection request and establishing an RPC communication channel with the client;
and the communication module is used for carrying out RDMA communication with the client according to the RPC communication channel.
In a third aspect, the present application further provides a computer device, where the computer device includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the anti-debugging method provided in the foregoing first aspect embodiment when executing the computer program.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the anti-debugging method provided in the above first aspect embodiment.
In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the anti-debugging method provided in the above first aspect embodiment.
According to the network communication method, the device, the equipment, the storage medium and the program product, after the RPC connection request sent by the corresponding client is passed, the RDMA network communication descriptor is allocated to establish the PRC channel between the server and the client, and the RDMA data transmission is carried out between the server and the client through the PRC channel. Due to the fact that RDMA is directly accessed, delay of server-side data processing in network transmission can be reduced, and therefore in a large-scale network transmission scene, the network throughput is improved, the network delay is reduced, and the network communication performance under the condition that the network transmission amount is large and the throughput is high is guaranteed according to the network requirements of high throughput and low delay of a system.
Drawings
FIG. 1 is a diagram of an exemplary network communication method;
FIG. 2 is a flow diagram of a network communication method in one embodiment;
FIG. 3 is a block diagram of a network communication device in one embodiment;
FIG. 4 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The network communication method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein theclient 102 communicates with theserver 104 via a network. The data storage system may store data that theserver 104 needs to process. The data storage system may be integrated on theserver 104, or may be placed on the cloud or other network server. Theserver 104 responds to a Remote Procedure Call (RPC) request sent by theclient 102, allocates a remote direct data access (RDMA) communication file descriptor, adds the RDMA communication file descriptor to an RDMA work queue corresponding to the RPC request, establishes an RPC communication channel between the server and the client through the RDMA communication file descriptor, and theserver 104 performs RDMA communication with theclient 102 according to the RPC communication channel. Theterminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices and portable wearable devices, and the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart car-mounted devices, and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. Theserver 104 may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
In one embodiment, as shown in fig. 2, a network communication method is provided, which is described by taking the method as an example applied to theserver 104 in fig. 1, and includes the following steps:
step 202, in response to a Remote Procedure Call (RPC) connection request sent by a client, allocating a remote direct data access (RDMA) network communication file descriptor.
Specifically, the Remote Procedure Call (RPC) request refers to a request sent by a client for establishing an RPC communication channel, the RPC communication channel is used for establishing connection between the client and a server, and the client can remotely call computing resources deployed in the server through the RPC communication channel; the RDMA network communication file descriptor refers to a file descriptor which can monitor operations such as read \ write \ error and the like of the communication descriptor.
Specifically, after receiving the RPC connection request sent by the client, the server allocates an RDMA network communication descriptor to the server responding to the RPC connection request sent by the client, because the server is a computer cluster consisting of a plurality of server servers, in one embodiment, the client can request to establish an RPC channel with the server by calling a connect () method, and when the server listens for the RPC connection request, allocate the RDMA network communication descriptor to the server specifically responding to the RPC connection request sent by the client, wherein optionally, the server has a corresponding snoop file descriptor to listen to the RPC connection request, and when the snoop file descriptor indicates that the client requests to establish the RPC channel with the server by the connect () method, allocate the RDMA network communication descriptor to the server specifically responding to the RPC connection request sent by the client, the descriptor is used to establish a true network connection.
Optionally, the remote procedure call RPC connection request sent by the client may be a GRPC connection request, where the GRPC is an RPC framework of google open source, supports cross-language and cross-platform, and meets end-to-end communication of various different platform architectures in a distributed scenario.
Step 204, adding the RDMA communication file descriptor into the RDMA completion queue corresponding to the RPC connection request, and establishing an RPC communication channel with the client.
Before the server communicates with the client, corresponding RDMA work queues and RDMA completion queues are respectively established, corresponding memory areas are registered for upcoming RDMA transmission, the work queues of the server are used for storing received queue elements, and after the work queue elements are processed, completion queue elements are generated and placed in the corresponding completion queues to indicate that data transmission is completed.
Specifically, the server will add the generated RDMA network communication file descriptor to a corresponding completion queue, that is, a completion queue of a single server specifically, and establish a network communication between the real server and the client, that is, a specific location-to-point network communication, that is, a network connection between the server and the client server specifically, by using the RDMA communication file descriptor.
And step 206, performing RDMA communication with the client according to the RPC communication channel.
Specifically, a server and a client perform RDMA communication through an established RPC communication channel, in one embodiment, when the server is started, the server adds an RDMA listening file descriptor to a completion queue of a corresponding server, and when the client initiates a connect () method request to establish a link, the RDMA listening file descriptor has a corresponding readable event, that is, when the RDMA listening file descriptor listens to a connect method sent by the client, the state of the RDMA listening file descriptor is changed to a readable state, and a new RDMA network communication file descriptor is generated to establish a real network connection and added to a corresponding completion queue, and a read \ write \ error operation of the communication descriptor is monitored and a corresponding component is called to perform processing.
In the network communication method, after the RPC connection request sent by the corresponding client is passed, RDMA network communication descriptors are allocated to establish a PRC channel between the server and the client, and the server and the client perform RDMA data transmission through the PRC channel. Due to the fact that RDMA is directly accessed, delay of server-side data processing in network transmission can be reduced, and therefore in a large-scale network transmission scene, the network throughput is improved, the network delay is reduced, and the network communication performance under the condition that the network transmission amount is large and the throughput is high is guaranteed according to the network requirements of high throughput and low delay of a system.
In one embodiment, prior to assigning the remote direct data access RDMA network communication file descriptor, the method includes: acquiring the state of the RDMA interception file descriptor in the completed RDMA work queue; and if the state of the RDMA interception file descriptor is a readable state, determining that the client sends the RPC connection request.
The RDMA listening file descriptor refers to a file descriptor for listening a link establishment request of a client, namely an RPC connection request sent by the client, and has a readable state and a writable state.
Specifically, when the server is started, the RDMA snoop file descriptor is placed in a completion queue of the server, that is, each completion queue of the server has an RDMA snoop file descriptor for listening to a link establishment request initiated by the client, when the server is started, the state of the RDMA snoop file descriptor is in a writable state, and when any server in the server monitors that the client sends an RPC connection request, optionally, the client may request link establishment through connect (), and the state of the RDMA snoop file descriptor of the server becomes a readable state.
In the embodiment, whether a client sends a link establishment request can be monitored through the RDMA monitoring file descriptor, so that the corresponding RPC channel can be established in time when the client sends the establishment request.
In one embodiment, a network communication method includes: after an RPC communication channel between the RDMA monitoring file and a client is established, setting the state of an RDMA monitoring file descriptor to be a writable state; the writable state represents a state in which the receiving client sends an RPC connection request.
Specifically, after the client and the server establish the RPC communication channel, it means that the server receives RDMA data sent by the client, and then sets the RDMA listening file descriptor to a writable state again, where the writable state of the RDMA listening file descriptor indicates that the client is in a state of receiving an RPC connection request sent by the client, and can receive the RPC connection request sent by the client again. If the client side is monitored to send the RPC connection request, the state of the RDMA monitoring file descriptor is set to be a readable state; and if the client side is not monitored to send the RPC connection request, continuously monitoring whether the client side sends the RPC connection request.
In the above embodiment, it is possible to quickly know whether the client has a link establishment request by changing the state of the RDMA snoop file descriptor.
In one embodiment, adding an RDMA communication file descriptor to a corresponding RDMA completion work queue includes: and adding the RDMA communication file descriptor into a socket set of the RDMA completion work queue corresponding to the RPC connection request.
The socket set is a set for storing event channel file descriptors, and the event channel file descriptors include RDMA communication file descriptors.
Specifically, because the server is a computer cluster composed of a plurality of server servers, the generated RDMA communication file descriptor is added to the server which specifically responds to the RPC request of the client, that is, the RDMA communication file descriptor is added to the socket combination of the RDMA completion queue corresponding to the RPC connection request, wherein optionally, the server may have a polling engine to monitor the RDMA event channel file descriptor in the socket set, so as to ensure that the corresponding processing flow can be entered in time when an IO event is generated.
In the above embodiment, by adding the RDMA communication file descriptor to the socket combination correspondingly placed in the RDMA completion work queue, the RDMA communication file descriptor can be monitored more conveniently.
In one embodiment, the network communication method further comprises: calling a preset queue creating component to create at least one RDMA work queue; the RDMA work queue is used for the client to communicate with the server.
Wherein, the queue creating component is used for creating RDMA work queue component for two-end communication, and the RDMA work queue is used for storing the queue of work queue element
Specifically, the server side server calls a preset queue creation component when starting, and creates an RDMA work queue for each server side server through the queue creation component, where the RDMA work queue is used to store a work queue element sent by the client side, where the work queue element refers to a task for specifying the hardware that the software desires to do and detailed information about the task, and optionally, the work queue element in the server side server completion queue indicates a buffer for storing data. In other embodiments, the server and client create a pair of RDMA work queues for the server and client to communicate by calling ibv _ create _ qp () in the grpc _ RDMA _ create () function.
In the above embodiment, by calling the preset queue creating component, the corresponding work queue can be established for the server and the client, so that the server and the client perform RDMA data transmission through their respective work queues.
In one embodiment, invoking a pre-defined queue creation component to create at least one RDMA work queue comprises: checking and correcting the work queue parameters input by the user; and if the work queue parameters are legal, creating resource information of the RDMA work queue, and applying for a cache space of the RDMA work queue to obtain the RDMA work queue.
In particular, the server checks the work queue parameters entered by the user before creating the RDMA work queue, because of hardware limitations, the specification to be applied may be larger than the user needs, so that when the parameters are not reasonable, the parameters actually used are returned to the user, and in the case that the work queue parameters are legal, the resource information and buffer space of the RDMA work queue are created for storing work queues and work queue elements, in one embodiment, the relevant resources of QueuePair can be created by the grpc _ rdma _ create () function, wherein optionally, the related resources of QueuePair include QPC, QPN and other resources, and then apply for QueuePair buffer, the buffer refers to an area for storing a work queue of a server and queue elements in the work queue, a client work queue, queue elements in the work queue, and the like, that is, the memory space of the work queue itself. After creation, the driver tells the hardware the base address of the work queue, i.e., lets the hardware know where to find this work queue and its attributes. Meanwhile, ibc _ create _ cq () is called in the function to create a completion queue of the RDMA communication, where the completion queue element describes whether a task is executed correctly or encounters an error and a cause of the error, and specifically, after the communication between the server and the client is completed, the server generates a completion message queue element to indicate that the message is received successfully, and similarly, the client generates a completion message queue element to indicate that the message is sent successfully.
In the above embodiment, the correction is performed by correcting the work queue parameters input by the user
In one embodiment, the network communication method further comprises: after each sending and receiving event of the RDMA work queue is processed, the buffer space of the RDMA work queue is updated by calling an updating component.
Specifically, after an RDMA work queue of a server finishes processing a sending and receiving event, a cache space of the RDMA work queue needs to be updated by calling an updating component, and meanwhile, the updating component needs to be called to synchronize the size of a buffer to an opposite end. In other embodiments, a grpc _ RDMA _ update _ references () function may be called to synchronize the RDMA buffer sizes of the server and client.
In the embodiment, the cache space can be updated through the updating component, so that long-term occupation of resources is avoided, and subsequent operations cannot be processed in time.
In one embodiment, RDMA communication is performed with a client according to an RPC communication channel, comprising: receiving a data reading request and/or a data writing request sent by a client through an RPC communication channel; reading and fragmenting a data packet to be read in an RDMA work queue by calling a reading component; and/or writing and fragmenting the data packet to be written in the RDMA work queue by calling the writing component.
Specifically, after the server establishes a link with the client, a network communication descriptor is newly created, the network communication descriptor is added into a corresponding completion queue, a read or write operation of the network communication descriptor is monitored, when the read or write operation is monitored, a corresponding read or write component is called to perform a corresponding operation, wherein the read component reads and fragments a data packet according to an available buffer, and the write component writes and fragments the data packet according to the available write buffer. In another embodiment, when writing and fragmenting the packet, the writing component also determines whether the rdma _ recv buffer of the opposite end can receive the packet, and if so, enters a sending flow, and calls ibv _ post _ send () function to write the packet into the memory address of the opposite end map. If the buffer area of the opposite terminal can not receive the transmission, entering a delay transmission queue, continuously polling the buffer area state of the opposite terminal, and entering a data packet transmission process at the time of transmission, wherein the specific process comprises the following steps: firstly, acquiring the memory head address of the next work queue element from a QueuePair buffer, wherein the memory head address can be applied in ibv _ create _ qp (); secondly, analyzing the content in the work request and filling the content into a work queue element according to a structure agreed with hardware; thirdly, the data area is specified by sge (Scatter Gather Element, which is a concrete Element of SGL (Scatter Gather List) in rdma programming), sge points to memory in the work request, which may be registered in ibv _ reg _ mr (); fourthly, after completion of filling, informing hardware (the address is mapped in ibv _ open _ device ()); fifthly, the hardware takes out the work queue element from the QueuPair buffer and analyzes the content of the work queue element; sixthly, the hardware converts the virtual address for storing the data into a physical address through a mapping table (established in ibv _ reg _ mr ()), and takes out the data; and seventhly, packaging and sending data by hardware.
In the above embodiment, the read or write operation is monitored through the network communication descriptor, and when the read or write operation is monitored, the corresponding component is called for processing.
In one embodiment, the network communication method further comprises: adding, by the polling component, the RDMA event channel file descriptor created in the polling component to a polling set; monitoring, by a network polling engine, polling RDMA event channel file descriptors in a polling set; and if the RDMA event channel file descriptor has the event to be processed, processing the event to be processed according to the corresponding processing component.
Specifically, the server side server sends the created RDMA event channel descriptor through a polling component, wherein the RDMA event channel descriptor is a general name of a file descriptor and can comprise an RDMA listening file descriptor and an RDMA network communication file descriptor, the created RDMA event channel descriptor can be added into a polling set through the polling component, the polling of the RDMA event channel file descriptor in the polling set is monitored through a network polling engine, and when corresponding read, write and error operations exist in the event to be processed in the RDMA event channel descriptor, the corresponding component can be called to process. In other embodiments, the APIs in the network polling engine include: (1) grpc _ fd _ notify _ on _ [ read | write | error ], which is used to register a closure to be invoked when a file descriptor becomes readable/writable or has an error, the closure being invoked only once per event. I.e. once the file descriptor becomes readable/writable/erroneous, the closure is triggered and the trigger state of the file descriptor is put back triggered. This state is to prevent an event from being snooped and repeatedly processed multiple times by the polling engine. When the network event needs to be accepted again, the trigger state of the file descriptor is set to be not triggered; (2) grpc _ poll _ add _ fd is used to add RDMA event channel file descriptors to the polling sets, (3) grpc _ fd _ orphan is used to destroy the file descriptor structure to destroy flows, some resource destruction flows of the grpc itself framework, and delete RDMA event channel file descriptors from all associated polling sets; (4) grpc _ poll _ work is used to fetch events from file descriptors in the poll set, and returns true when a specified expiration date has passed, some file descriptors in the poll set are found to be readable/writable/erroneous, and those related closures are properly "scheduled" and a worker thread is woken up; (5) the grpc _ poll _ kick is used to wake up a work thread when the poll completion queue needs to wake up one or more threads in the thread pool to execute, and force the work thread to return from the grpc _ poll _ work (). If the designated worker thread is empty, any associated worker thread in the polling set is woken up. In other embodiments, the pending events include at least a read event, a write event, an error event.
In the above embodiment, the network polling engine monitors polling of RDMA event channel file descriptors in the polling set to ensure that when an IO event occurs, a corresponding processing flow can be entered in time.
In one embodiment, the network communication method under the GRPC framework is used, and can be divided into the following modules: the network event processing module is used for establishing a GRPC channel for a server side server and a client side, wherein the GRPC channel is used for establishing connection between the client side and the server, and a destination end of the GRPC channel can be analyzed into one or more back-end servers. One GRPC subchannel represents a connection from a client to a real back-end server.
Specifically, when the server at the server side is started, the RDMA listening file descriptor is added into a completion queue of the server, and when the client side initiates a Connect () method to request for establishing a connection, a corresponding readable event is generated by the RDMA listening file descriptor. The server monitors the readable event, allocates a new RDMA communication file descriptor to establish a real network connection, namely a specific site-to-site connection, and adds the file descriptor to a corresponding completion queue for monitoring.
In this embodiment, the network event processing module has a corresponding network polling engine component to monitor all RDMA file descriptors, so as to ensure that when an IO event occurs, a corresponding processing flow can be entered in time, wherein optionally, the network polling engine component further includes component interfaces for releasing the file descriptors, waking up a working thread, and the like; the associated components in the RDMA communication module may be invoked for processing when the network polling engine component listens for a change in the RDMA file descriptor, wherein optionally, the read component in the RDMA communication module may be invoked for operation when the network polling engine component listens for a change in the state of the RDMA file descriptor.
In the above embodiment, the problem that the GRPC does not support RDMA at present is solved by using a network communication method, so that efficient transmission in the GRPC framework is realized.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
In one embodiment, as shown in fig. 3, there is provided a network communication apparatus including: a receivingmodule 100, a connectingmodule 200 and acommunication module 300, wherein:
the receivingmodule 100 is configured to allocate a remote direct data access RDMA network communication file descriptor in response to a Remote Procedure Call (RPC) connection request sent by a client.
And theconnection module 200 is used for adding the RDMA network communication file descriptor into the RDMA completion queue corresponding to the RPC connection request, and establishing an RPC communication channel with the client.
Thecommunication module 300 is configured to perform RDMA communication with the client according to the RPC communication channel.
In one embodiment, the network communication apparatus further includes:
and the state acquisition module is used for acquiring the state of the RDMA listening file descriptor in the completed RDMA work queue.
And the state judgment module is used for determining that the client sends the RPC connection request if the state of the RDMA interception file descriptor is a readable state.
In one embodiment, the network communication apparatus further includes:
the RPC connection module is used for setting the state of the RDMA interception file descriptor to be a writable state after an RPC communication channel between the RDMA interception file descriptor and the client is established; the writable state represents a state in which the receiving client sends an RPC connection request.
In one embodiment, theconnection module 200 further includes:
adding a submodule: and the socket set is used for adding the RDMA communication file descriptor into the RDMA completion work queue corresponding to the RPC connection request.
In one embodiment, the network communication apparatus further includes:
the component calling module is used for calling a preset queue creating component and creating at least one RDMA work queue; the RDMA work queue is used for the client to communicate with the server.
In one embodiment, the component calling module further includes:
and the checking submodule is used for checking and correcting the work queue parameters input by the user.
And the resource application submodule is used for creating resource information of the RDMA work queue and applying for a cache space of the RDMA work queue to obtain the RDMA work queue if the work queue parameters are legal.
In one embodiment, the network communication apparatus further includes:
and the updating module is used for updating the cache space of the RDMA work queue by calling the updating component after the RDMA work queue processes one sending event and one receiving event.
In one embodiment, thecommunication module 300 further includes:
and the data receiving submodule is used for receiving a data reading request and/or a data writing request sent by the client through the RPC communication channel.
The read-write operation module is used for reading and fragmenting the data packet to be read in the RDMA work queue by calling the read component; and/or writing and fragmenting the data packet to be written in the RDMA work queue by calling the writing component.
In one embodiment, the network communication apparatus further includes:
and the polling component calling module is used for adding the created RDMA event channel file descriptor into the polling set through the polling component.
The monitoring module is used for monitoring the polling of RDMA event channel file descriptors in the polling set through a network polling engine;
and the operation module is used for processing the event to be processed according to the calling of the corresponding processing component if the event to be processed exists in the RDMA event channel file descriptor.
In one embodiment, the pending events in the operation module at least include a read event, a write event, and an error event.
The implementation principle and technical effect of the computer device provided by the above embodiment are similar to those of the above method embodiment, and are not described herein again.
The modules in the network communication device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is for storing work queue elements. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a network communication method.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
responding to a Remote Procedure Call (RPC) connection request sent by a client, and allocating remote direct data access (RDMA) network communication file descriptors;
adding the RDMA network communication file descriptor into an RDMA completion queue corresponding to the RPC connection request, and establishing an RPC communication channel with the client;
and performing RDMA communication with the client according to the RPC communication channel.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring the state of the RDMA interception file descriptor in the completed RDMA work queue;
and if the state of the RDMA interception file descriptor is a readable state, determining that the client sends the RPC connection request.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
after an RPC communication channel between the RDMA monitoring file and a client is established, setting the state of an RDMA monitoring file descriptor to be a writable state; the writable state represents a state in which the receiving client sends an RPC connection request.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and adding the RDMA communication file descriptor into a socket set of the RDMA completion work queue corresponding to the RPC connection request.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
calling a preset queue creating component to create at least one RDMA work queue; the RDMA work queue is used for the client to communicate with the server.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
checking and correcting the work queue parameters input by the user;
and if the work queue parameters are legal, creating resource information of the RDMA work queue, and applying for a cache space of the RDMA work queue to obtain the RDMA work queue.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
after each sending and receiving event of the RDMA work queue is processed, the buffer space of the RDMA work queue is updated by calling an updating component.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
receiving a data reading request and/or a data writing request sent by a client through an RPC communication channel;
reading and fragmenting a data packet to be read in an RDMA work queue by calling a reading component; and/or writing and fragmenting the data packet to be written in the RDMA work queue by calling the writing component.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
adding, by the polling component, the created RDMA event channel file descriptor to a polling set;
monitoring, by a network polling engine, polling RDMA event channel file descriptors in a polling set;
and if the RDMA event channel file descriptor has the event to be processed, processing the event to be processed according to the corresponding processing component.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
the pending events include at least a read event, a write event, and an error event.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
responding to a Remote Procedure Call (RPC) connection request sent by a client, and allocating remote direct data access (RDMA) network communication file descriptors;
adding the RDMA network communication file descriptor into an RDMA completion queue corresponding to the RPC connection request, and establishing an RPC communication channel with the client;
and performing RDMA communication with the client according to the RPC communication channel.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring the state of the RDMA interception file descriptor in the completed RDMA work queue;
and if the state of the RDMA interception file descriptor is a readable state, determining that the client sends the RPC connection request.
In one embodiment, the computer program when executed by the processor further performs the steps of:
after an RPC communication channel between the RDMA monitoring file and a client is established, setting the state of an RDMA monitoring file descriptor to be a writable state; the writable state represents a state in which the receiving client sends an RPC connection request.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and adding the RDMA communication file descriptor into a socket set of the RDMA completion work queue corresponding to the RPC connection request.
In one embodiment, the computer program when executed by the processor further performs the steps of:
calling a preset queue creating component to create at least one RDMA work queue; the RDMA work queue is used for the client to communicate with the server.
In one embodiment, the computer program when executed by the processor further performs the steps of:
checking and correcting the work queue parameters input by the user;
and if the work queue parameters are legal, creating resource information of the RDMA work queue, and applying for a cache space of the RDMA work queue to obtain the RDMA work queue.
In one embodiment, the computer program when executed by the processor further performs the steps of:
after each sending and receiving event of the RDMA work queue is processed, the buffer space of the RDMA work queue is updated by calling an updating component.
In one embodiment, the computer program when executed by the processor further performs the steps of:
receiving a data reading request and/or a data writing request sent by a client through an RPC communication channel;
reading and fragmenting a data packet to be read in an RDMA work queue by calling a reading component; and/or writing and fragmenting the data packet to be written in the RDMA work queue by calling the writing component.
In one embodiment, the computer program when executed by the processor further performs the steps of:
adding, by the polling component, the created RDMA event channel file descriptor to a polling set;
monitoring, by a network polling engine, polling RDMA event channel file descriptors in a polling set;
and if the RDMA event channel file descriptor has the event to be processed, processing the event to be processed according to the corresponding processing component.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the pending events include at least a read event, a write event, and an error event.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (14)

CN202111421323.4A2021-11-262021-11-26Network communication method, apparatus, device, storage medium, and program productActiveCN114268654B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111421323.4ACN114268654B (en)2021-11-262021-11-26Network communication method, apparatus, device, storage medium, and program product

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111421323.4ACN114268654B (en)2021-11-262021-11-26Network communication method, apparatus, device, storage medium, and program product

Publications (2)

Publication NumberPublication Date
CN114268654Atrue CN114268654A (en)2022-04-01
CN114268654B CN114268654B (en)2024-08-09

Family

ID=80825721

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111421323.4AActiveCN114268654B (en)2021-11-262021-11-26Network communication method, apparatus, device, storage medium, and program product

Country Status (1)

CountryLink
CN (1)CN114268654B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN115174484A (en)*2022-06-162022-10-11阿里巴巴(中国)有限公司RDMA (remote direct memory Access) -based data transmission method, device, equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7281030B1 (en)*1999-09-172007-10-09Intel CorporationMethod of reading a remote memory
US20130054726A1 (en)*2011-08-312013-02-28Oracle International CorporationMethod and system for conditional remote direct memory access write
CN103002046A (en)*2012-12-182013-03-27无锡众志和达存储技术股份有限公司Multi-system data copying remote direct memory access (RDMA) framework
CN105579971A (en)*2013-09-262016-05-11国际商业机器公司Fast path userspace RDMA resource error detection
US20160248628A1 (en)*2015-02-102016-08-25Avago Technologies General Ip (Singapore) Pte. Ltd.Queue pair state transition speedup
CN106201739A (en)*2016-06-292016-12-07上海浦东发展银行股份有限公司信用卡中心A kind of remote invocation method of Storm based on Redis
US20170149920A1 (en)*2015-07-082017-05-25Samsung Electronics Co., Ltd.Method to implement rdma nvme device
US9977760B1 (en)*2013-12-232018-05-22Google LlcAccessing data on distributed storage systems
CN110177118A (en)*2019-06-132019-08-27上海海事大学A kind of RPC communication method based on RDMA
CN113326154A (en)*2021-06-282021-08-31深信服科技股份有限公司Connection management method, device, electronic equipment and storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US7281030B1 (en)*1999-09-172007-10-09Intel CorporationMethod of reading a remote memory
US20130054726A1 (en)*2011-08-312013-02-28Oracle International CorporationMethod and system for conditional remote direct memory access write
CN103002046A (en)*2012-12-182013-03-27无锡众志和达存储技术股份有限公司Multi-system data copying remote direct memory access (RDMA) framework
CN105579971A (en)*2013-09-262016-05-11国际商业机器公司Fast path userspace RDMA resource error detection
US9977760B1 (en)*2013-12-232018-05-22Google LlcAccessing data on distributed storage systems
US20160248628A1 (en)*2015-02-102016-08-25Avago Technologies General Ip (Singapore) Pte. Ltd.Queue pair state transition speedup
US20170149920A1 (en)*2015-07-082017-05-25Samsung Electronics Co., Ltd.Method to implement rdma nvme device
CN106201739A (en)*2016-06-292016-12-07上海浦东发展银行股份有限公司信用卡中心A kind of remote invocation method of Storm based on Redis
CN110177118A (en)*2019-06-132019-08-27上海海事大学A kind of RPC communication method based on RDMA
CN113326154A (en)*2021-06-282021-08-31深信服科技股份有限公司Connection management method, device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
明亮;冯丹;王芳;陈碧砚;: "基于InfiniBand的RPC优化", 计算机工程与科学, no. 07*
胡波;谭良;: "HBase架构中RPC客户端的通信性能优化", 计算机科学, no. 04*

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN115174484A (en)*2022-06-162022-10-11阿里巴巴(中国)有限公司RDMA (remote direct memory Access) -based data transmission method, device, equipment and storage medium

Also Published As

Publication numberPublication date
CN114268654B (en)2024-08-09

Similar Documents

PublicationPublication DateTitle
CN108052675B (en)Log management method, system and computer readable storage medium
US9699276B2 (en)Data distribution method and system and data receiving apparatus
CN108055343A (en)For the method for data synchronization and device of computer room
US8280197B1 (en)Managed background loading of image resources in resource-constrained devices
WO2018058998A1 (en)Data loading method, terminal and computing cluster
CN112799824A (en) A current limiting method, apparatus, device and storage medium
CN110866011B (en)Data table synchronization method and device, computer equipment and storage medium
CN112685148A (en)Asynchronous communication method and device of mass terminals, computer equipment and storage medium
CN116455849B (en) A concurrent communication method, device, device and medium for many-core processors
CN116795647A (en) A database heterogeneous resource management and scheduling method, device, equipment and medium
CN117857501A (en)Method, device, equipment and storage medium for drop-disc of non-lock ring queue dns log
CN116225997A (en)Data acceleration calculation method, device, equipment and storage medium
CN114328453A (en) KV database data management method, device, computing device and storage medium
CN114268654A (en)Network communication method, device, equipment, storage medium and program product
US9659041B2 (en)Model for capturing audit trail data with reduced probability of loss of critical data
CN111865675A (en)Method, device and system for limiting receiving and transmitting speed of container
US11914529B2 (en)Systems, methods, and devices for time synchronized storage delivery
CN114448976B (en)Method, device, equipment, medium and program product for assembling network message
CN115640968A (en)Job scheduling method and device, electronic equipment and storage medium
CN116796088A (en)Picture lazy loading method and device, computer equipment and storage medium
CN115510016A (en) A client response method, device and medium based on directory fragmentation
CN115509771A (en) Event monitoring method, device and electronic equipment
CN110389966B (en) An information processing method and device
CN114860460A (en) A method, apparatus and computer equipment for database acceleration
CN113590590A (en)Database calculation method and device and electronic equipment

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp