Test methods, apparatus, electronic devices and storage media for data packet aggregation
By parsing and matching client data packets, identifying and replacing concatenated data packets, the problem of concatenated data packets in performance testing is solved, ensuring the integrity and accuracy of the test.
Patent Information
- Application Number
- CN202311617500.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2043-11-29
AI Technical Summary
During performance testing, the lack of clear boundaries in TCP data transmission led to packet fragmentation, affecting the execution of LoadRunner test scripts and preventing the completion of performance tests.
By parsing the target data packets sent by the client, obtaining the message content, and matching it with predefined cached messages, the data packet merging situation is determined. The content of the target cached message is then sent to the server to replace the client's message content, thus resolving the data packet merging problem in performance testing.
To ensure the integrity and continuity of performance testing, the problem of data packet fragmentation was solved by matching and replacing message content, thus guaranteeing the accuracy and completeness of the tests.
Smart Images

Figure CN117527640B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of system performance testing, and more particularly to a method, apparatus, electronic device, and storage medium for testing data packet aggregation. Background Technology
[0002] Currently, distributed applications that communicate via sockets are quite common. One party in the communication is the client, and the other is the server. The server continuously listens on the transport layer port specified by the socket and waits for connection requests from clients. Once the server receives a connection request from the client, both parties establish a communication connection based on the Transmission Control Protocol (TCP) to exchange data.
[0003] LoadRunner is a load testing tool for predicting system behavior and performance. It uses scripts to simulate client message requests and reception, monitoring the execution of server functions or business logic to analyze server load capacity. However, because TCP data is transmitted as a stream, and stream data has no clear start or end boundaries, data packet concatenation issues can easily occur. For example, simulating a client sending two messages ABC and DEF, but the server receiving ABCD, might cause errors in the test script, preventing the server performance test from being completed. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, and storage medium for testing data packet fragmentation, in order to solve the data packet fragmentation problem during performance testing.
[0005] To solve the above-mentioned technical problems, this application is implemented as follows:
[0006] In a first aspect, embodiments of this application provide a method for testing data packet merging, including:
[0007] The target data packet sent by the client is parsed to obtain the message content in the target data packet;
[0008] Based on the cached messages corresponding to multiple data packets of the client as defined in the predefined way, the target cached message corresponding to the target data packet is determined. If the message content cannot match the content of the target cached message, it is determined that the message content has data packet splicing, and the content of the target cached message is sent to the server.
[0009] Based on the response message from the server, the performance test results of the server are determined.
[0010] In one possible implementation, before parsing the target data packet sent by the client and obtaining the message content in the target data packet, the method further includes:
[0011] Establish a Socket connection with the client;
[0012] The content identification information corresponding to the target data packet sent by the client is received via Socket; wherein, the content identification information is used to indicate whether there is message content in the target data packet;
[0013] If it is determined that there is message content in the target data packet based on the content identification information, the target data packet is obtained.
[0014] In one possible implementation, receiving the content identification information corresponding to the target data packet sent by the client via a Socket includes:
[0015] The system receives the first four bytes of the target data packet sent by the client via a Socket, and determines the content identification information corresponding to the target data packet based on the message data.
[0016] In one possible implementation, when the message content cannot match the content of the target cached message, determining that the message content contains data fragmentation, and sending the content of the target cached message to the server, includes:
[0017] The message content is obtained into the target buffer, the message content in the target buffer is read byte by byte, and matched with the content of the target cached message to obtain the byte matching result;
[0018] If the message content is determined to have data packet fragmentation based on the byte matching result, the content of the target cached message is sent to the server.
[0019] In one possible implementation, sending the content of the target cached message to the server includes:
[0020] Invoke the business processing method of the server;
[0021] The business processing method is used to process the content of the target cached message, and the processed content of the target cached message is sent to the server.
[0022] In one possible implementation, after sending the content of the target cached message to the server, the method further includes:
[0023] Once it is determined that the reading of the bytes corresponding to the message content has ended, the target buffer is released.
[0024] Secondly, embodiments of this application provide a testing apparatus for data packet merging, comprising:
[0025] The content acquisition module is used to parse the target data packet sent by the client and obtain the message content in the target data packet;
[0026] The content matching module is used to determine the target cache message corresponding to the target data packet based on the cache messages corresponding to multiple data packets of the client in a predefined manner. If the content of the message cannot be matched with the content of the target cache message, it is determined that the message content has data packet splicing, and the content of the target cache message is sent to the server.
[0027] The result determination module is used to determine the performance test result of the server based on the response message from the server.
[0028] One possible implementation also includes:
[0029] A connection establishment module is used to establish a Socket connection with the client;
[0030] The information receiving module is used to receive content identification information corresponding to the target data packet sent by the client via a Socket; wherein, the content identification information is used to indicate whether there is message content in the target data packet;
[0031] The data packet acquisition module is used to acquire the target data packet when it is determined, based on the content identification information, that there is message content in the target data packet.
[0032] Thirdly, embodiments of this application provide an electronic device, which includes a processor and a memory. The memory stores programs or instructions that can run on the processor, and when the programs or instructions are executed by the processor, they implement the steps of the method described above.
[0033] Fourthly, embodiments of this application provide a computer-readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, the above-described steps are implemented.
[0034] This application provides a method for testing data packet fragmentation. The method involves parsing a target data packet sent by a client to obtain its message content. Based on predefined cached messages corresponding to multiple data packets from the client, a target cached message corresponding to the target data packet is determined. If the message content does not match the content of the target cached message, data packet fragmentation is determined, and the content of the target cached message is sent to the server. The server's performance test result is determined based on its response. By matching the message content with the content of the target cached message and replacing the client-sent message content with the content of the target cached message when data packet fragmentation is determined, the data packet fragmentation problem during performance testing can be solved, ensuring the integrity and continuity of the entire performance test. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0036] Figure 1 A flowchart illustrating a data packet merging test method provided in an embodiment of this application is shown.
[0037] Figure 2 A schematic diagram of the TCP header format provided in an embodiment of this application is shown;
[0038] Figure 3 A flowchart illustrating another data packet merging test method provided in an embodiment of this application is shown.
[0039] Figure 4 This illustration shows a schematic diagram of the data binding test apparatus provided in an embodiment of this application;
[0040] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0041] 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 numbers 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 application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0042] When a client and a server use a long-lived socket connection for message passing, and the message content includes several types of message content, and the message passing is periodic or irregular, continuous or discontinuous, socket packet merging may occur, causing data packet 1 and data packet 2 to be transmitted simultaneously in a single request, or parts of data packet 1 and data packet 2 to be transmitted simultaneously in the same request.
[0043] LoadRunner is a load testing tool for predicting system behavior and performance. When using LoadRunner to test the aforementioned distributed application based on the socket protocol, the TCP data is transmitted in the form of a stream, and stream data has no clear start and end boundaries. Therefore, data packet merging is prone to occur, causing errors in the test script and making it impossible to complete the performance test.
[0044] Currently, LoadRunner supports the socket protocol through two methods for message reception: `lrs_receive()` and `lrs_receive_ex()`. It also stipulates that messages must be received according to the reception method specified in the `lrs_set_receive_option()` method. These reception methods include:
[0045]
[0046] Because LoadRunner's built-in receiving method cannot determine whether message content is fragmented or not, receiving messages may fail, thus affecting script execution.
[0047] To address the aforementioned issues in the performance testing process, this application provides a method for testing data packet fragmentation. This method matches the message content with the content of the target cached information, and when it is determined that data packet fragmentation exists in the message content, replaces the message content sent by the client with the content of the target cached message. This solves the data packet fragmentation problem in the performance testing process and ensures the integrity and continuity of the entire performance test.
[0048] Figure 1 The figure shows a flowchart illustrating a data packet merging testing method provided in an embodiment of this application. This method can be applied to a performance testing platform. As shown in the figure, the data packet merging testing method 100 specifically includes the following steps:
[0049] S101: Parse the target data packet sent by the client to obtain the message content in the target data packet.
[0050] In practice, the performance testing platform can send a request message to the client to obtain the target data packet sent by the client, such as data packet 1. Then, by parsing the target data packet, the message content can be obtained. For example, the message content of data packet 1 is ABCD.
[0051] S102: Based on the predefined cached messages corresponding to multiple data packets of the client, determine the target cached message corresponding to the target data packet. If the message content cannot match the content of the target cached message, determine that the message content has data packet splicing, and send the content of the target cached message to the server.
[0052] In practice, the performance testing platform obtains predefined cached messages corresponding to multiple data packets from the client. For example, the cached message corresponding to data packet 1 is ABC, and the cached message corresponding to data packet 2 is DEF. The target cached message ABC corresponding to the target data packet is determined. If the received message content ABCD does not match the content ABC of the target cached message, it is determined that the received message content contains data packet fragmentation. The content ABC of the target cached message is then sent to the server. Similarly, when data packet 2 is received from the client, if the message content EF of data packet 2 does not match the content DEF of the target cached message, the content DEF of the target cached message is sent to the server to resolve the data packet fragmentation problem.
[0053] S103: Determine the performance test result of the server based on the server's response message.
[0054] In practice, by matching the message content with the content of the target cached information, and replacing the message content sent by the client with the content of the target cached message when it is determined that the message content contains data fragmentation, the performance test results of the server can be determined based on the server's response message. This can solve the data fragmentation problem in the performance test process and ensure the integrity and continuity of the entire performance test.
[0055] In one possible implementation, before parsing the target data packet sent by the client and obtaining the message content in the target data packet, step S101 above further includes:
[0056] Establish a socket connection with the client;
[0057] The content identification information corresponding to the target data packet sent by the client is received via socket; wherein, the content identification information is used to indicate whether there is message content in the target data packet;
[0058] If it is determined that there is message content in the target data packet based on the content identification information, the target data packet is obtained.
[0059] In practice, establishing a socket connection with the client takes the following function form:
[0060] lrs_create_socket("socket0","TCP","RemoteHost=xxx.xxx.com:8180",LrsLastArg);
[0061] In this function, lrs_create_socket() is used to create a socket connection. socket0 is a user-defined name, TCP is the protocol type name (there are two types: TCP and UDP), RemoteHost is the address and port of the target, and LrsLastArg is the parameter end identifier.
[0062] This function will return the result of the connection establishment. If the return value is 0, it means that the connection was established successfully; otherwise, the connection failed.
[0063] After establishing a socket connection with the client, the system receives content identifier information corresponding to the target data packet sent by the client via the socket. This content identifier information indicates whether message content exists in the target data packet. If the system determines that message content exists in the target data packet based on the content identifier information, the target data packet is retrieved. This allows for efficient and accurate determination of whether the message content is empty, and further, if message content exists in the target data packet, it identifies whether there is a message concatenation issue.
[0064] In practical applications, the TCP header format is as follows: Figure 2 As shown in the diagram, the principles of the TCP protocol can be utilized to receive the first 4 bytes of the target data packet sent by the client via a socket, and the content identification information corresponding to the target data packet can be determined based on the data packet. The function form is as follows:
[0065] lrs_receive_ex("socket0","buf1","NumberOfBytesToRecv=4",LrsLastArg);
[0066] Here, lrs_receive_ex() is a function used to receive data from a datagram or stream socket, and NumberOfBytesToRecv=4 indicates that 4 bytes of message data must be received.
[0067] In one possible implementation, in step S102 above, if the message content cannot match the content of the target cached message, it is determined that the message content contains data packet fragmentation, and the content of the target cached message is sent to the server, including:
[0068] The message content is obtained into the target buffer, the message content in the target buffer is read byte by byte, and matched with the content of the target cached message to obtain the byte matching result;
[0069] If the message content is determined to have data packet fragmentation based on the byte matching result, the content of the target cached message is sent to the server.
[0070] In practice, a custom target buffer can be defined, and the message content can be retrieved into this target buffer. Here, the message content can be the last received data retrieved from the LoadRunner cache. The specific retrieval method can be as follows:
[0071] char*TempValue;
[0072] int intPackageLen = 0;
[0073] lrs_get_last_received_buffer("socket0",&TempValue,&intPackageLen);
[0074] The function `lrs_get_last_received_buffer()` retrieves the last received buffer or a portion thereof. Here, it stores the received data in memory (a memory block pointed to by the pointer `TempValue`) and returns the data length (stored in `intPackageLen`).
[0075] Then, the message content in the target buffer is read byte by byte and matched with the content of the target cached message to obtain the byte matching result; if it is determined from the byte matching result that there is data packet splicing in the message content, the content of the target cached message is sent to the server.
[0076] Sending the content of the target cached message to the server includes:
[0077] Invoke the business processing method of the server;
[0078] The business processing method is used to process the content of the target cached message, and the processed content of the target cached message is sent to the server.
[0079] In practice, the data in the data packets is read in a loop, and the server-side business processing method is called to process the data, as follows:
[0080]
[0081] The content of the target cached message after the above business processing is sent to the server.
[0082] In one possible implementation, after sending the content of the target cached message to the server, the method further includes:
[0083] Once it is determined that the reading of the bytes corresponding to the message content has ended, the target buffer is released.
[0084] In practice, when the byte reading is finished, the custom target buffer is released in a loop, completing this packet reception:
[0085] for(j=0;j <intPackageLen;j++){
[0086] TempValue--;
[0087] }
[0088] Regarding the above steps, Figure 3 The figure shows a flowchart illustrating another data packet merging testing method provided in an embodiment of this application. As shown in the figure, the data packet merging testing method may specifically include the following steps:
[0089] S301: Create a socket connection;
[0090] S302: Obtain the first 4 bytes of TCP and verify the presence of message content in the target data packet sent by the client using the receive method;
[0091] S303: Retrieve the last received data from the LoadRunner cache;
[0092] S304: Define a target buffer, save the data obtained in S303 to the target buffer, read each byte of the data in the target buffer byte by byte, and replace the data with the content of the target cache message when the message content corresponding to the data cannot be matched with the target cache message.
[0093] S305: Call the server-side business processing method to perform business processing on the data in the target buffer;
[0094] S306: Determine if the byte reading has ended;
[0095] S307: Loop through and release the target buffer after determining that the byte reading has ended;
[0096] S308: Determine if the buffer release is complete. Once the buffer release is complete, the packet reception is finished.
[0097] The data packet merging testing method provided in this application parses the target data packet sent by the client to obtain the message content within the target data packet; based on predefined cached messages corresponding to multiple data packets from the client, it determines the target cached message corresponding to the target data packet; if the message content and the content of the target cached message cannot be matched, it is determined that data packet merging exists in the message content, and the content of the target cached message is sent to the server; based on the server's response message, the server's performance test result is determined. In this way, by matching the message content with the content of the target cached information, and replacing the message content sent by the client with the content of the target cached message when data packet merging is determined, the data packet merging problem during performance testing can be solved, ensuring the integrity and continuity of the entire performance test.
[0098] Figure 4 The diagram shows a schematic of the data packet merging testing apparatus provided in an embodiment of this application. This data packet merging testing apparatus can achieve the following: Figure 1 The data packet testing device 400, comprising all or part of the contents shown in the embodiment, includes:
[0099] The content acquisition module 410 is used to parse the target data packet sent by the client and obtain the message content in the target data packet;
[0100] The content matching module 420 is used to determine the target cache message corresponding to the target data packet based on the cache messages corresponding to multiple data packets of the client in a predefined manner. If the content of the message cannot be matched with the content of the target cache message, it is determined that the message content has data packet splicing, and the content of the target cache message is sent to the server.
[0101] The result determination module 430 is used to determine the performance test result of the server based on the response message from the server.
[0102] One possible implementation also includes:
[0103] A connection establishment module is used to establish a Socket connection with the client;
[0104] The information receiving module is used to receive content identification information corresponding to the target data packet sent by the client via a Socket; wherein, the content identification information is used to indicate whether there is message content in the target data packet;
[0105] The data packet acquisition module is used to acquire the target data packet when it is determined, based on the content identification information, that there is message content in the target data packet.
[0106] Specifically, when the information receiving module receives the content identification information corresponding to the target data packet sent by the client via the Socket, it is used for:
[0107] The system receives the first four bytes of the target data packet sent by the client via a Socket, and determines the content identification information corresponding to the target data packet based on the message data.
[0108] In one possible implementation, when the content matching module 420 determines that the message content has data packet fragmentation when the message content cannot be matched with the content of the target cached message, and sends the content of the target cached message to the server, it is specifically configured to:
[0109] The message content is obtained into the target buffer, the message content in the target buffer is read byte by byte, and matched with the content of the target cached message to obtain the byte matching result;
[0110] If the message content is determined to have data packet fragmentation based on the byte matching result, the content of the target cached message is sent to the server.
[0111] In one possible implementation, when the content matching module 420 sends the content of the target cached message to the server, it is specifically used for:
[0112] Invoke the business processing method of the server;
[0113] The business processing method is used to process the content of the target cached message, and the processed content of the target cached message is sent to the server.
[0114] In one possible implementation, after sending the content of the target cached message to the server, the content matching module 420 is further configured to:
[0115] Once it is determined that the reading of the bytes corresponding to the message content has ended, the target buffer is released.
[0116] This application provides a data packet merging testing device, including a content acquisition module, a content matching module, and a result determination module. The content acquisition module parses the target data packet sent by the client to obtain the message content in the target data packet. The content matching module determines the target cache message corresponding to the target data packet based on predefined cache messages corresponding to multiple data packets of the client. If the message content and the content of the target cache message cannot be matched, it is determined that the message content has data packet merging, and the content of the target cache message is sent to the server. Then, the result determination module determines the performance test result of the server based on the response message from the server. In this way, by matching the message content with the content of the target cache message, and replacing the message content sent by the client with the content of the target cache message when data packet merging is determined, the data packet merging problem in the performance testing process can be solved, ensuring the integrity and continuity of the entire performance test.
[0117] Figure 5 The diagram illustrates the hardware structure of a computer device implementing the embodiments of this application. Referring to the diagram, at the hardware level, the electronic device includes a processor and optionally, an internal bus, a network interface, and memory. The memory may include RAM, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk storage device. Of course, the computer device may also include other hardware required for other business operations.
[0118] The processor, network interface, and memory can be interconnected via an internal bus, which can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be categorized as an address bus, data bus, control bus, etc. For ease of illustration, only a single bidirectional arrow is used in this diagram, but this does not imply that there is only one bus or one type of bus.
[0119] The memory stores the message notification device, which includes one or more programs. Specifically, the program may include program code, which includes computer operation instructions. The memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0120] The processor reads the corresponding computer program from non-volatile memory into main memory and then runs it, logically forming a device that locates the target user. The processor executes the program stored in memory and specifically performs the following: Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.
[0121] The above is as stated in this application. Figure 1 or Figure 3 The methods disclosed in the illustrated embodiments can be implemented in or by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0122] The computer device can also execute the methods described in the preceding method embodiments and achieve the functions and beneficial effects of the methods described in the preceding method embodiments, which will not be repeated here.
[0123] Of course, in addition to software implementation, the electronic device of this application does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0124] This application also proposes a computer-readable storage medium that stores one or more programs, which, when executed by an electronic device including multiple applications, cause the electronic device to perform... Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.
[0125] The computer-readable storage medium includes read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, etc.
[0126] Furthermore, embodiments of this application also provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, implement the following process: Figure 1 or Figure 3 The methods disclosed in the embodiments shown achieve the functions and beneficial effects of the methods described in the preceding method embodiments, and will not be repeated here.
[0127] In summary, the above description is merely a preferred embodiment of this application and does not limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
[0128] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0129] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can store information accessible to a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0130] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0131] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
Claims
1. A method for testing data packet fragmentation, characterized in that, include: The target data packet sent by the client is parsed to obtain the message content in the target data packet; Based on the cached messages corresponding to multiple data packets of the client as defined in the predefined way, the target cached message corresponding to the target data packet is determined. If the message content cannot match the content of the target cached message, it is determined that the message content has data packet splicing, and the content of the target cached message is sent to the server. Based on the response message from the server, the performance test results of the server are determined.
2. The method according to claim 1, characterized in that, Before parsing the target data packet sent by the client to obtain the message content in the target data packet, the method further includes: Establish a socket connection with the client; The content identification information corresponding to the target data packet sent by the client is received via socket; wherein, the content identification information is used to indicate whether there is message content in the target data packet; If it is determined that there is message content in the target data packet based on the content identification information, the target data packet is obtained.
3. The method according to claim 2, characterized in that, The step of receiving the content identification information corresponding to the target data packet sent by the client via Socket includes: The system receives the first four bytes of the target data packet sent by the client via a socket, and determines the content identification information corresponding to the target data packet based on the message data.
4. The method according to claim 1, characterized in that, When the message content cannot match the content of the target cached message, determining that the message content contains data fragmentation, and sending the content of the target cached message to the server, includes: The message content is obtained into the target buffer, the message content in the target buffer is read byte by byte, and matched with the content of the target cached message to obtain the byte matching result; If the message content is determined to have data packet fragmentation based on the byte matching result, the content of the target cached message is sent to the server.
5. The method according to claim 4, characterized in that, Sending the content of the target cached message to the server includes: Invoke the business processing method of the server; The business processing method is used to process the content of the target cached message, and the processed content of the target cached message is sent to the server.
6. The method according to claim 4, characterized in that, After sending the content of the target cached message to the server, the method further includes: Once it is determined that the reading of the bytes corresponding to the message content has ended, the target buffer is released.
7. A testing device for data packet aggregation, characterized in that, include: The content acquisition module is used to parse the target data packet sent by the client and obtain the message content in the target data packet; The content matching module is used to determine the target cache message corresponding to the target data packet based on the cache messages corresponding to multiple data packets of the client in a predefined manner. If the content of the message cannot be matched with the content of the target cache message, it is determined that the message content has data packet splicing, and the content of the target cache message is sent to the server. The result determination module is used to determine the performance test result of the server based on the response message from the server.
8. The apparatus according to claim 7, characterized in that, Also includes: A connection establishment module is used to establish a Socket connection with the client; The information receiving module is used to receive content identification information corresponding to the target data packet sent by the client via a Socket; wherein, the content identification information is used to indicate whether there is message content in the target data packet; The data packet acquisition module is used to acquire the target data packet when it is determined, based on the content identification information, that there is message content in the target data packet.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing programs or instructions that can run on the processor, the programs or instructions being executed by the processor to implement the steps of the method as described in any one of claims 1 to 6.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Realization method and system of Rpc client in performance test platform based on Netty, server and storage medium
CN109726014A
TCP protocol message filtering method and device
CN111818099A
