Data processing method, cloud storage system and electronic equipment
By establishing a registered memory space between the application layer, the user-state protocol stack and the network card, reducing the number of data copies, and directly collaborating with the user-state protocol stack, the problem of insufficient processing capabilities of the network protocol stack is solved, and the effect of shortening delay and improving system processing performance is achieved.
Patent Information
- Application Number
- CN202311028050.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2025-02-25
AI Technical Summary
The increase in network communication bandwidth and traffic leads to insufficient processing capabilities of the network protocol stack, forming a bottleneck in system performance. The existing technology has delay problems and is unfriendly to CPU scheduling during the protocol stack processing.
By establishing a registered memory space between the application layer, the user-state protocol stack and the network card, reducing the number of data copies, adopting the user-state protocol stack and opening up its boundary with the application layer, the two can directly cooperate and reduce the conversion overhead between data and readable events.
It shortens the data processing delay, reduces CPU time slices, improves system processing performance, and saves CPU resources.
Smart Images

Figure CN119520547A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a data processing method, a cloud storage system and an electronic device. Background Art
[0002] With the continuous development of network communication technology, the bandwidth and traffic of network communication have increased accordingly, and the processing capacity of the network protocol stack can easily become a bottleneck of system performance.
[0003] Currently, in a protocol stack processing process, multiple time slices of the central processing unit (CPU) are involved, which not only causes delay problems but is also not friendly to CPU scheduling, thereby affecting system processing performance. Summary of the invention
[0004] In view of the above problems, the present application is proposed to provide a data processing method, a cloud storage system and an electronic device that solve the above problems or at least partially solve the above problems.
[0005] Therefore, in one embodiment of the present application, a data processing method is provided, which is applied to a first network device; the first network device includes a first application layer, a first user mode protocol stack and a first network card; the first application layer includes a first application program; the method includes:
[0006] Allocating a first target memory block for the to-be-sent data of the first application program from a first registered memory space of the first network card using the first application layer;
[0007] Using the first application layer to write the data to be sent into the first target memory block;
[0008] Using the first application layer to call the first user mode protocol stack, so as to encapsulate the data to be sent in the first target memory block;
[0009] The first network card is used to send the data to be sent after being encapsulated in the first target memory block.
[0010] In another embodiment of the present application, a data processing method is provided, which is applied to a second network device, wherein the second network device includes: a second application layer, a second user mode protocol stack, and a second network card; the second application layer includes a second application program; the method includes:
[0011] Using the second user state protocol stack to call the query interface provided by the second network card to determine whether the second network card has received the network data;
[0012] When it is determined that the second network card receives the network data, decapsulate the network data written by the second network card in a second target memory block by using the second user state protocol stack; the second target memory block is located in a second registered memory space of the second network card;
[0013] The second user-mode protocol stack is used to call the second application layer to process the network data after decapsulation in the second target memory block.
[0014] In another embodiment of the present application, a cloud storage system is provided, comprising: a computing node and a storage node; wherein the computing node comprises a first application layer, a first user-mode protocol stack, and a first network card; the first application layer comprises a first application program; the storage node comprises a second application layer, a second user-mode protocol stack, and a second network card; the second application layer comprises a second application program;
[0015] The computing node is used to: use the first application layer to allocate a first target memory block from the first registered memory space of the first network card for the read and write request of the first application; use the first application layer to write the read and write request to the first target memory block; use the first application layer to call the first user state protocol stack to encapsulate the read and write request in the first target memory block; use the first network card to send the encapsulated read and write request in the first target memory block to the storage node;
[0016] The storage node is used to: use the second user state protocol stack to call the query interface provided by the second network card to determine whether the second network card has received the read and write request; when it is determined that the second network card has received the read and write request, use the second user state protocol stack to decapsulate the read and write request written by the second network card in the second target memory block; the second target memory block is located in the second registered memory space of the second network card; use the second user state protocol stack to call the second application layer to process the read and write request in the second target memory block after decapsulation.
[0017] In another embodiment of the present application, a first network device is provided, comprising: a memory, a processor, and a first network card, wherein:
[0018] The memory is used to store programs;
[0019] The processor is coupled to the memory and the network card, and is used to execute the program stored in the memory to implement the corresponding data processing method mentioned above.
[0020] In another embodiment of the present application, a second network device is provided, including: a memory, a processor, and a second network card, wherein:
[0021] The memory is used to store programs;
[0022] The processor is coupled to the memory and the network card, and is used to execute the program stored in the memory to implement the corresponding data processing method mentioned above.
[0023] In the technical solution provided by the embodiment of the present application, the data to be sent by the application program is located in the registered memory space accessible to the application layer, the user protocol stack and the network card after being written into the registered memory space of the network card by the application layer and before being sent by the network card, which reduces the number of copies and saves CPU resources; in addition, this solution adopts a user-mode protocol stack and opens up the boundary between the user-mode protocol stack and the application layer, so that the two can collaborate through a direct call relationship. Compared with the solution in the prior art that the application layer and the user-mode protocol stack need to collaborate through the conversion between data and readable events, it not only saves the conversion overhead between data and readable events, but also reduces the CPU time slice involved in the entire processing process. It can be seen that the technical solution provided by the embodiment of the present application can shorten the delay, be friendly to CPU scheduling, and thus improve the system processing performance.
[0024] In the technical solution provided by the embodiment of the present application, after the network data is written into the registered memory space of the network card by the network card and before it is processed by the application program, it is always in the registered memory space accessible to the application layer, the user protocol stack and the network card, which reduces the number of copies and saves CPU resources; in addition, this solution adopts the user state protocol stack and opens up the boundary between the user state protocol stack and the application layer, so that the two can collaborate through a direct call relationship. Compared with the solution in the prior art that the application layer and the user state protocol stack need to cooperate through the conversion between data and readable events, it not only saves the conversion overhead between data and readable events, but also reduces the CPU time slice involved in the entire processing process. It can be seen that the technical solution provided by the embodiment of the present application can shorten the delay, be friendly to CPU scheduling, and thus improve the system processing performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1An example diagram of an event triggering model and a data pass-through model provided in an embodiment of the present application;
[0027] Figure 2 A flowchart of a data processing method provided in one embodiment of the present application;
[0028] Figure 3 An example diagram of a timing wheel and a linked list provided in an embodiment of the present application;
[0029] Figure 4 An example of communication between a client and a server provided in an embodiment of the present application Figure 1 ;
[0030] Figure 5 A flowchart of a data processing method provided in one embodiment of the present application;
[0031] Figure 6 A schematic diagram of a cloud storage system provided in one embodiment of the present application;
[0032] Figure 7 An example of communication between a client and a server provided in an embodiment of the present application Figure 2 ;
[0033] Figure 8 A structural block diagram of a first network device provided in an embodiment of the present application;
[0034] Fig. 9 A structural block diagram of a second network device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0035] Currently, most protocol stack solutions adopt an event-triggered model, which has problems such as long delays and being unfriendly to CPU scheduling.
[0036] Take the kernel-mode protocol stack solution as an example. Figure 1 As shown in the figure, in the event trigger model, when the network card receives network data, it needs to copy the data in the network card to the kernel state; the kernel state protocol stack (the top layer is the transport layer) unpacks the data copied from the network card; when the kernel state protocol stack completes the unpacking process, it needs to copy the unpacked data to the transport layer in the kernel state protocol stack and provide it to the user state socket interface; the operating system continuously detects whether there is data in the socket interface through an interface, and if there is data, a readable event is generated (Note: there is also a data copy here); when the application discovers this readable event, it reads the data and copies it to the application's memory. Figure 1 As can be seen from the left part, the whole process involves four copies and three time slices, resulting in high CPU overhead and long latency.
[0037] In order to solve the above technical problems, the present application proposes a new protocol stack processing scheme. In the technical scheme provided by the embodiment of the present application, the data to be sent by the application program is located in the registered memory space accessible to the application layer, the user protocol stack and the network card after being written into the registered memory space of the network card by the application layer and before being sent by the network card, which reduces the number of copies and saves CPU resources; in addition, the present scheme adopts a user-mode protocol stack and opens up the boundary between the user-mode protocol stack and the application layer, so that the two can collaborate through a direct call relationship. Compared with the scheme in the prior art that the application layer and the user-mode protocol stack need to cooperate through the conversion between data and readable events, it not only saves the conversion overhead between data and readable events, but also reduces the CPU time slice involved in the entire processing process. It can be seen that the technical scheme provided by the embodiment of the present application can shorten the delay, be friendly to CPU scheduling, and thus improve the system processing performance.
[0038] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below according to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0039] In addition, some of the processes described in the specification, claims and the above-mentioned figures of the present application include multiple operations that appear in a specific order, and these operations may not be executed in the order in which they appear in this article or may be executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0040] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0041] Before introducing the data processing method provided in the embodiment of the present application, the network system architecture involved in the data processing method provided in the embodiment of the present application is introduced. The network system includes a first network device and a second network device. The first network device can be both a sender of data and a receiver of data. The second network device can be both a sender of data and a receiver of data.
[0042] The first network device and the second network device may be connected to each other through the Internet or a mobile network, wherein the network standard of the mobile network may be any one of 2G, 2.5G, 3G, 4G, 4G+, WiMax, etc.
[0043] The first network device may be one of a terminal, a conventional server, a cloud server, a cloud host, and a virtual center. The second network device may be one of a terminal, a conventional server, a cloud server, a cloud host, and a virtual center. The server mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.
[0044] In one example, the first network device includes a first application layer, a first user mode protocol stack, and a first network card; the first application layer includes a first application program; and the first network device can be used to:
[0045] Allocating a first target memory block for the to-be-sent data of the first application program from a first registered memory space of the first network card using the first application layer;
[0046] Using the first application layer to write the data to be sent into the first target memory block;
[0047] Using the first application layer to call the first user mode protocol stack, so as to encapsulate the data to be sent in the first target memory block;
[0048] The first network card is used to send the data to be sent after being encapsulated in the first target memory block.
[0049] In another example, the second network device includes: a second application layer, a second user mode protocol stack, and a second network card; the second application layer includes a second application program; the second network device can be used to:
[0050] Using the second user state protocol stack to call the query interface provided by the second network card to determine whether the second network card has received the network data;
[0051] When it is determined that the second network card receives the network data, decapsulate the network data written by the second network card in a second target memory block by using the second user state protocol stack; the second target memory block is located in a second registered memory space of the second network card;
[0052] The second user-mode protocol stack is used to call the second application layer to process the network data after decapsulation in the second target memory block.
[0053] In a specific example, the network data may be the data to be sent sent by the first network device.
[0054] The specific processing process of the first network device and the second network device in the above system will be described in detail in the following embodiments.
[0055] Figure 2 The flowchart of the data processing method provided by an embodiment of the present application is shown. The method is applicable to a first network device; the first network device includes a first application layer, a first user mode protocol stack and a first network card; the first application layer includes a first application program. Figure 2 As shown, the method comprises:
[0056] 201. Utilize the first application layer to allocate a first target memory block from a first registered memory space of the first network card for data to be sent by the first application program.
[0057] 202. Use the first application layer to write the data to be sent into the first target memory block.
[0058] 203. Use the first application layer to call the first user mode protocol stack to encapsulate the data to be sent in the first target memory block.
[0059] 204. Use the first network card to send the encapsulated data to be sent in the first target memory block.
[0060] In the above 201, the first application layer includes: a first application program and a first application layer protocol module. The first application layer protocol module may be a remote procedure call (RPC) protocol module, which may be referred to as the RPC layer. The first application layer protocol module is used to perform application layer protocol processing on the data sent and received by the first application program.
[0061] The first registered memory space may be registered to the first network card by the first application layer protocol module. In one example, when the process corresponding to the first application is started, the first application layer protocol module may be used to register the memory to the first network card to obtain the first registered memory space. The memory registered to the network card can be recognized by the network card, that is, the network card has the ability to read and write to this registered memory. In actual applications, the first application layer protocol module may call the interface of the data plane development kit (DPDK, Data Plane Development Kit) to register the memory to the network card when the network card is initialized to obtain the registered memory space.
[0062] The first user-mode protocol stack may be a TCP / IP (Transmission Control Protocol / Internet Protocol) protocol stack. The first user-mode protocol stack may include a transport layer, a network layer, and a data link layer. Each layer may support one or more protocols, which is not specifically limited in the embodiment of the present application. In the embodiment of the present application, the topmost protocol layer in the user-mode protocol stack is the transport layer.
[0063] In one example, the above 201 of “using the first application layer to allocate a first target memory block for the data to be sent by the first application from the first registered memory space of the first network card” includes:
[0064] 2011. Utilize the first application to call the first application layer protocol module to allocate a first target memory block for the data to be sent by the first application from the first registered memory space of the first network card.
[0065] When the first application needs to send data, the first application calls the first application layer protocol module to allocate a first target memory block for the data to be sent by the first application from the first registered memory space of the first network card.
[0066] In actual applications, the first application layer protocol module may provide a memory block allocation interface to the first application program. When the first application program needs to send data, the first application program calls the memory block allocation interface provided by the first application layer protocol module to the first application program, so that the first application layer protocol module allocates a first target memory block for the data to be sent by the first application program from the first registered memory space of the first network card.
[0067] The first application layer protocol module can allocate a free first target memory block from the first registered memory space according to the memory requirement transmitted by the first application through the memory block allocation interface. The size of the first target memory block is determined according to the memory requirement; the memory requirement is determined by the first application according to the size of the data to be sent.
[0068] In actual application, after the first application layer protocol module completes the allocation, the memory address information of the first target memory block can be returned to the first application program, wherein the memory address information may include: the first address of the first target memory block and the length of the first target memory block.
[0069] In the above 202, after the first application receives the memory address information of the first target memory block, the first application is used to write the data to be sent into the first target memory block.
[0070] In addition, before the above step 203, the method may further include:
[0071] The first application program is used to call the first application layer protocol module to perform application layer encapsulation processing on the data to be sent in the first target memory block.
[0072] That is, an application layer message header is added to the data to be sent. The first application layer protocol module can provide an application layer encapsulation processing interface to the first application program; after the first application program writes the data to be sent to the first target memory block, the first application program calls the application layer encapsulation processing interface so that the first application layer protocol module performs application layer encapsulation processing on the data to be sent in the first target memory block.
[0073] In the above 203, the first application layer protocol module may be used to call the first user state protocol stack to encapsulate the data to be sent in the first target memory block. Specifically, after the application layer encapsulation processing is completed, the first application layer protocol module is used to call the first user state protocol stack to encapsulate the data to be sent in the first target memory block. The encapsulation processing here refers to further encapsulation processing of the result of the above application layer encapsulation processing.
[0074] The first user-state protocol stack can provide a user-state encapsulation processing interface to the first application layer protocol module; after the application layer encapsulation processing is completed, the first application layer protocol module is used to call the user-state encapsulation processing interface so that the first user-state protocol stack can encapsulate the data to be sent in the first target memory block.
[0075] In actual applications, the first user-mode protocol stack includes a transport layer, a network layer, and a data link layer arranged from top to bottom. These three layers encapsulate the data to be sent in turn to obtain the final encapsulated data.
[0076] In the above 204, in actual applications, the first user mode protocol stack can be used to notify the first network card to send the to-be-sent data after encapsulation processing in the first target memory block.
[0077] In the technical solution provided by the embodiment of the present application, the data to be sent by the application program is located in the registered memory space accessible to the application layer, the user protocol stack and the network card after being written into the registered memory space of the network card by the application layer and before being sent by the network card, which reduces the number of copies and saves CPU resources; in addition, this solution adopts a user-mode protocol stack and opens up the boundary between the user-mode protocol stack and the application layer, so that the two can collaborate through a direct call relationship. Compared with the solution in the prior art that the application layer and the user-mode protocol stack need to collaborate through the conversion between data and readable events, it not only saves the conversion overhead between data and readable events, but also reduces the CPU time slice involved in the entire processing process. It can be seen that the technical solution provided by the embodiment of the present application can shorten the delay, be friendly to CPU scheduling, and thus improve the system processing performance.
[0078] It should be noted that breaking the boundary between the application layer and the user-mode protocol stack is essentially breaking the boundary between the application layer and the transport layer. The prerequisite for the application layer and the transport layer in the user-mode protocol stack to interact through interface calls is that both are in the user mode. Figure 1 In the data pass-through model shown on the right side, a direct call method is adopted between the application layer and the transport layer, so that the entire protocol stack processing process can be completed in one CPU time slice. Compared with the traditional event-driven model, it has better performance, the link becomes shorter and saves CPU resources.
[0079] The traditional method based on cross-language and cross-platform serialized data structure (ProtoBuf) has high development efficiency and strong scalability, but serialization consumes a lot of CPU. However, in some application scenarios (for example: cloud storage scenarios), the fields involved in the application layer protocol are rarely adjusted. Therefore, in the above 202, "using the first application layer to write the data to be sent to the first target memory block" may include:
[0080] 2021. Use the first application layer to write the data to be sent into the first target memory block in binary form.
[0081] Specifically, the data to be sent is written into the first target memory block in binary form using the first application.
[0082] In this solution, you can negotiate with the application in advance and ask the application to directly provide the data to be sent in binary form. The application can directly convert the data structure to be sent into binary form and write it into the target memory block. Later, in the entire processing chain, the memory address information of the target memory block can be passed. In this way, subsequent serialization operations can be saved, which can effectively save CPU overhead.
[0083] In a specific example, the first target memory block is reserved with a first filling position for the data to be sent, a second filling position for the message header corresponding to the application layer, and a third filling position for the message header corresponding to each protocol layer in the first user-mode protocol stack; wherein the first filling position and the second filling position are filled by the first application layer; and the third filling position is filled by each protocol layer in the first user-mode protocol stack. Specifically, the first filling position is filled by the first application program of the first application layer; and the second filling position is filled by the first application layer protocol module. Specifically, the first target memory block is reserved from front to back with: the third filling position for the message header corresponding to the data link layer, the third filling position for the message header corresponding to the network layer, the third filling position for the message header corresponding to the transport layer, the third filling position for the message header corresponding to the application layer, the second filling position for the message header corresponding to the first application layer, and the first filling position for the data to be sent.
[0084] Optionally, the first network device includes a network client device; the data to be sent includes a request to be sent; and the method may further include:
[0085] 205. Using a run-to-termination thread model, allocate a target thread for the initial request to be sent of the application from multiple threads of the process corresponding to the first application.
[0086] 206. Generate a second request identifier for the initial request to be sent according to the first request identifier of the request issued by the target thread.
[0087] The second request identifier is different from the first request identifier of the request issued by the target thread.
[0088] 207. Generate the request to be sent according to the second request identifier and the initial request to be sent.
[0089] 208. Allocate the request to be sent to the target thread, so that the target thread executes the following steps ad.
[0090] a. Utilize the first application layer to allocate the first target memory block for the request to be sent from the first registered memory space of the first network card.
[0091] b. Using the first application layer to write the request to be sent into the first target memory block.
[0092] c. Using the first application layer to call the first user mode protocol stack, so as to encapsulate the request to be sent in the first target memory block.
[0093] d. Using the first network card to send the encapsulated request to be sent in the first target memory block to a network service device through a network connection associated with the target thread.
[0094] Among them, the response data returned by the network server device for the request to be sent includes the second request identifier; the network server device returns the response data through the network connection associated with the target thread; the connections associated with different threads of the process are different from the network connections between the network client device and the network server device.
[0095] In one feasible solution, a full mesh mode (Full Mesh) can be adopted between the network client device and the network server device, that is, each thread of the process on the network client device is connected to all threads on the network server.
[0096] The Run To Complete (RTC) thread model refers to a model in which when an event occurs, the entire thread resource is monopolized until the event processing is completed, and no thread switching occurs in the middle.
[0097] In the above 205, in one example, an idle thread is selected from multiple threads of the process corresponding to the first application using a run-to-termination thread model; and the idle thread is used as a target thread allocated to the initial request to be sent of the application.
[0098] In the above 206, according to the first request identifier of the request that has been issued by the target thread, a second request identifier that is different from the first request identifier of the request that has been issued by the target thread is generated for the initial request to be sent.
[0099] In an achievable solution, in order to reduce the cost of request identifier generation, a request identifier self-increment method can be used to generate the request identifier. Therefore, the first request identifier of the target thread's most recent request can be obtained, and the second request identifier can be generated based on the first request identifier according to a preset self-increment strategy. For example, a preset value (e.g., 1) can be added to the first request identifier to obtain the second request identifier.
[0100] In the above 207, the request to be sent includes the second request identifier and the initial request to be sent.
[0101] In the above 208, the request to be sent is assigned to the target thread, and the target thread executes the above steps 201, 202, 203 and 204 to send the request to be sent to the network service end device through the network connection associated with the target thread.
[0102] After receiving the request to be sent, the network server device unpacks the request to be sent; processes the unpacked request to be sent to obtain response data; encapsulates the response data to obtain encapsulated response data; and returns the encapsulated response data to the network client through its network card. Specifically, the network server returns the response data to the network client through the network connection associated with the target thread.
[0103] The specific processing process of the network server device on the received request to be sent will be described in detail in the following embodiments. The specific processing process of the network server on the response data can refer to the processing process of the network client on the request to be sent.
[0104] In this solution, the request ID of each request only needs to be unique on the thread that issues the request, and does not need to be unique in the entire process. This is because this solution has the following two characteristics:
[0105] First point: In the RTC thread model, the entire life cycle of a request is maintained by one thread, where the entire life cycle of a request includes: request sending, response receiving, timeout processing, etc.;
[0106] Second point: the network connection associated with each thread is also different, that is, there is no situation where multiple different threads share the same network connection. In this way, when a network client receives a response data through a certain network connection, the thread associated with the network connection can be determined based on the network connection; the thread associated with the network connection is also the thread that originally issued the request for which the response data was sent; after determining the thread associated with the network connection, based on the request identifier carried in the response data that can be guaranteed to be unique on the thread, the request to which the response data is directed can be uniquely determined from the requests that have been sent by the thread.
[0107] In actual applications, there is a multi-request concurrent mode between the client and the server. Therefore, after receiving the above response data, it is necessary to find the context information corresponding to the response data to determine which request the response data is for.
[0108] Therefore, the above method may further include:
[0109] 209 After receiving the response data, determine, according to the second request identifier, the position of the request to which the response data corresponds in the array of issued requests corresponding to the target thread.
[0110] The position of the issued request of the target thread in the issued request array is determined by the request identifier of the issued request.
[0111] 210 Determine the request to which the response data is directed from the array of issued requests according to the position.
[0112] In this solution, the above-mentioned response data must be received by the above-mentioned target thread through the network connection associated with it. Therefore, after the target thread receives the above-mentioned response data, it can determine the position of the request to which the response data corresponds in the array of issued requests corresponding to this thread according to the second request identifier.
[0113] In the above 209, in this scheme, for each thread, an array for recording the requests that have been issued by the thread, that is, the issued request array, is maintained. And the position of the issued request of the target thread in the issued request array corresponding to the target thread is determined by the request identifier of the issued request. In one example, the request identifier of the issued request can be hashed to obtain a hash result; the position of the issued request in the array is determined according to the hash result. For example: the length of the issued request array is 128; the request identifier of the first request issued by the target thread is 1, the request identifier of the second request is 2, the request identifier of the third request is 3, and so on; in this way, the request identifier of the nth request issued by the target thread is n; then, the hash calculation formula can be: n%128, and the value of the hash calculation formula is the position of the nth request in the issued request array.
[0114] A preset hash calculation is performed on the second request identifier to obtain the position of the request to which the response data corresponds in the array of issued requests corresponding to the target thread.
[0115] In the above 210, the request to which the response data is directed is obtained from the position in the array of issued requests.
[0116] Optionally, the network client device is a computing node in a cloud storage system; the network server device is a storage node in the cloud storage system. Then, the request to be sent may be a read-write request.
[0117] From the above analysis, it can be seen that the embodiment of the present application only needs to ensure that the request identifier is unique on the thread, and does not need to ensure that the request identifier is unique on the process (or globally unique). Compared with the prior art, a global request identifier generation module is required to ensure the global uniqueness of the request identifier. The global request identifier generation module in this solution has a high maintenance cost, and the global lock will be frequently called in a multi-threaded scenario to ensure multi-threaded security, which is inefficient.
[0118] In actual applications, the client side will generate a scheduled task for the request, which can also be called a timer. Generally, the timer corresponds to a timeout point. Once the response data packet of the request is not received after the timeout point, the request is considered to have timed out, that is, the timer expires. Once the timer of a request expires, it is necessary to execute a retry mechanism for the request, thereby improving the response rate of the request and reducing the impact on the user experience. In the prior art, all scheduled tasks are usually placed in a queue, and each timed task records the timeout point. Each time a scheduled task is inserted or deleted, the queue needs to be traversed from beginning to end. The time consumption of this traversal method is O(n). In some application scenarios, such as cloud storage scenarios, through research and request feature collection, it is found that more than 90% of requests are completed normally and will not wait until the request timeout timer is triggered, which means that the request timeout accuracy is not necessary to the millisecond level. Therefore, in order to reduce the maintenance consumption of scheduled tasks, the above method may also include:
[0119] 211 determines a timeout time point corresponding to the request to be sent according to the current time of the time wheel and the preset delay time length corresponding to the request to be sent.
[0120] 212 , according to the timeout time point corresponding to the request to be sent, determine a target scale matching the timeout time point from the time wheel.
[0121] 213 adds the timer of the request to be sent to the linked list corresponding to the target scale.
[0122] 214 When the target scale arrives, the linked list corresponding to the target scale is deleted.
[0123] In the above 211, the current time refers to the position currently pointed to by the pointer of the time wheel.
[0124] The preset delay time corresponding to the request to be sent can be determined by the application, and the preset delay time corresponding to different requests can be different. The sum of the current time and the preset delay time corresponding to the request to be sent can be used as the timeout time point of the request.
[0125] In the above 212, in one example, the mark on the time wheel closest to the timeout time point can be used as the target mark. In another example, it is determined whether there is a mark on the time wheel that coincides with the timeout time point; if so, the mark on the time wheel that coincides with the timeout time point is used as the target mark; if not, the smallest mark on the time wheel that is later than the timeout time point is used as the target mark.
[0126] The duration corresponding to one circle of the above-mentioned time wheel can be set according to actual needs, and the embodiment of the present application does not specifically limit this. For example, the duration corresponding to one circle of the above-mentioned time wheel can be 128s. The above-mentioned time wheel can be divided into scales according to preset time intervals, wherein the preset time interval can also be set according to actual needs, and the embodiment of the present application does not specifically limit this. For example, the preset time interval is 1s, that is, the timer accuracy is second-level granularity.
[0127] In this way, through calculation, timers of multiple requests with small differences can be placed in a linked list of the same scale, which can simplify the search and maintenance cost of timer insertion. In addition, multiple timers at the same scale are organized through linked lists, and the cost of deleting nodes is O(1). The combined design of the time wheel and the linked list can improve the search efficiency to O(1). Figure 3 As shown, 5 business requests were generated at 00:00:00:
[0128] If the request timeout of a is 0.9s, a is directly put into the linked list of the time wheel 301 with a scale of 1s;
[0129] If the request timeout of b is 1.3s, put b into the linked list with a scale of 2s;
[0130] The timeout of request c is 63.9s, the timeout of request d is 64.0s, and the timeout of request e is 63.3s. All three requests are put into a linked list with a scale of 64.
[0131] Figure 3 The time wheel in the above example can support a timer timeout of up to 128 seconds. Taking the cloud storage scenario as an example, its timeout is reduced to 20 seconds at most, and there is no need for a larger timeout. Therefore, the timer maintenance cost can be simplified by limiting the duration of one round of the above time wheel.
[0132] In the above 213, the linked list corresponding to the target scale is found, and the timer of the request to be sent is added in the linked list corresponding to the target scale. Specifically, the timer of the request to be sent can be added at any position of the linked list corresponding to the target scale. The above arbitrary position can be the tail of the linked list, so that the original structure of the linked list can be unchanged.
[0133] It can be seen that in this scheme, when inserting a timer, the search time consumed is O(1).
[0134] In the above 214, when the target scale arrives, it means that all timers in the linked list corresponding to the target scale have timed out, so it is necessary to delete all timers under the target scale. In practical applications, in addition to deleting all timers under the target scale, it is also necessary to perform corresponding retry operations for these timers. The specific implementation of the retry operation can be found in the prior art and will not be described in detail here.
[0135] In order to facilitate the maintenance of the linked list, the linked list may be a bidirectional linked list. In addition, in order to save storage space, the storage of the linked list may be implemented based on the sent request array. Specifically, the sent request array may store the direct successor address pointer and the direct predecessor address pointer corresponding to the sent request in association with the sent request stored therein; the direct successor address pointer points to the request corresponding to the direct successor timer of the timer of the sent request in the corresponding linked list; the direct predecessor address pointer points to the request corresponding to the direct predecessor timer of the timer of the sent request in the corresponding linked list.
[0136] Traditional network frameworks only support one specific transport layer protocol during operation, such as TCP (Transmission Control Protocol), UDP (User Datagram Protocol) and RDMA (Remote Direct Memory Access), which greatly limits the deployment scalability of the client and server. The framework provided in the embodiment of the present application implements a multi-network platform autonomous negotiation and adaptive solution, supporting the deployment of clients and servers based on different network transport layers. A common usage scenario is: half of the machines in a cluster are configured with Melos network cards, which use RDMA; the other half of the machines are configured with Broadcom network cards, which can use the high-performance RDMA protocol: solar.
[0137] If a client process needs to connect to both machines in the cluster for communication, the client needs to have the ability to negotiate with the server to adapt to multiple network environments. Figure 4 As shown, a handshake mechanism can be implemented between the client and the server. Specifically, when the application needs to send data to be sent, the client can initiate a handshake. After receiving the handshake request, the server puts the transport layer protocol it supports in the handshake response and replies to the client. The client selects a suitable transport layer protocol for communication based on the protocol supported by the server and its own protocol.
[0138] Specifically, the first user mode protocol stack includes a transport layer; the above method may further include:
[0139] 215. Send a handshake request to the network server device.
[0140] 216. Receive a handshake response returned by the network service device in response to the handshake request.
[0141] The handshake response carries the transport layer protocol supported by the network server device.
[0142] 217. Configure a target transport layer protocol of the transport layer in the first user mode protocol stack according to the transport layer protocol supported by the network server device and the transport layer protocol supported by the network client in the handshake response.
[0143] In the above 216, the handshake response may carry a list of transport layer protocols supported by the network server device.
[0144] In the above 217, one may be selected from the intersection of the transport layer protocols supported by the network server device and the transport layer protocols supported by the network client as the target transport layer protocol of the transport layer in the first user mode protocol stack.
[0145] In this embodiment, the transport layer protocols supported by the client and the server only need to have an intersection, and do not need to be completely consistent, so that the deployment scalability of the client and the server can be improved. Based on this solution, users can flexibly choose different transport layer protocols on both the client and the server for deployment.
[0146] For example, if Figure 4 As shown in the figure, server 1 supports TCP protocol; server 2 supports TCP and enhanced RDMA protocol: luna; server 3 supports RDMA and TCP. Client supports: TCP, UDP, luna, solar, RDMA. Therefore, after negotiation, the client and server 1 communicate through TCP protocol; the client and server 2 communicate through luna protocol; the client and server 3 communicate through RDMA protocol.
[0147] In practical applications, the above method may further include:
[0148] 218. Use the first user mode protocol stack to call the query interface provided by the first network card to determine whether the first network card receives network data.
[0149] 219. When it is determined that the first network card receives the network data, use the first user mode protocol stack to decapsulate the network data written by the first network card in the third target memory block.
[0150] The third target memory block is located in the first registered memory space of the first network card.
[0151] 220. Use the first user mode protocol stack to call the first application layer to process the decapsulated network data in the first target memory block.
[0152] In the above 218, in one example, the network data may be response data of the above request to be sent.
[0153] The query interface provided by the first network card may be called once by using the first user mode protocol stack at every preset time interval to determine whether the first network card has received network data.
[0154] After the first network card receives the network data, the first network card writes the network data into the third target memory block in the first registered memory block of the first network card. The third target memory block may be allocated by the first network card for the network data after receiving the network data. The first registered memory space is registered with the first network card by the first application layer. In one example, the first application layer may also include a first application layer protocol module. When the process corresponding to the first application is started, the first application layer protocol module is used to register the memory with the first network card to obtain the first registered memory space.
[0155] In a specific example, the first network card can write the network data to the third target memory block in the first registered memory block of the first network card through a DMA (Direct Memory Access) operation. The emergence of DMA technology allows peripheral devices (such as network cards) to directly access memory through a DMA controller, while the CPU can continue to execute programs without interrupting the CPU.
[0156] In the above 219, after the first user state protocol stack calls the query interface, if the first network card receives network data, it can return the memory address information of the third target memory block corresponding to the network data to the first user state protocol stack through the query interface; if the first network card does not receive the network data, it can inform the first user state protocol stack through the query interface that the data has not been received.
[0157] If the first network card returns the memory address information of the third target memory block through the query interface, it can be determined that the first network card has received the network data. When it is determined that the first network card has received the network data, the first user state protocol stack is used to decapsulate the network data written by the first network card in the third target memory block according to the memory address information of the third target memory block.
[0158] In the above 220, after the above decapsulation process is completed, the first user-mode protocol stack is used to call the first application layer to process the network data after the decapsulation process in the third target memory block. The first application layer protocol module of the first application layer further decapsulates the network data after the above decapsulation process; after the first application layer protocol module completes the above decapsulation operation, the first application layer protocol module is used to call the first application program to process the network data after the final decapsulation process.
[0159] The decapsulation process is to strip the corresponding message header in the network data in the third target memory block. The calling method involved in this solution may be an interface calling method.
[0160] Figure 5 The flowchart of the data processing method provided by the embodiment of the present application is shown. The method is applied to a second network device, the second network device includes: a second application layer, a second user mode protocol stack and a second network card; the second application layer includes a second application program. Figure 5 As shown, the method comprises:
[0161] 501. Use the second user mode protocol stack to call a query interface provided by the second network card to determine whether the second network card has received network data.
[0162] 502. When it is determined that the second network card receives the network data, use the second user mode protocol stack to decapsulate the network data written by the second network card in the second target memory block.
[0163] The second target memory block is located in the second registered memory space of the second network card.
[0164] 503. Use the second user mode protocol stack to call the second application layer to process the decapsulated network data in the second target memory block.
[0165] In the above 501, the query interface provided by the second network card may be called once at a preset time interval by using the second user mode protocol stack to determine whether the second network card has received network data.
[0166] After the second network card receives the network data, the second network card writes the network data into the second target memory block in the second registered memory block of the second network card. The second target memory block may be allocated by the second network card for the network data after receiving the network data. The second registered memory space is registered with the second network card by the second application layer. In one example, the second application layer may also include a second application layer protocol module. When the process corresponding to the second application is started, the second application layer protocol module is used to register the memory with the second network card to obtain the second registered memory space.
[0167] In a specific example, the second network card may write the network data into the second target memory block in the second registered memory block of the second network card through a DMA operation.
[0168] In the above 502, after the second user state protocol stack calls the query interface, if the second network card receives network data, it can return the memory address information of the second target memory block corresponding to the network data to the second user state protocol stack through the query interface; if the second network card does not receive the network data, it can inform the second user state protocol stack through the query interface that the data has not been received.
[0169] If the second network card returns the memory address information of the second target memory block through the query interface, it can be determined that the second network card has received the network data. When it is determined that the second network card has received the network data, the second user state protocol stack is used to decapsulate the network data written by the second network card in the second target memory block according to the memory address information of the second target memory block.
[0170] In the above 503, after the above decapsulation process is completed, the second user mode protocol stack is used to call the second application layer to process the network data after the decapsulation process in the second target memory block. The second application layer protocol module of the second application layer further decapsulates the network data after the above decapsulation process; after the second application layer protocol module completes the above decapsulation operation, the second application layer protocol module is used to call the second application program to process the network data after the final decapsulation process.
[0171] The decapsulation process is to strip the corresponding message header in the network data in the second target memory block. The calling method involved in this solution may be an interface calling method.
[0172] In the technical solution provided by the embodiment of the present application, after the network data is written into the registered memory space of the network card by the network card and before it is processed by the application program, it is always in the registered memory space accessible to the application layer, the user protocol stack and the network card, which reduces the number of copies and saves CPU resources; in addition, this solution adopts the user state protocol stack and opens up the boundary between the user state protocol stack and the application layer, so that the two can collaborate through a direct call relationship. Compared with the solution in the prior art that the application layer and the user state protocol stack need to cooperate through the conversion between data and readable events, it not only saves the conversion overhead between data and readable events, but also reduces the CPU time slice involved in the entire processing process. It can be seen that the technical solution provided by the embodiment of the present application can shorten the delay, be friendly to CPU scheduling, and thus improve the system processing performance.
[0173] In the embodiment of the present application, the topmost protocol layer in the second user mode protocol stack is the transport layer.
[0174] In one example, the network data may be a request to be sent sent by the first network device.
[0175] Note: The protocol processing process of the second network device is the opposite process to the protocol processing process of the first network device in the above embodiments. Therefore, the protocol processing process of the second network device can refer to the corresponding content in the above embodiments and will not be described in detail here.
[0176] It should be noted here that: for the contents of each step not fully described in detail in the method provided in the embodiment of the present application, please refer to the corresponding contents in the above embodiment, which will not be repeated here. In addition, in addition to the above steps, the method provided in the embodiment of the present application may also include other parts or all of the steps in the above embodiments, which can be specifically referred to the corresponding contents in the above embodiments, which will not be repeated here.
[0177] Figure 6 FIG. 1 is a schematic diagram of a cloud storage system provided by an embodiment of the present application. Figure 6 As shown, the cloud storage system includes: a computing node 601 and a storage node 602. The number of the storage node 602 can be one or more. The computing node includes a first network card, a first user-mode protocol stack, and a first network card; the first application layer includes a first application; the storage node includes a second application layer, a second user-mode protocol stack, and a second network card; the second application layer includes a second application;
[0178] The computing node 601 is used to: use the first application layer to allocate a first target memory block from the first registered memory space of the first network card for the read and write request of the first application; use the first application layer to write the read and write request to the first target memory block; use the first application layer to call the first user state protocol stack to encapsulate the read and write request in the first target memory block; use the first network card to send the encapsulated read and write request in the first target memory block to the storage node 602;
[0179] The storage node 602 is used to: use the second user state protocol stack to call the query interface provided by the second network card to determine whether the second network card has received the read and write request; when it is determined that the second network card has received the read and write request, use the second user state protocol stack to decapsulate the read and write request written by the second network card in the second target memory block; the second target memory block is located in the second registered memory space of the second network card; use the second user state protocol stack to call the second application layer to process the read and write request in the second target memory block after decapsulation.
[0180] In actual applications, after the storage node 602 processes the read / write request and obtains the response data corresponding to the request, it may further perform the following steps:
[0181] Utilize the second application layer to allocate a fourth target memory block for the response data from the second registered memory space of the second network card; utilize the second application layer to write the response data into the fourth target memory block; utilize the second application layer to call the second user-mode protocol stack to encapsulate the response data in the fourth target memory block; utilize the second network card to send the encapsulated response data in the fourth target memory block to the computing node 601.
[0182] Specifically, the second application is used to call the second user-state protocol stack to allocate a fourth target memory block for the response data from the second registered memory space of the second network card; the second application is used to write the response data into the fourth target memory block; the second application is used to call the second application layer protocol module to perform application layer protocol processing on the response data in the fourth target memory block; the second application layer protocol module is used to call the second user-state protocol stack to further encapsulate the response data in the fourth target memory block; the second network card is used to send the encapsulated response data in the fourth target memory block to the computing node 601.
[0183] In addition, the above-mentioned computing node 601 is also used to: use the first user-state protocol stack to call the query interface provided by the first network card to determine whether the first network card has received the response data; when it is determined that the first network card has received the response data, use the first user-state protocol stack to decapsulate the response data written by the first network card in the third target memory block; wherein the third target memory block is located in the first registered memory space of the first network card; use the first user-state protocol stack to call the first application layer to process the response data in the first target memory block after decapsulation.
[0184] The specific processing process of the computing node 601 and the storage node 602 can refer to the corresponding content in the above embodiments, which will not be repeated here.
[0185] The entire processing flow of the cloud storage system in this solution is as follows Figure 7 As shown in the figure, the whole processing flow is roughly divided into the following steps:
[0186] Step 1: The client side maintains the request context.
[0187] Maintaining the request context includes: maintaining the above-mentioned sent request array, which involves functions such as request uniqueness guarantee, timeout timing, and request search.
[0188] Step 2: The client performs RPC encoding.
[0189] Step 3: The client encapsulates the request using the first user mode protocol stack.
[0190] Step 4: The server uses the second user mode protocol stack to decapsulate the request.
[0191] Step 5: The server performs RPC decoding.
[0192] Step 6: Service lookup for request processing.
[0193] The client side is also the computing node; the server side is also the storage node. The specific implementation of each step can refer to the corresponding content in the above embodiments, which will not be repeated here.
[0194] The technical solution proposed in this application cooperates with the application to implement a simple and high-performance request context management strategy, a lightweight timer suitable for the application, a lightweight coding design based on cross-layer binary data transmission, a data pass-through model, and a full-link cross-layer zero-copy feature, allowing data to go directly from the application to the network card, bringing the ultimate performance experience to the application. Experimental data shows that compared with the existing technology, the use of this solution can improve the performance of the entire link by 64%, among which the lightweight timer can bring 8% performance optimization; the lightweight coding design can bring 20% performance optimization; the data pass-through model can bring 22% performance optimization; the full-link cross-layer zero-copy feature can bring 14% performance optimization.
[0195] Figure 8 FIG. 1 shows a schematic diagram of the structure of a first network device provided by an embodiment of the present application. Figure 8 As shown, the first network device includes a memory 1101, a processor 1102 and a first network card. The memory 1101 can be configured to store various other data to support operations on the electronic device. Examples of these data include instructions for any application or method for operating on the electronic device. The memory 1101 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read only memory (EEPROM), an erasable programmable read only memory (EPROM), a programmable read only memory (PROM), a read only memory (ROM), a magnetic memory, a flash memory, a disk or an optical disk.
[0196] The memory 1101 is used to store programs;
[0197] The processor 1102 is coupled to the memory 1101 and is used to execute the program stored in the memory 1101 to implement the method or function in the above embodiment that is suitable for the first network device.
[0198] Further, if Figure 8 As shown, the electronic device further includes: a communication component 1103, a display 1104, a power component 1105, an audio component 1106 and other components. The communication component 1103 includes a first network card. Figure 8Only some components are shown schematically, which does not mean that the electronic device only includes Figure 8 Components shown.
[0199] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a computer, the method or function adapted to the first network device in the above embodiment can be implemented.
[0200] Fig. 9 FIG. 1 shows a schematic diagram of the structure of a second network device provided in an embodiment of the present application. Fig. 9 As shown, the first network device includes a memory 1201, a processor 1202 and a second network card. The memory 1201 can be configured to store various other data to support operations on the electronic device. Examples of these data include instructions for any application or method for operating on the electronic device. The memory 1201 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read only memory (EEPROM), an erasable programmable read only memory (EPROM), a programmable read only memory (PROM), a read only memory (ROM), a magnetic memory, a flash memory, a disk or an optical disk.
[0201] The memory 1201 is used to store programs;
[0202] The processor 1202 is coupled to the memory 1201 and is used to execute the program stored in the memory 1201 to implement the method or function in the above embodiment that is suitable for the second network device.
[0203] Further, if Fig. 9 As shown, the electronic device further includes: a communication component 1203, a display 1204, a power component 1205, an audio component 1206 and other components. The communication component 1203 includes a second network card. Fig. 9 Only some components are shown schematically, which does not mean that the electronic device only includes Fig. 9 Components shown.
[0204] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a computer, the method or function adapted to the second network device in the above embodiment can be implemented.
[0205] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0206] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM (Read Only Memory) / RAM (Random Access Memory), a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0207] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application 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 spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: Applied to a first network device; the first network device includes a first application layer, a first user mode protocol stack and a first network card; the first application layer includes a first application program; the method includes: Allocating a first target memory block for the to-be-sent data of the first application program from a first registered memory space of the first network card using the first application layer; Using the first application layer to write the data to be sent into the first target memory block; Using the first application layer to call the first user mode protocol stack, so as to encapsulate the data to be sent in the first target memory block; The first network card is used to send the data to be sent after being encapsulated in the first target memory block.
2. The method according to claim 1, characterized in that The first application layer also includes: a first application layer protocol module; Allocating a first target memory block for the to-be-sent data of the first application program from a first registered memory space of the first network card using the first application layer includes: The first application layer protocol module is called by the first application to allocate a first target memory block for the data to be sent by the first application from the first registered memory space of the first network card.
3. The method according to claim 2, characterized in that Writing the to-be-sent data into the first target memory block using the first application layer includes: Using the first application program to write the data to be sent into the first target memory block; The method, before using the first application layer to call the first user mode protocol stack to encapsulate the data to be sent in the first target memory block, further includes: The first application program is used to call the first application layer protocol module to perform application layer encapsulation processing on the data to be sent in the first target memory block.
4. The method according to claim 3, characterized in that Writing the to-be-sent data into the first target memory block using the first application layer includes: The data to be sent is written into the first target memory block in binary form using the first application.
5. The method according to any one of claims 1 to 4, characterized in that A first filling position for the data to be sent, a second filling position for the message header corresponding to the application layer, and a third filling position for the message header corresponding to each protocol layer in the first user mode protocol stack are reserved in the first target memory block; The first filling position and the second filling position are filled by the first application layer; and the third filling position is filled by the corresponding protocol layers in the first user mode protocol stack.
6. The method according to any one of claims 1 to 4, characterized in that The first network device includes a network client device; the data to be sent includes a request to be sent; the method further includes: Allocating a target thread for an initial request to be sent of the application from a plurality of threads of a process corresponding to the first application using a run-to-termination thread model; Generate a second request identifier for the initial request to be sent according to the first request identifier of the request issued by the target thread; wherein the second request identifier is different from the first request identifier of the request issued by the target thread; generating the request to be sent according to the second request identifier and the initial request to be sent; The request to be sent is assigned to the target thread for execution by the target thread: the first application layer is used to allocate the first target memory block for the request to be sent from the first registered memory space of the first network card; the first application layer is used to write the request to be sent into the first target memory block; the first application layer is used to call the first user state protocol stack to encapsulate the request to be sent in the first target memory block; and the first network card is used to send the encapsulated request to be sent in the first target memory block to the network service end device through the network connection associated with the target thread; Among them, the response data returned by the network server device for the request to be sent includes the second request identifier; the network server device returns the response data through the network connection associated with the target thread; the connections associated with different threads of the process are different from the network connections between the network client device and the network server device.
7. The method according to claim 6, characterized in that The network client device includes a computing node in a cloud storage system; the network service end device includes a storage node in the cloud storage system; and the request to be sent includes a read and write request.
8. The method according to claim 6, characterized in that Also includes: After receiving the response data, determining the position of the request to which the response data refers in the issued request array corresponding to the target thread according to the second request identifier; the position of the issued request of the target thread in the issued request array is determined by the request identifier of the issued request; The request to which the response data is directed is determined from the array of issued requests according to the position.
9. The method according to claim 6, characterized in that The first user mode protocol stack includes a transport layer; Sending a handshake request to the network server device; Receiving a handshake response returned by the network service end device in response to the handshake request; the handshake response carries a transport layer protocol supported by the network service end device; According to the transport layer protocol supported by the network server device and the transport layer protocol supported by the network client in the handshake response, a target transport layer protocol of the transport layer in the first user mode protocol stack is configured.
10. The method according to claim 6, characterized in that Also includes: Determine the timeout time point corresponding to the request to be sent according to the current time of the time wheel and the preset delay time length corresponding to the request to be sent; According to the timeout time point corresponding to the request to be sent, determining a target scale matching the timeout time point from the time wheel; Adding a timer for the request to be sent in a linked list corresponding to the target scale; When the target scale arrives, the linked list corresponding to the target scale is deleted.
11. A data processing method, characterized in that: Applied to a second network device, the second network device includes: a second application layer, a second user mode protocol stack and a second network card; the second application layer includes a second application program; the method includes: Using the second user state protocol stack to call the query interface provided by the second network card to determine whether the second network card has received the network data; When it is determined that the second network card receives the network data, decapsulate the network data written by the second network card in the second target memory block by using the second user state protocol stack; the second target memory block is located in the second registered memory space of the second network card; The second user-mode protocol stack is used to call the second application layer to process the network data after decapsulation in the second target memory block.
12. A cloud storage system, characterized in that: include: A computing node and a storage node; wherein the computing node includes a first application layer, a first user state protocol stack and a first network card; the first application layer includes a first application program; the storage node includes a second application layer, a second user state protocol stack and a second network card; the second application layer includes a second application program; The computing node is used to: use the first application layer to allocate a first target memory block from the first registered memory space of the first network card for the read and write request of the first application; use the first application layer to write the read and write request to the first target memory block; use the first application layer to call the first user state protocol stack to encapsulate the read and write request in the first target memory block; use the first network card to send the encapsulated read and write request in the first target memory block to the storage node; The storage node is used to: use the second user state protocol stack to call the query interface provided by the second network card to determine whether the second network card has received the read and write request; when it is determined that the second network card has received the read and write request, use the second user state protocol stack to decapsulate the read and write request written by the second network card in the second target memory block; the second target memory block is located in the second registered memory space of the second network card; use the second user state protocol stack to call the second application layer to process the read and write request in the second target memory block after decapsulation.
13. A first network device, characterized in that: include: A memory, a processor and a first network card, wherein: The memory is used to store programs; The processor is coupled to the memory and the network card, and is used to execute the program stored in the memory to implement the data processing method according to any one of claims 1 to 10.
14. A second network device, characterized in that: include: A memory, a processor and a second network card, wherein: The memory is used to store programs; The processor is coupled to the memory and the network card, and is used to execute the program stored in the memory to implement the data processing method according to claim 11.
Citation Information
Cited By
Data processing method and device, storage medium and program product
CN120321213A
Access instruction sending method and device, storage medium, electronic equipment and computer program product
CN121658076A