Data writing method and apparatus
By introducing data verification and notification events into RDMA technology, the problems of low efficiency and high latency in RDMA write operations are solved, realizing an efficient and reliable data writing method that ensures data integrity and terminal availability.
Patent Information
- Application Number
- CN202210307793.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-03-25
AI Technical Summary
In RDMA technology, the order of data writing cannot be guaranteed between two consecutive write operations, resulting in low write efficiency. Furthermore, the CPU blocking of the target terminal during RDMA bilateral operations leads to high latency.
By introducing data verification technology on this side terminal, the data content and pointer do not need to follow a specific order during the writing process. The RDMA device receives the write command and writes it to different segments of the host memory respectively. Combined with immediate value notification events and transmission commands, the data is written completely and the number of read commands is reduced.
This achieves data writing with only one RTT, improving writing efficiency, avoiding latency of the other end's CPU, and ensuring data integrity and availability.
Smart Images

Figure CN114840468B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the field of communication, and in particular, to a data writing method and device. BACKGROUND
[0002] Remote Direct Memory Access (RDMA) technology is a direct memory access technology, which enables a terminal such as a computer to directly access the memory data of another terminal without the need for processing by a processor. However, the order of writing operations in two consecutive times in the RDMA technology cannot guarantee the order of writing to the memory, resulting in the need for additional operations to ensure correct writing of data with a "content + pointer" structure.
[0003] In related technologies, the content and the pointer of the data can be written to the memory of the target terminal in sequence based on a single-sided operation of RDMA, but the above operation needs to spend two Round-Trip Times (RTTs), and the data writing efficiency is low. In addition, the CPU of the target terminal can be instructed to write the content and the pointer of the data based on a double-sided operation of RDMA, although this operation only needs to spend one RTT + the processing time of the CPU, but if the CPU of the target terminal is blocked in other functions and cannot process the related messages in time, it will result in a high latency of the writing operation. SUMMARY
[0004] Therefore, the present specification provides a data writing method and device to solve the problems in the related art.
[0005] Specifically, the present specification is implemented by the following technical solutions:
[0006] According to a first aspect of an embodiment of the present specification, a data writing method is provided, applied to a local terminal, the local terminal comprising a host and a Remote Direct Memory Access (RDMA) device, and the method comprises:
[0007] The RDMA device receives a write instruction for target data initiated by a peer terminal based on an RDMA link, the target data comprising target content, a check value corresponding to the target content, and a target pointer corresponding to the target content;
[0008] The RDMA device performs a write operation according to the write instruction, the write operation being used to write the target content and the check value to a first memory segment of a host memory, and write the target pointer to a second memory segment of the host memory;
[0009] The RDMA device returns state information indicating a successful reading to the peer terminal in response to a read instruction initiated by the peer terminal based on the RDMA link.
[0010] According to a second aspect of the embodiments of this specification, a data writing apparatus is provided, applied to a local terminal, the local terminal including a host and a remote direct data access (RDMA) device, the apparatus comprising:
[0011] The write instruction receiving unit is used for the RDMA device to receive a write instruction for target data initiated by the peer terminal based on the RDMA link. The target data includes target content, a check value corresponding to the target content, and a target pointer corresponding to the target content.
[0012] The target data writing unit is used by the RDMA device to perform a write operation according to the write instruction. The write operation is used to write the target content and the check value into a first memory segment of the host memory, and to write the target pointer into a second memory segment of the host memory.
[0013] The status information return unit is used by the RDMA device to return status information indicating successful reading to the counterpart terminal in response to a read command initiated by the counterpart terminal based on the RDMA link.
[0014] According to a third aspect of the embodiments of this specification, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0015] According to a fourth aspect of the embodiments of this specification, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method described in the first aspect.
[0016] In the technical solution provided in this specification, the local terminal introduces data verification technology so that the content and pointer of any data do not need to follow a specific writing order when being written to the remote terminal. This ensures that the data writing operation only takes one RTT, improving data writing efficiency while avoiding latency caused by the CPU of the remote terminal.
[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this specification. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings.
[0019] Figure 1 This is a schematic diagram of the architecture of a data writing system shown in an exemplary embodiment of this specification;
[0020] Figure 2 This is a flowchart illustrating an exemplary embodiment of a data writing method shown in this specification;
[0021] Figure 3 This is a schematic diagram illustrating a data writing method according to an exemplary embodiment of this specification;
[0022] Figure 4 This is a schematic diagram illustrating another data writing method as shown in an exemplary embodiment of this specification;
[0023] Figure 5 This is a schematic structural diagram of an electronic device shown in an exemplary embodiment of this specification;
[0024] Figure 6 This is a schematic diagram of the structure of a data writing device shown in an exemplary embodiment of this specification. Detailed Implementation
[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims.
[0026] The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” as used in this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0027] It should be understood that although the terms first, second, third, etc., may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0028] Figure 1 This is a schematic diagram illustrating the architecture of a data writing system according to an exemplary embodiment of this specification. Figure 1 As shown, it may include a local terminal 11 and a remote terminal 12.
[0029] The local terminal 11 and the remote terminal 12 refer to an electronic device that supports RDMA technology and can be used by the user. Each terminal must contain at least one RDMA device supporting RDMA technology, and both RDMA devices are connected to a host computer with data storage and processing capabilities. During system operation, the host computer in the local terminal 11 establishes an RDMA link between the local terminal 11 and the remote terminal 12, enabling data interaction between them. Simultaneously, the local terminal 11 can act as a data backup node for the remote terminal 12 to ensure the security of data on the remote terminal 12. For example, on the host computer of the local terminal 11, after an application establishes an RDMA link between the local terminal 11 and the remote terminal 12, the remote terminal 12 writes the data X to be backed up into the host memory of the local terminal 11 based on this RDMA link. Therefore, if the data X is corrupted or lost due to an abnormality on the remote terminal 12, the data X can be retrieved through the local terminal 11. Users may use electronic devices such as mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smartwatches, etc.) as the local terminal 11 and the remote terminal 12. One or more embodiments of this specification do not limit this.
[0030] It should be noted that "this side" and "opposite side" are relative concepts and are not used to specifically refer to any particular electronic device. For example, when describing from the perspective of terminal 11, terminal 11 can be regarded as the local terminal and terminal 12 as the opposite terminal. Conversely, when describing from the perspective of terminal 12, terminal 12 can be regarded as the local terminal and terminal 11 as the opposite terminal. Figure 1 Taking the perspective of terminal 11 as an example, the above-described method of local terminal 11 and counterpart terminal 12 is adopted.
[0031] Figure 2 This is a flowchart illustrating an exemplary embodiment of a data writing method described in this specification. Figure 2 As shown, this method is applied to a local terminal, which includes a host and a Remote Direct Data Access (RDMA) device, and may include the following steps:
[0032] S201, the RDMA device receives a write instruction for target data initiated by the counterpart terminal based on the RDMA link. The target data includes target content, a checksum corresponding to the target content, and a target pointer corresponding to the target content.
[0033] The target content can be set to data formats such as strings, text, or audio / video according to the user's actual needs. When the other terminal needs to write the target content to this terminal via RDMA link, it can be pre-composed with the target pointer of the target content in this terminal and the check value used to verify the integrity of the target content data to form the target data, and the target data can be written to this terminal by sending a write command to this terminal.
[0034] If network fluctuations or unexpected crashes occur during the writing of the target data to the local terminal, the target data may be partially written successfully, failing to guarantee that the target data is completely written to the local terminal. Furthermore, in related technologies, the RDMA protocol can guarantee the atomicity of data up to 8 bytes in length, and the memory address of a conventional operating system is up to 64 bits (i.e., 8 bytes) wide. Therefore, the target pointer only has two states: written and not written to the local terminal; there is no possibility of partial writing. In other words, the statement "cannot guarantee that the target data is completely written to the local terminal" is equivalent to "cannot guarantee that the target content and checksum within the target data are completely written to the local terminal." Those skilled in the art will understand that if only the target content and checksum are written to the local terminal, but the target pointer is not, then regardless of whether the target content and checksum are completely written to the local terminal, the local terminal will be unable to detect the existence of the target data because it cannot obtain the target pointer containing the write address of the target content and checksum. If the target content, checksum, and target pointer are successfully written to the local terminal, the local terminal can find the target content and checksum through the target pointer and determine whether the target content is complete through the checksum. Of course, if the checksum information itself is damaged or completely lost, the local terminal will consider the target content writing to have failed, regardless of whether the target content is completely written to the local terminal.
[0035] Furthermore, the aforementioned check values can be generated from the target content using methods such as Cyclic Redundancy Check (CRC) or Parity Check, and this specification does not impose any restrictions on this.
[0036] The write instruction described above can contain multiple sub-instructions, and each sub-instruction can write different data to a different memory address.
[0037] In one embodiment, the write instruction may include a first write instruction and a second write instruction. The first write instruction may be used to instruct the local terminal's RDMA device to write the target content and its corresponding checksum into a first memory segment below; the second write instruction may be used to instruct the local terminal's RDMA device to write the target pointer into a second memory segment below. In fact, due to the existence of the checksum, the local terminal has the ability to determine whether the target content has been completely written, thus avoiding the restriction that the first and second write instructions must strictly adhere to a specific sending order. For example, the first write instruction may be used to instruct the local terminal's RDMA device to write the target pointer into the second memory segment below, and the second write instruction may be used to instruct the local terminal's RDMA device to write the target content and its corresponding checksum into the first memory segment below; this specification does not impose any limitations on this.
[0038] Those skilled in the art will understand that the aforementioned memory can be classified into two types: volatile memory and non-volatile memory, based on whether the data written to it disappears when the power is turned off. Therefore, both the first and second memory segments can be selected as volatile or non-volatile memory according to the actual usage scenario, and this specification does not impose any restrictions on this.
[0039] S202, the RDMA device performs a write operation according to the write instruction, the write operation being used to write the target content and the check value into a first memory segment of the host memory, and to write the target pointer into a second memory segment of the host memory.
[0040] When the RDMA device of the local terminal receives the above write instruction, it can start executing the corresponding write operation according to the write instruction, so that the target content and the corresponding check value are written to the first memory segment of the host memory, and the target pointer is written to the second memory segment of the host memory. Specifically, the above write operation can be: writing the target data from the buffer of the RDMA device of the local terminal to the host memory of the local terminal.
[0041] S203, in response to the read command initiated by the counterpart terminal based on the RDMA link, the RDMA device returns status information indicating successful read to the counterpart terminal.
[0042] This specification does not limit the actual content of the read instruction and the above status information. In fact, the above actual content can be set to carry any information about the local terminal or the remote terminal according to actual needs. Even the above read instruction can be an RDMA instruction pointing to any memory address with a read length of 0, and the above status information can also be an empty string.
[0043] In related technologies, when the target data is transmitted from the peer terminal to the local terminal's RDMA device via an RDMA link, due to the characteristics of the RDMA protocol, the target data may not be immediately written from the local terminal's RDMA device cache to the local terminal's host memory. In other words, the user cannot determine the exact time when the target data is actually written to the host memory. However, according to the characteristics of the RDMA protocol, when the RDMA device receives a read command, it will inevitably write the target data previously stored in the cache into the local terminal's host memory. Therefore, after writing the target data, the peer terminal can confirm that the target data has been written to the local terminal's host memory by sending a read command to the local terminal and receiving the corresponding status information indicating a successful read.
[0044] However, the fact that the target data has been written to the host memory of this terminal does not mean that the host of this terminal is aware that the target data has been written to the host memory. At this time, the RDMA device of this terminal can trigger a notification event for the host so that the host is aware that the target data has been written to the host memory of this terminal, and then perform subsequent operations.
[0045] Among them, the RDMA device of the aforementioned local terminal can be instructed by different objects to trigger the aforementioned notification event according to actual needs, and the notification event can be divided into different types according to the different objects.
[0046] In one embodiment, the write instruction may carry an immediate value, which is used to trigger an immediate value notification event for the host by the RDMA device. Due to the characteristics of the RDMA protocol, this immediate value notification event can be obtained by the host after the write operation is completed. Because of the characteristics of the RDMA protocol, the write instruction carries an immediate value of no more than 4 bytes. Therefore, the immediate value can be represented by a sequence number or other ordered characters according to preset rules, and this specification does not impose any restrictions on this.
[0047] The following example uses immediate value notification events to implement data writing, combined with... Figure 3 The technical solutions related to the above embodiments in this application are described in detail. Figure 3 This is a schematic diagram illustrating a data writing method in an exemplary embodiment, such as... Figure 3 As shown, the solution may include the following steps:
[0048] S301, send the first write command containing the target content and the checksum.
[0049] S302, send a second write command containing the target pointer and an immediate value.
[0050] S303, send read command.
[0051] In one embodiment, suppose that a node data "Hello, world!" in a linked list A exists on the remote terminal and needs to be written to the address segment [10,30] of the host memory of the local terminal. Simultaneously, other node data from linked list A has already been successfully written to the address segment [0,10] of the host memory, and the node corresponding to the aforementioned node data "Hello, world!" is a subsequent node to the node corresponding to the aforementioned other node data. Then, the remote terminal can continuously issue three sets of RDMA operation instructions to the local terminal, namely the first write instruction, the second write instruction, and the read instruction. The first write instruction can be implemented using the "write" operation in RDMA technology, instructing the local terminal to write the node data "Hello, world!" and the corresponding CRC code as the target content and checksum, respectively, into the address segment [10,30] of the host memory. The second write instruction can be implemented using the "write imm" operation in RDMA technology, instructing the local terminal to write the target pointer corresponding to address segment [10,30] into address segment [100,200] of the host memory, and simultaneously instructing the local terminal to store an immediate value "2" at a specified address in the host memory. The read instruction can be implemented using the "read" operation in RDMA technology, wherein the read instruction does not carry any actual data. After the write operations corresponding to the first write instruction and the second write instruction are confirmed to be completed, the RDMA device of the local terminal can trigger an immediate value notification event for the host to execute S305, wherein the immediate value notification event carries the aforementioned immediate value "2".
[0052] S304 returns a status message indicating that the read was successful.
[0053] In one embodiment, the above-mentioned read instruction can ensure that the target content and the above-mentioned check value are written into the address segment [10,30], and the above-mentioned target pointer is also written into the address segment [100,200] of the host memory, and the status information can be an empty string, so that the other terminal can determine that the above-mentioned node data "Hello, world!", CRC code and target pointer have been written into the host memory.
[0054] S305, Maintain the visibility of the target content.
[0055] In one embodiment, when the CPU or other data processing-enabled device on the host receives the aforementioned immediate value notification event, it can determine that the local terminal has completed the write operation. In other words, the CPU or other data processing-enabled device can determine the integrity of the node data without using the aforementioned checksum, thereby reducing additional resource consumption. Then, the host can obtain the node data "Hello, world!" in the host memory through the aforementioned target pointer, and determine, based on the aforementioned immediate value "2", that the node corresponding to the node data "Hello, world!" is the successor node to the node corresponding to the other node data (assuming the immediate value corresponding to the other node data is "1"), so that the node data "Hello, world!" is visible to the user of the local terminal in the following dataset. Those skilled in the art will understand that this step is performed after the other terminal has determined that the target data has been written to the host memory, so the processing efficiency of the CPU is not a primary concern.
[0056] In another embodiment, the RDMA device of the local terminal receives a transmission instruction for target data initiated by the remote terminal based on the RDMA link. This transmission instruction causes the RDMA device to trigger an instruction notification event for the host. This instruction notification event is acquired by the host of the local terminal after the write operation is completed. Due to the characteristics of the RDMA protocol, the transmission instruction can carry data of any length; that is, the target pointer information can be directly sent to the host of the local terminal through the instruction notification event.
[0057] The following example uses command notification events to implement data writing, combined with... Figure 4 The technical solutions related to the above embodiments in this application are described in detail. Figure 4 This is a schematic diagram illustrating another data writing method as shown in an exemplary embodiment, such as... Figure 4 As shown, the solution may include the following steps:
[0058] S401, send the first write command containing the target content and the checksum.
[0059] S402, send a second write command containing the target pointer.
[0060] S403, send read command.
[0061] S404, Sending a communication instruction.
[0062] In one embodiment, suppose that a node data "Hello, world!" in a linked list A exists on the remote terminal and needs to be written to address segment [10,30] of the host memory of the local terminal. Simultaneously, other node data in linked list A has already been successfully written to address segment [0,10] of the host memory, and the node corresponding to the aforementioned node data "Hello, world!" is a subsequent node to the node corresponding to the aforementioned other node data. Then, the remote terminal can continuously issue four sets of RDMA operation instructions to the local terminal, namely the first write instruction, the second write instruction, the read instruction, and the transmit instruction. The first write instruction can be implemented using the "write" operation in RDMA technology, instructing the local terminal to write the node data "Hello, world!" and the corresponding CRC code as the target content and checksum into address segment [10,30] of the host memory, respectively. The second write instruction can also be implemented using the "write" operation in RDMA technology, instructing the local terminal to write the target pointer corresponding to address segment [10,30] into address segment [100,200] of the host memory. The read instruction can be implemented using the "read" operation in RDMA technology, where the read instruction does not carry any actual data. The send instruction can be implemented using the "send" operation in RDMA technology, instructing the local terminal's RDMA device to send the target pointer to the host in the form of the aforementioned instruction notification event. Since the send instruction is executed later than the read instruction, when the send instruction is sent to the local terminal, it can be determined that the write operations corresponding to the first and second write instructions have been completed.
[0063] S405 returns a status message indicating that the read was successful.
[0064] S406, Maintain the visibility of target content.
[0065] The above two steps are basically the same as S304-S305 above, and will not be repeated in this manual.
[0066] In fact, the host of this terminal maintains a dataset to keep track of the target data being written. The aforementioned target pointer can be used to associate the contents of the first memory segment with the dataset, allowing the user to query the target data through the dataset. In other words, the dataset determines whether the target data is visible to the user.
[0067] In one embodiment, upon determining that the write operation has been completed, the host can update the visibility of the dataset to make the target data visible on its local terminal. The dataset can be represented as a linked list structure, a hash structure, or an append-only log structure, etc., with "content + pointer," depending on actual needs; this specification does not impose any limitations on this. Taking a linked list structure as an example, the target pointer is used to associate the content of the first memory segment with the original tail node of the linked list structure. Therefore, updating the visibility of the dataset is equivalent to making the host recognize the content of the first memory segment as the new tail node of the linked list structure.
[0068] In addition, the above-mentioned check value can not only determine whether there is data loss during the write operation on the local terminal, but also correctly recover data when abnormal conditions occur on the local terminal.
[0069] In one embodiment, after the local terminal experiences a crash or power failure and recovers, the host can verify the target content written in the first memory segment based on the checksum already written in the first memory segment. This crash occurs before the local terminal's RDMA device responds to the read command. If the verification is successful, the host can determine that the write operation was successful and continue with the aforementioned dataset operations. If the verification fails, the host can delete the contents of the first and second memory segments to return to the data state after receiving the write command.
[0070] As can be seen from the above embodiments, the data writing method in this specification, by introducing data verification technology, ensures that the content and pointer of any data do not need to follow a specific writing order during the writing process to the other end of the terminal. This improves the flexibility of the writing operation and reduces the time wasted by sending a read command for each data write in related technologies, thus improving data writing efficiency. Furthermore, by utilizing the immediate values and command transmission characteristics of RDMA, the resource overhead of the host for data verification is reduced, while ensuring that the local terminal can recover data after an anomaly, improving the availability of the local terminal.
[0071] Figure 5 This is a schematic structural diagram of an electronic device according to an exemplary embodiment. Please refer to... Figure 5At the hardware level, the electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other necessary hardware. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it, forming a data-writable device at the logical level. Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to individual logic units, but can also be hardware or logic devices.
[0072] Corresponding to the embodiments of the aforementioned data writing method, this specification also provides embodiments of a data writing device.
[0073] Please refer to Figure 6 , Figure 6 This is a schematic diagram illustrating the structure of a data writing device in an exemplary embodiment. Figure 6 As shown, in the software implementation, the data writing device is applied to a local terminal, which includes a host and a Remote Direct Data Access (RDMA) device, and may include:
[0074] The write instruction receiving unit 601 is used for the RDMA device to receive a write instruction for target data initiated by the peer terminal based on the RDMA link. The target data includes target content, a check value corresponding to the target content, and a target pointer corresponding to the target content.
[0075] The target data writing unit 602 is used by the RDMA device to perform a write operation according to the write instruction. The write operation is used to write the target content and the check value into a first memory segment of the host memory, and to write the target pointer into a second memory segment of the host memory.
[0076] The status information return unit 603 is used by the RDMA device to return status information indicating successful reading to the other terminal in response to a read command initiated by the other terminal based on the RDMA link.
[0077] Optionally, the write instruction includes:
[0078] A first write instruction is used to instruct the RDMA device to write the target content and the check value into the first memory segment;
[0079] The second write instruction is used to instruct the RDMA device to write the target pointer into the second memory segment.
[0080] Optionally, the write instruction carries an immediate value, which is used to cause the RDMA device to trigger an immediate value notification event for the host, and the immediate value notification event is acquired by the host when the write operation is completed.
[0081] Optionally, the device further includes:
[0082] The instruction receiving unit 604 is used for the RDMA device to receive the instruction for transmitting the target data initiated by the counterpart terminal based on the RDMA link. The instruction is used to cause the RDMA device to trigger an instruction notification event for the host. The instruction notification event is acquired by the host when the write operation is completed.
[0083] Optionally, the target pointer is used to associate the contents of the first memory segment with the dataset maintained by the host; the apparatus further includes:
[0084] The dataset update unit 605 is used by the host to update the visibility range of the dataset after determining that the write operation has been completed, so that the target data is visible in the local terminal.
[0085] Optionally, the dataset is a linked list structure, and the target pointer is used to associate the contents of the first memory segment with the original tail node of the linked list structure; the dataset update unit 605 is specifically used for:
[0086] The host identifies the contents of the first memory segment as the new tail node of the linked list structure.
[0087] Optionally, the device further includes:
[0088] An anomaly recovery unit 606 is used to, after the local terminal experiences an anomaly and recovers, verify the target content written in the first memory segment based on the verification value already written in the first memory segment, wherein the anomaly occurs before the RDMA device responds to the read command;
[0089] If the verification is successful, the host determines that the write operation was successfully executed;
[0090] If the verification fails, the host deletes the contents of the first memory segment and the second memory segment.
[0091] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0092] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this specification according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0093] The embodiments of the subject matter and functional operation described in this specification can be implemented in the following ways: digital electronic circuits, tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or combinations thereof. Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible, non-transitory program carrier for execution by a data processing apparatus or for controlling the operation of a data processing apparatus. Alternatively or additionally, the program instructions may be encoded on artificially generated propagation signals, such as machine-generated electrical, optical, or electromagnetic signals, which are generated to encode information and transmit it to a suitable receiving device for execution by the data processing apparatus. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or combinations thereof.
[0094] The processing and logic flow described in this specification can be executed by one or more programmable computers that execute one or more computer programs to perform corresponding functions by operating on input data and generating output. The processing and logic flow can also be executed by dedicated logic circuitry—such as FPGAs (Field-Programmable Gate Arrays) or ASICs (Application-Specific Integrated Circuits), and the device can also be implemented as dedicated logic circuitry.
[0095] Suitable computers for executing computer programs include, for example, general-purpose and / or special-purpose microprocessors, or any other type of central processing unit. Typically, the central processing unit receives instructions and data from read-only memory and / or random access memory. The basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Typically, a computer will also include one or more mass storage devices for storing data, such as disks, magneto-optical disks, or optical disks, or the computer will be operatively coupled to such mass storage devices to receive data from or transfer data to them, or both. However, a computer is not required to have such devices. Furthermore, a computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device such as a universal serial bus (USB) flash drive, to name a few.
[0096] Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, such as semiconductor memory devices (e.g., EPROM, EEPROM, and flash memory devices), magnetic disks (e.g., internal hard disks or removable disks), magneto-optical disks, and CD-ROM and DVD-ROM disks. Processors and memory may be supplemented by or incorporated into dedicated logic circuitry.
[0097] While this specification contains numerous specific implementation details, these should not be construed as limiting the scope of any invention or the scope of the claims, but rather are primarily intended to describe features of specific embodiments of a particular invention. Certain features described in the various embodiments herein may also be implemented in combination in a single embodiment. Conversely, various features described in a single embodiment may also be implemented separately in various embodiments or in any suitable sub-combination. Furthermore, while features may function in certain combinations as described above and even initially claimed in this way, one or more features from a claimed combination may be removed from that combination in some cases, and a claimed combination may refer to a sub-combination or a variation thereof.
[0098] Similarly, although the operations are depicted in a specific order in the accompanying drawings, this should not be construed as requiring these operations to be performed in the specific order shown or sequentially, or requiring all illustrated operations to be performed to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
[0099] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims may be performed in a different order and still achieve the desired result. Furthermore, the processes depicted in the drawings are not necessarily shown in a specific order or sequence to achieve the desired result. In some implementations, multitasking and parallel processing may be advantageous.
[0100] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
Claims
1. A data writing method, characterized in that, Applied to a local terminal, the local terminal comprising a host and a Remote Direct Data Access (RDMA) device, the method includes: The RDMA device receives a write instruction for target data initiated by the peer terminal based on the RDMA link. The target data includes target content, a check value corresponding to the target content, and a target pointer corresponding to the target content. The RDMA device executes a write operation according to the write instruction. The write operation is used to write the target content and the check value into a first memory segment of the host memory, and to write the target pointer into a second memory segment of the host memory. In response to a read command initiated by the peer terminal based on the RDMA link, the RDMA device returns status information indicating a successful read to the peer terminal. The method further includes: After the local terminal experiences an anomaly and recovers, the host verifies the target content written in the first memory segment based on the verification value already written in the first memory segment, wherein the anomaly occurs before the RDMA device responds to the read command; If the verification is successful, the host determines that the write operation was successfully executed; If the verification fails, the host deletes the contents of the first memory segment and the second memory segment.
2. The method according to claim 1, characterized in that, The write instruction includes: A first write instruction is used to instruct the RDMA device to write the target content and the check value into the first memory segment; The second write instruction is used to instruct the RDMA device to write the target pointer into the second memory segment.
3. The method according to claim 1, characterized in that, The write instruction carries an immediate value, which is used to cause the RDMA device to trigger an immediate value notification event for the host. The immediate value notification event is acquired by the host when the write operation is completed.
4. The method according to claim 1, characterized in that, Also includes: The RDMA device receives a transmission instruction for the target data initiated by the counterpart terminal based on the RDMA link. The transmission instruction is used to cause the RDMA device to trigger an instruction notification event for the host. The instruction notification event is acquired by the host when the write operation is completed.
5. The method according to claim 1, characterized in that, The target pointer is used to associate the contents of the first memory segment with the dataset maintained by the host; the method further includes: Upon determining that the write operation has been completed, the host updates the visibility of the dataset to make the target data visible on the local terminal.
6. The method according to claim 5, characterized in that, The dataset is a linked list structure, and the target pointer is used to associate the contents of the first memory segment with the original tail node of the linked list structure; The host updates the visibility of the dataset, including: The host identifies the contents of the first memory segment as the new tail node of the linked list structure.
7. A data writing device, characterized in that, Applied to a local terminal, the local terminal comprising a host and a Remote Direct Data Access (RDMA) device, the device comprising: The write instruction receiving unit is used for the RDMA device to receive a write instruction for target data initiated by the peer terminal based on the RDMA link. The target data includes target content, a check value corresponding to the target content, and a target pointer corresponding to the target content. The target data writing unit is used by the RDMA device to perform a write operation according to the write instruction. The write operation is used to write the target content and the check value into a first memory segment of the host memory, and to write the target pointer into a second memory segment of the host memory. A status information return unit is used by the RDMA device to return status information indicating successful reading to the other terminal in response to a read command initiated by the other terminal based on the RDMA link. The device further includes: An anomaly recovery unit is used to, after the local terminal experiences an anomaly and recovers, have the host verify the target content written in the first memory segment based on the verification value already written in the first memory segment, wherein the anomaly occurs before the RDMA device responds to the read command; If the verification is successful, the host determines that the write operation was successfully executed; If the verification fails, the host deletes the contents of the first memory segment and the second memory segment.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 6.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Data transmission method, network equipment, network system and chip
CN112788079A