CN-121814867-B - Data processing method, device, equipment and storage medium
Abstract
The application relates to a data processing method, a device, equipment and a storage medium, wherein the method comprises the steps of obtaining a current position to be read in a first message storage area corresponding to a target TCP, updating the next position of the current position to be read when the TCP message is read in the current position, determining a target first byte sequence number corresponding to the current position when the TCP message is not read in the current position, detecting whether the target TCP message exists in a second message storage area according to the target first byte sequence number, reading the target TCP message as the TCP message to be read in the current position if the target TCP message exists, updating the current position to be read, suspending the reading process until the TCP message corresponding to the current position is detected and the reading is completed if the target TCP message does not exist, updating the next position of the current position to be read, and re-executing the detection step based on the updated current position to be read.
Inventors
- GUO GUOFENG
- ZHANG JINHUI
- GUO KAIWEN
Assignees
- 深圳华云信息系统科技股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260309
Claims (20)
- 1. A data processing method, wherein the method is applied to an FPGA system, and comprises: Acquiring a current position to be read from a first message storage area corresponding to a target TCP; Detecting whether a TCP message is read at the current position; When the TCP message is read at the current position, updating the next position of the current position to be read; When the TCP message is not read at the current position, determining a target first byte sequence number corresponding to the current position according to a first byte sequence number corresponding to the last successfully read TCP message, detecting whether a target TCP message exists in a second message storage area corresponding to the target TCP according to the target first byte sequence number, if so, reading the target TCP message as the TCP message to be read at the current position, updating the current position to be read, and if not, suspending the reading process until the TCP message corresponding to the current position is detected and the reading is completed, and updating the next position of the current position to be read; and re-executing the detection step based on the updated current position to be read.
- 2. The method according to claim 1, wherein the detecting whether the target TCP packet exists in the second packet storage area corresponding to the target TCP according to the target first byte sequence number includes: Detecting whether an island table item corresponding to the target TCP has a target table item or not, wherein a starting first byte sequence number corresponding to the target table item is the target first byte sequence number or a corresponding sequence number interval covers the target first byte sequence number; When the target table entry exists in the island table entry, determining that the target TCP message exists in the second message storage area; And when the target table item does not exist in the island table item, determining that the target TCP message does not exist in the second message storage area.
- 3. The method according to claim 2, wherein when the end tail byte sequence number corresponding to the target entry is inconsistent with the tail byte sequence number corresponding to the target TCP packet, after reading the target TCP packet as the TCP packet to be read at the current position, the method further includes: Determining a first byte sequence corresponding to at least one TCP message after reading the target TCP message according to a first byte sequence corresponding to the target table item, a last byte sequence corresponding to the target TCP message and a fixed byte length corresponding to the TCP message; And reading at least one TCP message in the second message storage area according to the sequence of the first byte sequence number.
- 4. A method according to claim 3, wherein said updating the current location to be read comprises: Determining the target number of TCP messages which can be continuously read in the second message storage area according to the first byte sequence number sequence; And determining a target position corresponding to the last read TCP message according to the current position and the target number, and determining the next position of the target position as the current position.
- 5. The method according to claim 2, wherein when the ending tail byte sequence number corresponding to the target entry is the tail byte sequence number of the target TCP packet, the updating the current position to be read includes: And determining the next position of the current position in the first message storage area, and updating the next position to be the current position to be read.
- 6. The method according to claim 1, wherein the method further comprises: receiving a TCP message transmitted through a target TCP connection, wherein the TCP message comprises a current first byte sequence number; When the current first byte sequence number and the target first byte sequence number accord with a preset relation, storing the TCP message based on the first message storage area; And when the current first byte sequence number and the target first byte sequence number do not accord with a preset relation, storing the TCP message based on the second message storage area.
- 7. The method of claim 6, wherein the method further comprises: Acquiring the storage capacity corresponding to the first message storage area; determining a sequence number difference value according to the current first byte sequence number and the target first byte sequence number; when the difference value is smaller than the storage capacity, determining that the current first byte sequence number and the target first byte sequence number accord with a preset relation; and when the difference value is larger than or equal to the storage capacity, determining that the current first byte sequence number and the target first byte sequence number do not accord with a preset relation.
- 8. The method of claim 7, wherein the method further comprises: When the residual capacity of the first message storage area is larger than a first capacity threshold and the residual capacity of the second message storage area is smaller than a second capacity threshold, selecting a shared storage area in the first message storage area, and storing the received TCP message based on the shared storage area, wherein the shared storage area is a storage area shared by the first message storage area and the second message storage area.
- 9. The method according to claim 8, wherein storing the TCP message based on the first message storage area comprises: detecting whether the storage position of the TCP message is in a shared storage area or not according to the first byte sequence number corresponding to the TCP message; When the storage position of the TCP message is not in the shared storage area, or the storage position of the TCP message is in the shared storage area and the storage position has no stored TCP message, storing the TCP message to the storage position; When the storage position of the TCP message is in the shared storage area and the stored TCP message exists in the storage position, the TCP message stored in the storage position is transferred to other positions of the shared storage area, and the TCP message is stored in the storage position.
- 10. The method according to claim 8, wherein storing the TCP message based on the second message storage area comprises: and determining a last idle storage position in the shared storage area, and storing the TCP message based on the last storage position.
- 11. The method of claim 8, wherein the method further comprises: and when the residual capacity of the second message storage area is larger than a third capacity threshold, determining a TCP message to be transferred in the shared storage area, transferring the TCP message to be transferred to the second message storage area, and recovering the shared storage area to be the first message storage area.
- 12. The method of claim 8, wherein selecting a shared memory area from the first message memory area comprises: And determining the storage area with the preset length before the current position as a shared storage area in the first message storage area.
- 13. The method of claim 1, wherein prior to reading the TCP message at the current location, the method further comprises: Determining a theoretical first byte sequence number corresponding to the TCP message to be read according to the first byte sequence number corresponding to the last successfully read TCP message; And when the theoretical first byte sequence number is equal to the actual first byte sequence number corresponding to the TCP message read at the current position, the TCP message stored at the current position is read.
- 14. The method according to claim 2, wherein the method further comprises: When a first island table item and a second island table item exist in the island table items, merging the first island table item and the second island table item to obtain merging table items, determining a starting initial byte sequence number corresponding to the first island table item as a starting initial byte sequence number corresponding to the merging table item, and determining an ending tail byte sequence number corresponding to the second island table item as an ending tail byte sequence number corresponding to the merging table item, wherein the ending tail byte sequence number corresponding to the first island table item is identical to the starting initial byte sequence number corresponding to the second island table item.
- 15. The method according to claim 1, wherein the method further comprises: detecting whether the current position to be read is the last storage position of the first message storage area; And if the current position is the last storage position of the first message storage area, determining the first storage position of the first message storage area as the next position of the current position, and updating the next position to be read.
- 16. A data processing apparatus, the apparatus comprising: the acquisition unit is used for acquiring the current position to be read in the first message storage area corresponding to the target TCP; the detection unit is used for detecting whether the TCP message is read at the current position; An updating unit, configured to update a next position of the current position to a current position to be read when the TCP packet is read at the current position; The processing unit is used for determining a target first byte sequence number corresponding to the current position according to the first byte sequence number corresponding to the TCP message which is successfully read when the TCP message is not read at the current position, detecting whether a target TCP message exists or not according to the target first byte sequence number in a second message storage area corresponding to the target TCP, reading the target TCP message as the TCP message to be read at the current position and updating the current position to be read if the target TCP message exists, and suspending the reading flow until the TCP message corresponding to the current position is detected and reading is completed if the target TCP message does not exist, and updating the next position of the current position to be read; and the execution unit is used for re-executing the detection step based on the updated current position to be read.
- 17. The apparatus of claim 16, wherein the processing unit is configured to: detecting whether an island table item corresponding to the target TCP has a target table item or not, wherein a starting first byte sequence number corresponding to the target table item is the target first byte sequence number; When the target table entry exists in the island table entry, determining that the target TCP message exists in the second message storage area; And when the target table item does not exist in the island table item, determining that the target TCP message does not exist in the second message storage area.
- 18. The apparatus according to claim 17, wherein when the ending tail byte sequence number corresponding to the target table entry is inconsistent with the tail byte sequence number corresponding to the target TCP packet, after reading the target TCP packet as the TCP packet to be read at the current position, the apparatus further comprises a data reading unit, configured to: Determining a first byte sequence number corresponding to at least one TCP message after reading the target TCP message according to a first byte sequence number corresponding to the target table item, an end byte sequence number and a fixed byte length corresponding to the TCP message; And reading at least one TCP message in the second message storage area according to the sequence of the first byte sequence number.
- 19. A data processing device comprising at least one communication interface, at least one bus coupled to the at least one communication interface, at least one processor coupled to the at least one bus, and at least one memory coupled to the at least one bus, wherein the processor is configured to: Acquiring a current position to be read from a first message storage area corresponding to a target TCP; Detecting whether a TCP message is read at the current position; When the TCP message is read at the current position, updating the next position of the current position to be read; When the TCP message is not read at the current position, determining a target first byte sequence number corresponding to the current position according to a first byte sequence number corresponding to the last successfully read TCP message, detecting whether a target TCP message exists in a second message storage area corresponding to the target TCP according to the target first byte sequence number, if so, reading the target TCP message as the TCP message to be read at the current position, updating the current position to be read, and if not, suspending the reading process until the TCP message corresponding to the current position is detected and the reading is completed, and updating the next position of the current position to be read; and re-executing the detection step based on the updated current position to be read.
- 20. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the data processing method of any one of claims 1 to 15.
Description
Data processing method, device, equipment and storage medium Technical Field The present application relates to the field of computer technologies, and in particular, to a data processing method, apparatus, device, and storage medium. Background The TCP protocol is used as a reliable transmission protocol for connection, is a core base protocol for network data interaction, inevitably generates TCP abnormal message scenes such as message disorder, message loss and the like in the data transmission process, and is a key link for guaranteeing the reliable transmission of network data. At present, all received messages including normal ordered TCP messages and abnormal TCP messages such as disordered messages, missing messages and the like are uniformly submitted to an operating system kernel protocol stack, and all processing flows such as subsequent TCP message analysis, message sequence number state tracking, ordering recovery of disordered messages, waiting and matching of missing messages and the like are completed by software programs running on a CPU. Each TCP message processed by the software program needs to consume the calculation period of the CPU, and under the scene of massive traffic flow of the network, the calculation resource of the CPU is easy to be consumed by the analysis and processing flow of the TCP message, so that the processing pressure of the CPU is overlarge, and the whole traffic system is unstable. Disclosure of Invention The application provides a data processing method, a device, equipment and a storage medium, which can process data. In a first aspect, the present application provides a data processing method, where the method is applied to an FPGA system, and includes: Acquiring a current position to be read from a first message storage area corresponding to a target TCP; Detecting whether a TCP message is read at the current position; When the TCP message is read at the current position, updating the next position of the current position to be read; When the TCP message is not read at the current position, determining a target first byte sequence number corresponding to the current position according to a first byte sequence number corresponding to the last successfully read TCP message, detecting whether a target TCP message exists in a second message storage area corresponding to the target TCP according to the target first byte sequence number, if so, reading the target TCP message as the TCP message to be read at the current position, updating the current position to be read, and if not, suspending the reading process until the TCP message corresponding to the current position is detected and the reading is completed, and updating the next position of the current position to be read; and re-executing the detection step based on the updated current position to be read. Optionally, the detecting, in the second message storage area corresponding to the target TCP, whether the target TCP message exists according to the target first byte sequence number includes: Detecting whether an island table item corresponding to the target TCP has a target table item or not, wherein a starting first byte sequence number corresponding to the target table item is the target first byte sequence number or a corresponding sequence number interval covers the target first byte sequence number; When the target table entry exists in the island table entry, determining that the target TCP message exists in the second message storage area; And when the target table item does not exist in the island table item, determining that the target TCP message does not exist in the second message storage area. Optionally, when the tail byte sequence number of the end corresponding to the target table entry is inconsistent with the tail byte sequence number corresponding to the target TCP packet, after the target TCP packet is read as the TCP packet to be read at the current position, the method further includes: Determining a first byte sequence corresponding to at least one TCP message after reading the target TCP message according to a first byte sequence corresponding to the target table item, a last byte sequence corresponding to the target TCP message and a fixed byte length corresponding to the TCP message; And reading at least one TCP message in the second message storage area according to the sequence of the first byte sequence number. Optionally, the updating the current position to be read includes: Determining the target number of TCP messages which can be continuously read in the second message storage area according to the first byte sequence number sequence; And determining a target position corresponding to the last read TCP message according to the current position and the target number, and determining the next position of the target position as the current position. Optionally, when the tail byte sequence number of the end corresponding to the target table entry is the tail byte sequence num