Disclosure of Invention
In view of the foregoing, it is desirable to provide a memory access method, apparatus, computer device, computer readable storage medium, and computer program product that can improve the efficiency of memory access.
In a first aspect, the present application provides a memory access method. The method comprises the following steps:
sending a first memory access request to a response end, wherein the first memory access request carries a request serial number;
receiving a first memory access response corresponding to the request sequence number returned by the response end based on the first memory access request, wherein the first memory access response carries a response sequence number;
determining a missing sequence number of the first memory access request according to the request sequence number and the response sequence number;
And sending a second memory access request carrying the missing sequence number to the response end, wherein the second memory access request is used for indicating the response end to return a second memory access response corresponding to the missing sequence number.
In one embodiment, the determining the missing sequence number of the first memory access request according to the request sequence number and the response sequence number includes:
Updating the state of the request sequence number according to the response sequence number to obtain an updated state of the request sequence number;
And selecting the sequence number in an unacknowledged state from the request sequence numbers according to the updated state, and taking the sequence number as the missing sequence number.
In one embodiment, the selecting, according to the updated state, the sequence number in the unacknowledged state from the request sequence numbers as the missing sequence number includes:
Selecting a first unacknowledged sequence number which is smaller than the response sequence number and in the unacknowledged state from the request sequence number according to the updated state;
And determining the first unacknowledged serial number as the missing serial number.
In one embodiment, the selecting, according to the updated state, the sequence number in the unacknowledged state from the request sequence numbers as the missing sequence number includes:
Acquiring current time, and determining a time difference value between the current time and the sending time of the first memory access request;
Under the condition that the time difference value is larger than a preset time threshold value, selecting a second unacknowledged serial number in the unacknowledged state from the request serial numbers according to the updated state;
And determining the second unacknowledged serial number as the missing serial number.
In one embodiment, after sending the second memory access request carrying the missing sequence number to the response end, the method further includes:
Receiving a second memory access response returned by the response end based on the second memory access request, wherein the second memory access response carries a secondary response serial number;
And determining a response result of the first memory access request according to the missing sequence number and the secondary response sequence number.
In one embodiment, before sending the first memory access request to the responding end, the method further includes:
Generating the request serial number;
and adding the request serial number to an initial memory access request to obtain the first memory access request carrying the request serial number.
In a second aspect, the present application further provides a memory access device. The device comprises:
The system comprises a first sending module, a response end, a first receiving module and a second sending module, wherein the first sending module is used for sending a first memory access request to the response end;
The response receiving module is used for receiving a first memory access response corresponding to the request sequence number, which is returned by the response end based on the first memory access request, wherein the first memory access response carries a response sequence number;
The sequence determining module is used for determining the missing sequence number of the first memory access request according to the request sequence number and the response sequence number;
The second sending module is used for sending a second memory access request carrying the missing sequence number to the response end, and the second memory access request is used for indicating the response end to return a second memory access response corresponding to the missing sequence number.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
sending a first memory access request to a response end, wherein the first memory access request carries a request serial number;
receiving a first memory access response corresponding to the request sequence number returned by the response end based on the first memory access request, wherein the first memory access response carries a response sequence number;
determining a missing sequence number of the first memory access request according to the request sequence number and the response sequence number;
And sending a second memory access request carrying the missing sequence number to the response end, wherein the second memory access request is used for indicating the response end to return a second memory access response corresponding to the missing sequence number.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
sending a first memory access request to a response end, wherein the first memory access request carries a request serial number;
receiving a first memory access response corresponding to the request sequence number returned by the response end based on the first memory access request, wherein the first memory access response carries a response sequence number;
determining a missing sequence number of the first memory access request according to the request sequence number and the response sequence number;
And sending a second memory access request carrying the missing sequence number to the response end, wherein the second memory access request is used for indicating the response end to return a second memory access response corresponding to the missing sequence number.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
sending a first memory access request to a response end, wherein the first memory access request carries a request serial number;
receiving a first memory access response corresponding to the request sequence number returned by the response end based on the first memory access request, wherein the first memory access response carries a response sequence number;
determining a missing sequence number of the first memory access request according to the request sequence number and the response sequence number;
And sending a second memory access request carrying the missing sequence number to the response end, wherein the second memory access request is used for indicating the response end to return a second memory access response corresponding to the missing sequence number.
The memory access method, the memory access device, the computer equipment, the computer readable storage medium and the computer program product are used for sending a first memory access request to a response end, wherein the first memory access request carries a request sequence number, receiving a first memory access response which is returned by the response end based on the first memory access request and corresponds to the request sequence number, the first memory access response carries a response sequence number, determining a missing sequence number of the first memory access request according to the request sequence number and the response sequence number, and sending a second memory access request which carries the missing sequence number to the response end, wherein the second memory access request is used for indicating the response end to return a second memory access response which corresponds to the missing sequence number. According to the scheme, the missing sequence number is determined according to the response sequence number and the request sequence number carried by the first memory access response, and the second memory access request carrying the missing sequence number is sent immediately, so that selective retransmission can be performed quickly when the response packet loss is detected, retransmission of all requests after timeout is not needed, unnecessary retransmission of data packets can be reduced, network bandwidth is saved, and memory access efficiency is improved.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are both information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to meet the related regulations.
In an exemplary embodiment, as shown in fig. 1, a memory access method is provided, where the method is applied to a transmitting end (may also be an access end or a terminal) to illustrate, and it is understood that the method may also be applied to a server, and may also be applied to a system including a terminal and a server, and implemented through interaction between the terminal and the server. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and the like; the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing service. In this embodiment, the method includes the steps of:
Step S101, a first memory access request is sent to a response end, wherein the first memory access request carries a request serial number.
Step S102, a first memory access response corresponding to the request sequence number and returned by the response terminal based on the first memory access request is received, wherein the first memory access response carries a response sequence number.
Step S103, determining the missing sequence number of the first memory access request according to the request sequence number and the response sequence number.
Step S104, a second memory access request carrying the missing sequence number is sent to the response end, wherein the second memory access request is used for indicating the response end to return a second memory access response corresponding to the missing sequence number.
Wherein the memory access request may be a request for accessing another computer's memory, e.g., the memory access request may be RDMA READ REQUEST (RDMA READ request), wherein RDMA (Remote Direct Memory Access) is remote direct memory access, RDMA READ is an access type of RDMA, allowing one computer to directly READ access to another computer's memory.
The responding end may be a computer that receives the memory access request and processes the request, for example, the responding end may be a computer that receives RDMA READ REQUEST and returns RDMA READ RESPONSE (RDMA read response).
The request sequence number may be a number for identifying the sequence of the data packets, for example, the request sequence number may be PSN (Packet Sequence Number ).
The memory access response may be response data returned by the responding end after processing the memory access request, for example, the memory access response may be RDMA READ RESPONSE (RDMA read response).
The response sequence number may be a number carried by the memory access response and used to identify the sequence of response data, for example, the response sequence number may be a PSN (Packet Sequence Number ).
The missing sequence number may be a sequence number that is not acknowledged in the received memory access response, for example, the missing sequence number may be an unacknowledged PSN interval that is smaller than and adjacent to the received response sequence number.
Optionally, the sending end sends a first memory access request to the responding end, where the first memory access request is RDMA READ REQUEST (RDMA read request), and the RDMA READ REQUEST carries a PSN (Packet Sequence Number ) as a request sequence number. The sending end receives a first memory access response returned by the responding end, wherein the first memory access response is RDMA READ RESPONSE (RDMA read response), and the RDMA READ RESPONSE carries a corresponding PSN as a response serial number. The sending end compares the request sequence number with the response sequence number to determine whether a PSN interval which is smaller than the received response sequence number and adjacent to the received response sequence number and is not confirmed exists, wherein the PSN interval is the missing sequence number. The sending end then sends a second memory access request carrying the missing sequence number to the responding end, wherein the second memory access request is RDMA READ REQUEST containing the missing sequence number and is used for indicating the responding end to return a second memory access response corresponding to the missing sequence number.
For example, the sender first sends RDMA READ REQUEST containing PSNs 0-5 to the responder. When the transmitting end receives RDMA READ RESPONSE with PSN of 3 returned by the responding end, the transmitting end finds that there is an unacknowledged PSN interval (namely, an interval with PSN of 0-2) which is smaller than the PSN of 3 and adjacent to the PSN, which indicates that RDMA READ RESPONSE with PSN of 0-2 has lost packets. At this time, the transmitting end immediately transmits RDMA READ REQUEST containing PSN of 0-2 to the responding end without waiting for retransmission of all RDMA READ REQUEST after timeout, thereby realizing selective retransmission and rapid retransmission, improving communication performance and saving network bandwidth.
The memory access method comprises the steps of sending a first memory access request to a response end, wherein the first memory access request carries a request sequence number, receiving a first memory access response corresponding to the request sequence number, returned by the response end based on the first memory access request, wherein the first memory access response carries a response sequence number, determining a missing sequence number of the first memory access request according to the request sequence number and the response sequence number, sending a second memory access request carrying the missing sequence number to the response end, and indicating the response end to return a second memory access response corresponding to the missing sequence number. According to the scheme, the missing sequence number is determined according to the response sequence number and the request sequence number carried by the first memory access response, and the second memory access request carrying the missing sequence number is sent immediately, so that selective retransmission can be performed quickly when the response packet loss is detected, retransmission of all requests after timeout is not needed, unnecessary retransmission of data packets can be reduced, network bandwidth is saved, and memory access efficiency is improved.
In an exemplary embodiment, the missing sequence number of the first memory access request is determined according to the request sequence number and the response sequence number, and specifically comprises the steps of updating the state of the request sequence number according to the response sequence number to obtain an updated state of the request sequence number, and selecting the sequence number in an unacknowledged state from the request sequence number according to the updated state to serve as the missing sequence number.
The status may be an identification for identifying whether the serial number has been confirmed, for example, the status may be a confirmed status or an unconfirmed status.
The updated state may be a state in which the acknowledgement state of the request sequence number is updated according to the received response sequence number, for example, the updated state may be a state in which the PSN (Packet Sequence Number ) of RDMA READ RESPONSE (RDMA read response) has been received is marked as acknowledged, and the PSN of RDMA READ RESPONSE has not been received is marked as unacknowledged.
The unacknowledged state may be a state indicating that the corresponding response has not been received, for example, the unacknowledged state may be a state indicating that the PSN of the corresponding RDMA READ RESPONSE has not been received.
Optionally, when receiving RDMA READ RESPONSE (RDMA read response), the sender updates the acknowledgement status of the PSN (Packet Sequence Number ) in the previously sent RDMA READ REQUEST (RDMA read request) according to the response sequence number carried by the RDMA READ RESPONSE. Specifically, the transmitting end marks the PSN that has received RDMA READ RESPONSE as a confirmed state, then checks whether there is an unconfirmed PSN section that is smaller than and adjacent to the confirmed PSN, and if there is such an unconfirmed PSN section, takes the unconfirmed PSN section as a missing sequence number.
For example, after the sender sends RDMA READ REQUEST containing PSN of 0-5, if RDMA READ RESPONSE with PSN of 3 is received, the sender updates the request sequence number with PSN of 3 to the acknowledged state. Then, the transmitting end checks to find that the section with the PSN of 0-2 is in an unacknowledged state, and the section is smaller than and adjacent to the PSN with the PSN of 3, so that the section with the PSN of 0-2 is determined as a missing sequence number, and immediately initiates a retransmission request for the missing sequence number, without waiting for timeout to retransmit all sequence numbers.
According to the technical scheme provided by the embodiment, the state of the request sequence number is updated according to the received response sequence number, and the sequence number in the unacknowledged state is selected as the missing sequence number, so that the response data packets of which sequence numbers are accurately identified to be lost are facilitated, the targeted selective retransmission is facilitated, unnecessary retransmission of the successfully transmitted data packets is avoided, and the efficiency of RDMA communication is improved.
In one exemplary embodiment, the sequence number in the unacknowledged state is selected from the request sequence numbers as the missing sequence number according to the updated state, and specifically comprises the steps of selecting a first unacknowledged sequence number which is smaller than the response sequence number and in the unacknowledged state from the request sequence numbers according to the updated state, and determining the first unacknowledged sequence number as the missing sequence number.
The first unacknowledged sequence number may be a sequence number smaller than the response sequence number and in an unacknowledged state in the request sequence number, for example, the first unacknowledged sequence number may be a PSN in which, among PSNs (Packet Sequence Number, packet sequence numbers) of RDMA READ REQUEST (RDMA read request) that have been sent, the value is smaller than the PSN of RDMA READ RESPONSE (RDMA read response) that has been received, and the PSN of the corresponding response has not been received.
Optionally, after receiving RDMA READ RESPONSE (RDMA read response), the sender checks all request sequence numbers smaller than the PSN (Packet Sequence Number ) currently received RDMA READ RESPONSE according to the updated request sequence number status. The sending end screens out the serial numbers in the unacknowledged state from the serial numbers, confirms whether the unacknowledged serial numbers are adjacent to the received response serial numbers, and if so, determines the unacknowledged serial numbers as missing serial numbers.
For example, after the sender sends RDMA READ REQUEST (RDMA read request) with PSN 0-5, if RDMA READ RESPONSE with PSN 3 is received, the sender checks the status of all request sequence numbers smaller than PSN 3. The sender finds that the sequence numbers with PSN of 0-2 are in unacknowledged state, and the sequence numbers are adjacent to the confirmed PSN with PSN of 3, so the sequence numbers with PSN of 0-2 are determined as missing sequence numbers. The method enables the sending end to accurately locate the lost response packet, thereby realizing targeted selective retransmission.
According to the technical scheme provided by the embodiment, the sequence number which is smaller than the current response sequence number and is in an unacknowledged state is selected from the request sequence numbers to serve as the missing sequence number, so that the position of the lost data packet adjacent to the received response can be accurately positioned, quick and accurate selective retransmission can be realized, full retransmission of all the sequence numbers is avoided, and the efficiency of RDMA communication is improved.
In an exemplary embodiment, the sequence number in the unacknowledged state is selected from the request sequence numbers according to the updated state and used as a missing sequence number, and the method specifically comprises the steps of obtaining the current time, determining a time difference value between the current time and the sending time of the first memory access request, selecting a second unacknowledged sequence number in the unacknowledged state from the request sequence numbers according to the updated state when the time difference value is larger than a preset time threshold value, and determining the second unacknowledged sequence number as the missing sequence number.
Wherein the current time may be the time of the current moment.
The transmission time may be a time when the sender transmits RDMA READ REQUEST (RDMA read request), for example, the transmission time may be a time point when the sender first transmits RDMA READ REQUEST including a specific PSN (Packet Sequence Number ).
The time difference value may be a time interval for determining whether timeout occurs.
The preset time threshold may be a time criterion for determining a timeout, for example, the preset time threshold may be a timeout retransmission time set in RDMA communication.
The second unacknowledged sequence number may be a sequence number in an unacknowledged state selected from the request sequence numbers under the condition of timeout, for example, the second unacknowledged sequence number may be a PSN that does not receive the corresponding RDMA READ RESPONSE after the timeout occurs.
Optionally, the sender records the sending time when sending RDMA READ REQUEST (RDMA read request), and obtains the current system time during the subsequent processing, and calculates the time difference from sending RDMA READ REQUEST to the current time. When the sender detects that the time difference exceeds the preset timeout threshold, the sender checks the status of all request sequence numbers, screens out the PSNs (Packet Sequence Number, packet sequence numbers) still in unacknowledged status, and determines the unacknowledged PSNs (second unacknowledged sequence numbers) as missing sequence numbers needing to be retransmitted.
For example, after the sender sends RDMA READ REQUEST including PSN of 0-5, if the sender finds that the sequence number with PSN of 2-4 is still in unacknowledged state after a preset timeout period (for example, 100 ms), the sender determines the sequence number with PSN of 2-4 as the missing sequence number. The selective retransmission mechanism based on the timeout enables the sender to retransmit only requests which do not receive the response under the condition of serious network congestion or packet loss, rather than retransmitting all serial numbers like the traditional mechanism, thereby improving the efficiency of RDMA communication.
According to the technical scheme provided by the embodiment, the time difference between the current time and the sending time of the memory access request is calculated, and the sequence number in the unacknowledged state is selected as the missing sequence number when the preset time threshold is exceeded, so that the problem sequence number can be found in time when the response is not received for a long time due to network congestion or transmission abnormality, selective retransmission based on a timeout mechanism can be realized, full retransmission of all sequence numbers is avoided, and the efficiency of RDMA communication is improved.
In an exemplary embodiment, after sending the second memory access request with the missing sequence number to the responding end, the method further comprises the following steps of receiving a second memory access response returned by the responding end based on the second memory access request, wherein the second memory access response carries a secondary response sequence number, and determining a response result of the first memory access request according to the missing sequence number and the secondary response sequence number.
The second memory access request may be RDMA READ REQUEST (RDMA read request) that the sender resends for the missing sequence number, for example, the second memory access request may be a retransmission request including the PSN (Packet Sequence Number ) that was lost before.
The second memory access response may be RDMA READ RESPONSE (RDMA read response) returned by the receiving end (i.e., the responding end) for the second memory access request, for example, the second memory access response may be a response packet of the receiving end for the retransmission request.
The secondary response sequence number may be a PSN carried by the second memory access response, for example, the secondary response sequence number may be a packet sequence number included in the retransmission response packet.
The response result may be an integrity confirmation result of the first memory access request, for example, the response result may be a result of comparing the missing sequence number and the secondary response sequence number to determine whether all requests have been responded.
Optionally, after sending RDMA READ REQUEST (RDMA read request) containing the missing sequence number, the sender waits for the receiver to return the corresponding RDMA READ RESPONSE (RDMA read response). When the sending end receives RDMA READ RESPONSE, PSN (Packet Sequence Number ) carried in the response packet is extracted as a secondary response sequence number, the secondary response sequence number is compared with the missing sequence number recorded before, and whether the retransmission request is correctly responded is judged through the comparison result, so that the integrity state of the first memory access request is determined.
For example, after the sender sends the retransmission RDMA READ REQUEST with PSN 2-4, the receiver returns RDMA READ RESPONSE with the corresponding PSN. After receiving these response packets, the sender checks whether the PSN in the response packet matches exactly with the missing sequence number 2-4 recorded previously. And if partial missing sequence numbers still do not receive the corresponding responses, a new round of selective retransmission is needed.
According to the technical scheme provided by the embodiment, the second memory access response returned by the response end is received, and the secondary response sequence number carried by the second memory access response is compared with the missing sequence number, so that whether the retransmission request is completely responded or not is judged accurately, the integrity state of RDMA communication is confirmed in time, unnecessary repeated retransmission is avoided, and the efficiency of RDMA communication is improved.
In an exemplary embodiment, before sending the first memory access request to the responding end, the method further comprises the following steps of generating a request serial number, and adding the request serial number to the initial memory access request to obtain the first memory access request carrying the request serial number.
The initial memory access request may be the original RDMA READ REQUEST (RDMA read request) to which the PSN (Packet Sequence Number ) has not been added, for example, the initial memory access request may be an RDMA read request packet that the sender prepares to send but has not yet been added with the sequence number identification.
Wherein generating the request sequence number may be a process of creating a PSN for RDMA READ REQUEST to identify the order of the data packets, for example, generating the request sequence number may be assigning a unique sequence number to each request packet in a consecutive sequence of numbers such as 0-5.
The addition request sequence number may be a procedure of writing the generated PSN into the header of the initial memory access request, for example, the addition request sequence number may be a sequence number of 0-5 written into the header field of the corresponding RDMA READ REQUEST.
Optionally, the sender first generates a set of consecutive PSNs (Packet Sequence Number, packet sequence numbers) as request sequence numbers before preparing to send RDMA READ REQUEST (RDMA read request). Then, the sender sequentially adds the generated request sequence numbers into the header fields of the initial memory access request, so as to construct a complete first memory access request.
According to the technical scheme provided by the embodiment, the request sequence number is generated before the memory access request is sent and added to the initial memory access request, so that the unique identifier is distributed to each RDMA READ REQUEST, and the support for realizing selective retransmission is provided.
The memory access method provided by the application is described below by using an application example, and the application example is described by using the method to be applied to a transmitting end (also can be an access end or a terminal) for illustration.
RDMA (Remote Direct Memory Access), a technique that allows direct memory access between computer systems. RDMA READ (RDMA READ) an access mode of RDMA enables one computer system to directly READ memory data of another computer system. Go-Back-N (fallback N frame retransmission mechanism), a packet retransmission mechanism used by RDMA, when a packet loss is detected, it is necessary to retransmit all packets before this from the earliest loss location. PSN (Packet Sequence Number ), a number used to identify the order of transmission of the data packets.
RDMA technology is widely applied in the fields of high-performance storage, big data processing, artificial intelligence and the like. Among them, RDMA READ (RDMA READ) is an important function, and can implement direct memory READ between computer systems without participation of a processor, which is one of core characteristics of RDMA.
RDMA technology was originally applied to lossless network environments. In a lossless network, a link layer can ensure ordered transmission of data, and packet loss is rarely caused. RDMA thus employs a simplified packet loss retransmission mechanism, i.e., the Go-Back-N mechanism, which requires that all packets before retransmission begin from the earliest packet loss location when a packet loss occurs. Specifically, after the transmitting end issues RDMA READ REQUEST (RDMA read request), it is necessary to confirm the PSN included in the previously transmitted request by sequentially receiving RDMA READ RESPONSE (RDMA read response). When RDMA READ RESPONSE packet loss occurs, the transmitting end ignores all response packets received from the packet loss position, and retransmits all RDMA READ REQUEST after timeout, and the receiving end also needs to retransmit all RDMA READ RESPONSE. In lossy network environments (e.g., ethernet), such mechanisms not only result in wasted bandwidth, but also reduce communication efficiency and may even exacerbate network congestion conditions. Referring to fig. 2, a communication process between a transmitting end and a receiving end is shown. The specific communication flow is that firstly, a sending end sends out a reading request (0-5), and a receiving end returns a reading response 0 and a reading response 1 in sequence. A packet loss situation represented by x symbols occurs when the read response 2 is transmitted. Although the receiving end continues to transmit the read response 3, the read response 4, and the read response 5, none of these responses is processed by the transmitting end. After that, a timeout mark appears, the sender resends the read request (2-5), and the receiver then returns a read response 2, a read response 3, a read response 4 and a read response 5 in sequence. The whole communication process indicates the communication relationship between the transmitting end and the receiving end by an arrow.
The application example mainly comprises the following steps:
first, when receiving RDMA READ RESPONSE, the transmitting end confirms the corresponding PSN, and when finding that there is a section smaller than the PSN and adjacent to the unacknowledged PSN section, the transmitting end can immediately retransmit RDMA READ REQUEST corresponding to the PSN section.
Second, after the sending end times out, only retransmitting RDMA READ REQUEST corresponding to the unacknowledged PSN.
The application example realizes the selective retransmission and the rapid retransmission functions after RDMA READ RESPONSE packet loss on the premise of keeping compatibility with the existing protocol, thereby improving the network bandwidth utilization rate and the communication performance.
The application example specifically comprises the following steps:
step 1, the sender sends RDMA READ REQUEST first, and the initial state of PSN contained in the requests is unacknowledged.
Step 2, after receiving RDMA READ REQUEST, the receiving end returns RDMA READ RESPONSE carrying the corresponding PSNs in sequence according to the sequence of the PSNs in the request.
And 3, when receiving RDMA READ RESPONSE, the transmitting end confirms the PSN of the packet, and if the PSN is found to be smaller than the PSN and adjacent unacknowledged PSN intervals, the transmitting end indicates that the response packet corresponding to the intervals is lost, and immediately retransmits the request packet of the intervals.
And 4, after receiving the retransmission request, the receiving end processes the retransmission request according to the mode of the step 2.
And 5, if the sending end has an unacknowledged PSN after overtime, retransmitting the READ REQUEST only containing the unacknowledged PSN.
Referring to fig. 3, a communication process between a transmitting end and a receiving end is shown. The specific communication flow is that firstly, a sending end sends out a reading request (0-5), and a receiving end returns a reading response 0 and a reading response 1 in sequence. The data packet loss is represented by x symbols during transmission. The receiving end continues to send the read response 2 and the read response 3. At this time, the transmitting end issues a read request 2, and the receiving end then returns a read response 4 and a read response 5. Finally, the receiving end returns a reading response 2. The whole communication process indicates the communication relationship between the transmitting end and the receiving end by an arrow.
According to the technical scheme provided by the application example, the missing sequence number is determined according to the response sequence number and the request sequence number carried by the first memory access response, and the second memory access request carrying the missing sequence number is sent immediately, so that selective retransmission can be performed quickly when the response packet loss is detected, retransmission of all requests after timeout is not required, unnecessary retransmission of data packets can be reduced, network bandwidth is saved, and memory access efficiency is improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a memory access device for realizing the above related memory access method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the memory access device provided below may refer to the limitation of the memory access method described above, and will not be repeated here.
In an exemplary embodiment, as shown in fig. 4, there is provided a memory access device 400, which may include:
the first sending module 401 is configured to send a first memory access request to the response end, where the first memory access request carries a request sequence number;
The response receiving module 402 is configured to receive a first memory access response corresponding to the request sequence number, which is returned by the response end based on the first memory access request;
A sequence determining module 403, configured to determine a missing sequence number of the first memory access request according to the request sequence number and the response sequence number;
The second sending module 404 is configured to send a second memory access request carrying the missing sequence number to the response end, where the second memory access request is configured to instruct the response end to return a second memory access response corresponding to the missing sequence number.
In an exemplary embodiment, the sequence determining module 403 is further configured to update the status of the request sequence number according to the response sequence number, obtain an updated status of the request sequence number, and select, as the missing sequence number, the sequence number in the unacknowledged status from the request sequence number according to the updated status.
In an exemplary embodiment, the sequence determining module 403 is further configured to select, according to the updated status, a first unacknowledged sequence number that is smaller than the response sequence number and is in an unacknowledged state from the request sequence numbers, and determine the first unacknowledged sequence number as a missing sequence number.
In an exemplary embodiment, the sequence determining module 403 is further configured to obtain the current time, determine a time difference between the current time and the sending time of the first memory access request, select, according to the updated state, a second unacknowledged sequence number in an unacknowledged state from the request sequence numbers if the time difference is greater than a preset time threshold, and determine the second unacknowledged sequence number as the missing sequence number.
In an exemplary embodiment, the apparatus 400 further includes a result determining module, configured to receive a second memory access response returned by the responding end based on the second memory access request, where the second memory access response carries a secondary response sequence number, and determine a response result of the first memory access request according to the missing sequence number and the secondary response sequence number.
In an exemplary embodiment, the apparatus 400 further includes a sequence generation module configured to generate a request sequence number, and add the request sequence number to the initial memory access request to obtain a first memory access request carrying the request sequence number.
Each of the modules in the memory access device described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one exemplary embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 5. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a memory access method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 5 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an exemplary embodiment, a computer device is also provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method embodiments described above.
In an exemplary embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magneto-resistive random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (PHASE CHANGE Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.