CN114448825A - Flow comparison method, device, equipment and storage medium - Google Patents

Flow comparison method, device, equipment and storage medium Download PDF

Info

Publication number
CN114448825A
CN114448825A CN202011233289.3A CN202011233289A CN114448825A CN 114448825 A CN114448825 A CN 114448825A CN 202011233289 A CN202011233289 A CN 202011233289A CN 114448825 A CN114448825 A CN 114448825A
Authority
CN
China
Prior art keywords
target
flow
traffic
response information
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011233289.3A
Other languages
Chinese (zh)
Inventor
葛庆阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xingyin Information Technology Shanghai Co ltd
Original Assignee
Xingyin Information Technology Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xingyin Information Technology Shanghai Co ltd filed Critical Xingyin Information Technology Shanghai Co ltd
Priority to CN202011233289.3A priority Critical patent/CN114448825A/en
Publication of CN114448825A publication Critical patent/CN114448825A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2475Traffic characterised by specific attributes, e.g. priority or QoS for supporting traffic characterised by the type of applications

Abstract

The embodiment of the invention discloses a flow comparison method, a flow comparison device, flow comparison equipment and a storage medium. The method comprises the following steps: acquiring configuration information of a target application; acquiring target flow of the target application according to the configuration information; wherein, the target flow is the flow under the remote procedure call protocol; configuring the target flow according to the configuration information, and sending the configured target flow to at least two corresponding target services so that the target services play back the target flow and generate response information; and receiving response information of the target service, decoding the response information to convert the response information from a binary format under a remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result. The technical scheme of the embodiment of the invention realizes the playback of the service flow generated by the service under the remote procedure call protocol and obtains accurate test results under the conditions of data maintenance, accident recurrence and the like.

Description

Flow comparison method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of network testing, in particular to a flow comparison method, a flow comparison device, flow comparison equipment and a storage medium.
Background
With the increasing development speed of the internet business, the business scale is enlarged, and the system design is more and more complex. People often meet the requirements of business systems for robustness, compatibility, test coverage and timeliness through more automatic regression scripts and manually written scripts.
However, as the research and development time of projects in the industry is reduced day by day, the automatic script is not always in time to maintain the system, and the accuracy and effectiveness of the automatic regression script are difficult to ensure. When a service is reconstructed, migrated or upgraded, the influence range of the service scene is difficult to evaluate, so that the test work is difficult to expand, an online real data scene cannot be constructed even if the test is carried out, the test effect is poor, and meanwhile, when an accident occurs in online service, the accident is difficult to be reproduced locally in time to determine the cause of the accident.
In order to meet the requirement of the existing internet service on comprehensive and system test, a flow playback technology is often adopted to test service flow, but at present, the flow playback technology only supports the test of data flow of the service under a common hypertext transfer protocol, and is difficult to be directly applied to the service under a remote procedure call protocol to perform the test.
Disclosure of Invention
The invention provides a traffic comparison method, a device, equipment and a storage medium, which are used for replaying service traffic generated by a service under a remote process call protocol and comparing replay results to obtain more accurate test results of the corresponding service.
In a first aspect, an embodiment of the present invention provides a traffic comparison method, including:
acquiring configuration information of a target application;
acquiring target flow of the target application according to the configuration information; wherein, the target flow is the flow under the remote procedure call protocol;
configuring the target flow according to the configuration information, and sending the configured target flow to at least two corresponding target services so that the target services play back the target flow and generate response information;
and receiving response information of the target service, decoding the response information to convert the response information from a binary format under a remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result.
In a second aspect, an embodiment of the present invention further provides a flow rate comparison device, where the flow rate comparison device includes:
the configuration information acquisition module is used for acquiring the configuration information of the target application;
the target flow acquisition module is used for acquiring the target flow of the target application according to the configuration information; wherein, the target flow is the flow under the remote procedure call protocol;
the flow configuration module is used for configuring the target flow according to the configuration information and sending the configured target flow to at least two corresponding target services so that the target services can play back the target flow and generate response information;
and the flow comparison module is used for receiving the response information of the target service, decoding the response information so as to convert the response information from a binary format under a remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
storage means for storing one or more programs;
when executed by one or more processors, cause the one or more processors to implement a method of traffic comparison as provided by any of the embodiments of the invention.
In a fourth aspect, embodiments of the present invention further provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a traffic comparison method as provided in any embodiment of the present invention.
The embodiment of the invention obtains the configuration information of the target application; acquiring target flow of the target application according to the configuration information; wherein, the target flow is the flow under the remote procedure call protocol; configuring the target flow according to the configuration information, and sending the configured target flow to at least two corresponding target services so that the target services play back the target flow and generate response information; and receiving response information of the target service, decoding the response information to convert the response information from a binary format under a remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result. By adopting the technical scheme, corresponding configuration information is configured for the target application according to different target application types, when the flow of the target application needs to be played back and compared, the configuration information of the target application is obtained, the target flow under a remote process call protocol which needs to be played back and compared in the target application is obtained according to the configuration information, the configured target flow is sent to at least two corresponding target services according to the configuration information, the response information is given according to the target service, the decoding based on the data state under the remote process call protocol is carried out on the response information, the decoded response information is compared to obtain the target flow comparison result of the target application under the remote process call protocol, the problem that the data flow of the application service under the remote process call protocol cannot be tested in the prior art is solved, and the service flow generated by the service under the remote process call protocol can be played back, when an accident occurs in online service, the accident reasons can be better compared and reproduced, and the accuracy of the obtained service test result is improved.
Drawings
Fig. 1 is a flowchart of a traffic comparison method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a traffic comparison method according to a second embodiment of the present invention;
fig. 3 is a flowchart illustrating a process of collecting data traffic of a target application according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of a flow rate comparison device in a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures. In addition, the embodiments and features of the embodiments in the present invention may be combined with each other without conflict.
It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings. Before discussing exemplary embodiments in greater detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a flowchart of a flow comparison method according to an embodiment of the present invention, where the embodiment is applicable to a situation where a service flow generated by a service under a remote procedure call protocol is played back, a service accident is reproduced, or a service is tested, the method may be executed by a flow comparison device, the flow comparison device may be implemented by software and/or hardware, and the flow comparison device may be configured on a computing device, and specifically includes the following steps:
s101, obtaining configuration information of the target application.
In this embodiment, the target Application may be understood as an Application that is determined by a user and needs to perform traffic collection and playback comparison, and optionally, the target Application may be Application software installed in a user terminal and provided for meeting requirements of the user in different fields and different problems, where the user terminal may be a mobile terminal or a fixed terminal, that is, the target Application may be an Application (APP) installed on a mobile phone or a tablet computer, or an Application installed in a fixed terminal such as a desktop computer. For example, taking an application program in a mobile phone as an example, the target application may be a common APP such as a small red book, a jingdong, and a naobao.
In the present embodiment, the configuration information can be understood as parameter information data stored in the memory to specify the target traffic required to be played back in the target application and specify the manner in which the target traffic should be played back. Optionally, the configuration information may be filled in and set by a user, or may be directly generated by the system, which is not limited in this embodiment of the present invention. Furthermore, the configuration information corresponding to the target application may be one or more sets, and may be distinguished by configuration names.
Specifically, a target application which needs to be subjected to flow playback and flow comparison test is selected according to requirements, when the configuration information corresponding to the target application is multiple sets, the configuration information which is needed at the time is selected as the configuration information of the target application according to the configuration name, and various parameter information in the configuration information is obtained.
And S102, acquiring the target flow of the target application according to the configuration information.
The target flow is the flow under the remote procedure call protocol.
In this embodiment, a Remote Procedure Call (RPC) protocol may be understood as a data transmission protocol applied to a network distributed system to implement distributed computing and communication. Further, the RPC Protocol is a Protocol for requesting a service from a remote computer program through a network without knowing an underlying network technology, and compared with a hypertext Transfer Protocol (HTTP), the RPC Protocol has the characteristics of good readability, capability of obtaining a firewall and cross-language support, and less occupied useful information, and the flow under the RPC Protocol has the characteristics of poor readability but high occupied useful information, thereby laying the foundation of the flow comparison method based on the target flow characteristics.
Specifically, the target traffic corresponding to the start time and the length is obtained from the data traffic of the target application stored in the storage medium according to the configuration information, or the data traffic of the target application is directly acquired according to the configuration information, and the acquired data traffic is processed to obtain the target traffic of the target application according with the configuration information.
In the embodiment of the invention, the target flow of the target application is obtained according to the configuration information corresponding to the target application, the flow which needs to be subjected to flow playback and flow comparison in the collected data flow of the target application can be accurately determined, the acquisition of redundant flow is avoided, the data transmission amount in a network is reduced, more test operations can be performed on the collected target flow within the same playback time, and the accuracy and flexibility of the test are enhanced.
S103, configuring the target flow according to the configuration information, and sending the configured target flow to at least two corresponding target services so that the target services can play back the target flow and generate response information.
In this embodiment, the target service may be understood as a server corresponding to the target application and capable of performing traffic playback, which is determined according to the configuration information, and specifically, may send the target traffic to the target service for traffic playback. The traffic playback may be understood as a test method that transmits the collected traffic to a target service of the test environment, and re-executes requests of the collected traffic in the target service to obtain a response result.
Specifically, at least two target services for replaying traffic are determined according to configuration information, traffic corresponding to a function needing replaying in the target traffic is determined according to the configuration information, the traffic corresponding to the function needing replaying carries parameter information of what kind of operation the traffic is expected to perform in the target services in the configuration information, the traffic is sent to the at least two corresponding target services as configured target traffic according to the parameter information included in the configuration parameters and used for controlling traffic sending, and after the target services receive the configured target traffic, the configured target traffic is replayed according to the carried parameter information, and corresponding response information is generated.
In the embodiment of the invention, the target flow is configured and the configured target flow is sent to the at least two corresponding target services for flow playback according to the configuration, so that the target services can only play back the flow corresponding to the function needing to be played back in the target flow, the data volume needing to be transmitted is reduced, the execution precision is improved, the flow playback is carried out by corresponding to the at least two target services, the error caused by the target service fault when the playback is carried out by only one target service is avoided, the response information generated by the flow playback of the at least two target services is compared, and the accuracy of the test result is improved.
And S104, receiving the response information of the target service, decoding the response information to convert the response information from a binary format under a remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result.
In the present embodiment, the Object Notation format (JSON) is a lightweight data exchange format. It is based on a subset of ECMAScript (js specification set by the european computer association), uses a text format completely independent of the programming language to store and represent data, which can be read and written by humans, and which is easy to parse and generate by machines. The binary format under the remote procedure call protocol is a data exchange format for storing data in a file in a binary mode, and the file generated by the same data is small and has a high analysis speed, but the file is difficult to be directly read and written by people, and the universality is poor.
Specifically, when response information of the target service is received, because the target flow sent to the target service is the target flow under the remote procedure call protocol, the given response information is also in a binary format under the remote procedure call protocol, because the binary format cannot be directly read and written, the response information is decoded according to a decoding rule, the binary format is converted into an object numbered musical notation format which can be read and written by people, the decoded response information is compared, the difference of results obtained after the response information is played back on at least two target services is determined, and the difference is determined as a comparison result.
According to the technical scheme of the embodiment, the configuration information of the target application is acquired; acquiring target flow of the target application according to the configuration information; wherein, the target flow is the flow under the remote procedure call protocol; configuring the target flow according to the configuration information, and sending the configured target flow to at least two corresponding target services so that the target services play back the target flow and generate response information; and receiving response information of the target service, decoding the response information to convert the response information from a binary format under a remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result. By adopting the technical scheme, corresponding configuration information is configured for the target application according to different target application types, when the flow of the target application needs to be played back and compared, the configuration information of the target application is obtained, the target flow under a remote process call protocol which needs to be played back and compared in the target application is obtained according to the configuration information, the configured target flow is sent to at least two corresponding target services according to the configuration information, the response information is given according to the target service, the decoding based on the data state under the remote process call protocol is carried out on the response information, the decoded response information is compared to obtain the target flow comparison result of the target application under the remote process call protocol, the problem that the data flow of the application service under the remote process call protocol cannot be tested in the prior art is solved, and the service flow generated by the service under the remote process call protocol can be played back, when an accident occurs in online service, the accident reasons can be better compared and reproduced, and the accuracy of the obtained service test result is improved.
Example two
Fig. 2 is a flowchart of a flow comparison method provided in the second embodiment of the present invention, and the technical solution of the second embodiment of the present invention is further optimized based on the optional technical solutions, and specific operations to be executed for performing playback comparison on target flow under a remote procedure call protocol are further defined by defining acquisition of data flow in a target application and configuration of the target flow through configuration information, so that a service under the remote procedure call protocol can also be tested through flow playback, and an accurate test result is obtained when data maintenance, accident recurrence, and the like are required. The method specifically comprises the following steps:
s201, obtaining the magnification, the repeated execution times, the playback time length, the upper limit value of the query rate per second, the initial consumption time, the initial consumption position, the playback type, the white list configuration, the host port configuration and the transmission type of the target application.
In this embodiment, the amplification factor may be understood as being used to determine that the collected target traffic is amplified several times for playback, that is, the number of times of playback of the target traffic is used to determine that the target traffic is sent to the target service several times; the repeated execution times can be understood as the times of repeated execution of the received target flow by the target service; the playback time length can be understood as the set task time length required by obtaining the flow playback end from the starting execution target flow; the upper limit of Query Per Second (QPS) can be understood as a measure of how much traffic a particular query server processes within a specified time, and in this application, can be understood as the maximum transmission speed of the target traffic to the target service; the initial consumption time may be understood as a point in the data traffic of the target application from which the traffic is consumed, that is, traffic data after the point in the data traffic of the target application is obtained as the target traffic, for example, assuming that traffic is collected for a certain application, an abnormal alarm occurs when the application is at 10 points, in order to reproduce the problem, the traffic may be consumed from the collected traffic at about 10 points as an initial point, and the traffic after the time point is played back to try to reproduce the abnormal; the initial consumption position can be understood as a position in the target service from which the traffic consumption is initially started in the acquired target traffic, namely, where the traffic playback is started; the playback type can be understood as the type of operation that is desired to be performed on the target traffic, and may include, for example, comparison of start results, recording of traffic, and the like; the white list configuration may be understood as configuration information determined according to a function to be played back, specifically, different functions in an application correspond to different interfaces, and the white list configuration may be configured for the function to be played back, so that only the interface corresponding to the function to be played back may pass through; the host port configuration can be understood as parameters of services for determining target flow to perform flow playback, namely, host port information and services have a one-to-one correspondence relationship, and the target service to which the target flow should be sent can be determined according to the obtained host port information; the transmission type can be understood as a way of traffic playback, and the corresponding requests and responses obtained for different traffic transmission types are different and can be determined according to the transmission type.
S202, collecting data flow of the target application.
The data traffic and the target traffic of the target application can be both traffic under the Thrift communication protocol. Thrift is an interface description language and binary communication protocol, which is used to define and create cross-language services, and can be used as a remote procedure call framework, and the data formats generated on the framework are all binary formats which can not be directly read.
Specifically, fig. 3 is a flowchart illustrating a process of acquiring data traffic of a target application according to an embodiment of the present invention, which specifically includes the following steps:
s2021, intercepting the request data sent by the target application through the network card through the original socket, and performing matching filtering on the request data.
In this embodiment, a Raw Socket (Raw Socket) may be understood as a traffic intercepting method for receiving a data frame or a data packet on a local network card and monitoring and analyzing traffic of a network, and the method may copy an ethernet frame when the traffic just enters a kernel through the network card, so as to intercept request data, i.e., traffic, sent by an application.
Specifically, when traffic is collected for a target application, request data sent by the target application through a network card is intercepted by an original socket method, and the intercepted request data is filtered to obtain data traffic meeting traffic playback conditions. Alternatively, matched filtering may employ a Packet filtering mechanism (BPF), which may be used to Filter data packets destined for a particular site, such as user space.
And S2022, assembling effective data in the filtered request data to obtain assembly data, and determining data meeting the Thrift communication protocol in the assembly data as data traffic of the target application.
Specifically, effective data of a TCP layer in the filtered request data is obtained, the effective data and frame header data and the like are assembled to obtain assembly data, the assembly data is analyzed, the request data meeting the Thrift communication protocol is determined according to the Thrift communication protocol, and the request data is determined as data traffic of the target application.
Further, the transmission types of the traffic under the thread communication protocol include a frame type, an unframed type, and a header type, and for the difference between the requests corresponding to the three types and the corresponding acquisition, the traffic processing in the application needs to be performed according to the transmission type difference.
And S203, storing the data traffic according to the type of the target application and the traffic generation time.
Specifically, after data traffic of the target application is acquired, the data traffic is classified according to the type of the target application, and is stored in the storage medium in the corresponding target application storage area according to the traffic generation time included in the acquired data traffic and the time sequence. For example, the collected data traffic may be forwarded to kafka for storage through agent-smith (a log collection and distribution system that provides LogSDK to help users output logs and read logs from command source configured by users and distribute the logs to corresponding sink nodes), where kakfa is an open source stream processing platform developed by Apache software foundation.
And S204, acquiring the target flow in the data flow of the target application according to the initial consumption time.
Specifically, it is determined from the initial consumption time in the configuration information which point in the data traffic of the target application the traffic should be consumed from, that is, it is determined from the data traffic of the target application the starting point of the traffic that should be configured and sent to the target service, and the target traffic of the data traffic of the target application is obtained accordingly.
S205, decoding the target traffic, and determining the decoded target traffic meeting the white list configuration as new target traffic.
Specifically, the target traffic is traffic under the Thrift communication protocol, that is, the target traffic is data stored in a binary format, and the content is not directly read and written, so that the target traffic needs to be decoded to determine the traffic meeting the condition in the white list configuration, so that the traffic is converted from the binary format into an object numbered musical notation format according to a decoding rule, and further, the function information contained in the traffic is determined, the function meeting the white list configuration is determined, and the traffic corresponding to the function in the white list configuration is determined as new target traffic.
S206, judging whether the playback type is flow recording or not, if so, executing a step S207; if not, step S209 is executed.
Specifically, whether the playback type corresponding to the current target flow is a flow record is determined according to the playback type in the configuration information, if yes, it is determined that the acquired target flow needs to be subjected to flow record, so that the acquired target flow is generated into a record flow to be stored, and step S207 is specifically executed; if not, it is determined that the collected target traffic does not need to be recorded, and the collected target traffic can be directly sent to the target service for playback according to the configuration information, and then step S209 is executed.
And S207, acquiring recording number information.
Specifically, when it is determined that the acquired target traffic needs to be recorded, recording number information in the traffic recording configuration is acquired to determine the number of the traffic that needs to be recorded.
And S208, recording the new target flow according to the amplification factor, the recording number information and the query rate upper limit value per second to obtain the recording flow containing the recording interface information.
Specifically, the decoded new target flow is recorded according to the amplification factor, the recording number information and the query rate upper limit value per second, the recording speed in the recording process is not more than the query rate upper limit value per second, the transmission times of the same flow are determined according to the amplification factor, the number of the recorded flows is determined according to the recording number information, and the recording flow containing the recording interface information is finally obtained.
And further, flow recording is executed according to the configuration information, a flow recording set is generated after each recording, recording details comprise a recording interface, the recording interface can be edited, and the recorded flow is in an object numbered musical notation format for direct reading and writing. Furthermore, the playback operation can be performed for the recorded traffic, the recorded traffic still contains the information of the repeated execution times, the playback duration, the upper limit value of the query rate per second, the initial consumption position, the configuration of the host port, the transmission type and the like in the configuration information, before playback of the recorded traffic, because the traffic is under the Thrift communication protocol, in order to satisfy the data transmission rule, the recorded traffic in the object numbered notation format should be re-encoded to make the format become the binary format under the Thrift communication protocol for forwarding, when the recorded flow is played back, the target service to be sent to and the configuration parameters in the sending process and the playback process can be determined according to the configuration information contained in the recorded flow, and further realizing playback of the recorded flow, obtaining response information generated by the target service, and further carrying out flow comparison on the recorded flow according to the response information.
And S209, encoding the new target flow according to a preset rule.
Specifically, because the new target flow is in an object numbered musical notation format, and the application environment of the scheme is a data processing environment under the Thrift communication protocol, in order to meet the data processing rule under the Thrift communication protocol, the new target flow needs to be encoded according to a preset rule, so that the object numbered musical notation format is converted into a binary format, and the data transmission requirement of the working environment under the Thrift communication protocol is met.
And S210, respectively sending the encoded new target traffic to at least two target services determined according to the configuration of the host port according to the amplification factor and the upper limit value of the query rate per second, so that the target services play back the target traffic according to the repeated execution times, the initial consumption position and the transmission type and generate response information.
Specifically, at least two target services to which the encoded new target traffic should be sent are determined according to the host port configuration, the encoded new target traffic is sent to each target service in a magnification multiple number of times at a transmission speed not greater than the query rate upper limit value per second, so that the target services execute traffic playback operation according to the repeated execution times, the initial consumption position and the transmission type information carried in the target traffic, and generate corresponding response information.
Further, for the RPC service, the IP and port number corresponding to the service may be determined according to the configuration, and since each issuance of the service may cause a change of the IP, if only the function of configuring the port number of the host is provided, each issuance may require modification of the IP and the port number to the platform, resulting in poor user experience. In the application, service discovery and configuration of the distributed system are realized through the consul, the respective IP and port are reported to the consul when the application works, the consul provides a service for inquiring the IP and the interface through the application name, the service can be called to acquire the IP and the port number of the target application while playback is executed, and the problem of IP and port number change is solved.
S211, receiving response information of the target service, decoding the response information to enable the response information to be converted into an object numbered musical notation format from a binary format under a remote procedure call protocol, and comparing the decoded response information to obtain a comparison result.
In the technical scheme of this embodiment, data meeting the Thrift communication protocol is collected by methods such as an original socket as data traffic of a target application, and is stored according to the type of the target application and traffic generation time, a target traffic to be subjected to traffic playback in the data traffic of the target application is determined by obtaining configuration information such as a magnification factor, a number of repeated executions, a playback duration, an upper limit value of a query rate per second, an initial consumption time, an initial consumption position, a playback type, a white list configuration, a host port configuration, and a transmission type corresponding to the target application, encoding and decoding are performed on a data format of the target traffic, the target traffic is sent to a target service determined according to the configuration information to perform traffic playback, a comparison result of the target traffic is determined according to response information fed back by the target service, and a remote procedure is invoked under a protocol, for example, data traffic of application services under the Thrift communication protocol can be tested by playback, comparison and the like, so that the accident reason can be better reproduced for the application under the communication protocol when an on-line service accident occurs, and an accurate test result can be obtained in class under the conditions of data maintenance, data scene construction, accident reproduction and the like.
EXAMPLE III
Fig. 4 is a schematic structural diagram of a flow rate comparison device according to a third embodiment of the present invention, where the flow rate comparison device includes: a configuration information obtaining module 31, a target flow obtaining module 32, a flow configuration module 33 and a flow comparison module 34.
The configuration information acquiring module 31 is configured to acquire configuration information of a target application; a target flow obtaining module 32, configured to obtain a target flow of a target application according to the configuration information; wherein, the target flow is the flow under the remote procedure call protocol; the traffic configuration module 33 is configured to configure the target traffic according to the configuration information, and send the configured target traffic to at least two corresponding target services, so that the target services play back the target traffic and generate response information; and the flow comparison module 34 is configured to receive the response information of the target service, decode the response information, convert the response information from a binary format under the remote procedure call protocol into an object numbered musical notation format, and compare the decoded response information to obtain a comparison result.
According to the technical scheme, the problem that the data traffic of the application service under the remote process call protocol cannot be tested in the prior art is solved, the service traffic generated by the service under the remote process call protocol can be played back, the accident reasons can be better compared and reproduced when an accident occurs in online service, and the accuracy of the obtained service test result is improved.
Optionally, the flow rate comparison device further includes:
the flow acquisition module is used for acquiring data flow of the target application; and storing the data traffic according to the type of the target application and the traffic generation time.
Optionally, the configuration information obtaining module 31 is specifically configured to: obtaining the magnification, the repeated execution times, the playback time length, the query rate upper limit value per second, the initial consumption time, the initial consumption position, the playback type, the white list configuration, the host port configuration and the transmission type of the target application.
Optionally, the flow collection module is specifically configured to: intercepting request data sent by a target application through a network card through an original socket, and performing matching filtering on the request data; assembling effective data in the filtered request data to obtain assembly data, and determining data meeting the Thrift communication protocol in the assembly data as data traffic of the target application; and storing the data traffic according to the type of the target application and the traffic generation time.
Optionally, the target flow obtaining module 32 is specifically configured to: and acquiring target traffic in the data traffic of the target application according to the initial consumption time.
Optionally, the flow configuration module 33 is specifically configured to: decoding the target flow, and determining the decoded target flow meeting the white list configuration as a new target flow; when the playback type is not the flow recording, encoding the new target flow according to a preset rule; respectively sending the encoded new target flow to at least two target services determined according to the configuration of the host port according to the amplification factor and the upper limit value of the query rate per second, so that the target services play back the target flow according to the repeated execution times, the initial consumption position and the transmission type and generate response information; when the playback type is flow recording, acquiring recording number information; and recording the new target flow according to the amplification factor, the recording number information and the query rate upper limit value per second to obtain the recording flow containing the recording interface information.
The flow comparison device provided by the embodiment of the invention can execute the flow comparison method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 5 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention, as shown in fig. 5, the apparatus includes a processor 41, a storage device 42, an input device 43, and an output device 44; the number of processors 41 in the device may be one or more, and one processor 41 is taken as an example in fig. 5; the processor 41, the storage means 42, the input means 43 and the output means 44 in the device may be connected by a bus or other means, as exemplified by the bus connection in fig. 5.
The storage device 42, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the flow rate comparison method in the embodiment of the present invention (for example, the configuration information obtaining module 31, the target flow rate obtaining module 32, the flow rate configuration module 33, and the flow rate comparison module 34). The processor 41 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the storage device 42, so as to implement the above-mentioned flow rate comparison method.
The storage device 42 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the storage 42 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, storage 42 may further include memory located remotely from processor 41, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 43 may be used to receive input numeric or character information and to generate key signal inputs relating to user settings and function controls of the apparatus. The output device 44 may include a display device such as a display screen.
EXAMPLE five
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, where the computer-executable instructions are executed by a computer processor to perform a traffic comparison method, and the method includes:
acquiring configuration information of a target application;
acquiring target flow of the target application according to the configuration information; wherein, the target flow is the flow under the remote procedure call protocol;
configuring the target flow according to the configuration information, and sending the configured target flow to at least two corresponding target services so that the target services play back the target flow and generate response information;
and receiving response information of the target service, decoding the response information to convert the response information from a binary format under a remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result.
Of course, the storage medium provided in the embodiments of the present invention includes computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the traffic comparison method provided in any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the above search apparatus, each included unit and module are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A traffic comparison method, comprising:
acquiring configuration information of a target application;
acquiring the target flow of the target application according to the configuration information; wherein the target flow is the flow under a remote procedure call protocol;
configuring the target flow according to the configuration information, and sending the configured target flow to at least two corresponding target services so that the target services play back the target flow and generate response information;
and receiving response information of the target service, decoding the response information to convert the response information from a binary format under the remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result.
2. The method of claim 1, wherein before obtaining the target traffic of the target application according to the configuration information, the method further comprises:
collecting data traffic of a target application;
and storing the data traffic according to the type of the target application and the traffic generation time.
3. The method according to claim 2, wherein the target traffic is traffic under a swift communication protocol, and the collecting data traffic of the target application comprises:
intercepting request data sent by the target application through a network card through an original socket, and performing matching filtering on the request data;
and assembling effective data in the filtered request data to obtain assembly data, and determining data which meets the Thrift communication protocol in the assembly data as the data flow of the target application.
4. The method of claim 3, wherein the obtaining the configuration information of the target application comprises:
and acquiring the magnification, the repeated execution times, the playback time length, the query rate upper limit value per second, the initial consumption time, the initial consumption position, the playback type, the white list configuration, the host port configuration and the transmission type of the target application.
5. The method of claim 4, wherein the obtaining the target traffic of the target application according to the configuration information comprises:
and acquiring the target flow in the data flow of the target application according to the initial consumption time.
6. The method according to claim 4, wherein the configuring the target traffic according to the configuration information, and sending the configured target traffic to at least two corresponding target services, so that the target services play back the target traffic and generate response information, includes:
decoding the target flow, and determining the decoded target flow meeting the white list configuration as a new target flow;
when the playback type is not the flow recording, encoding the new target flow according to a preset rule;
and respectively sending the encoded new target flow to at least two target services determined according to the configuration of the host port according to the amplification factor and the upper limit value of the query rate per second, so that the target services play back the target flow according to the repeated execution times, the initial consumption position and the transmission type and generate response information.
7. The method of claim 6, wherein after determining the decoded target traffic satisfying the white list configuration as new target traffic, further comprising:
when the playback type is flow recording, acquiring recording number information;
and recording the new target flow according to the amplification factor, the recording number information and the query rate per second upper limit value to obtain the recording flow containing recording interface information.
8. A flow rate comparison device, comprising:
the configuration information acquisition module is used for acquiring the configuration information of the target application;
the target flow obtaining module is used for obtaining the target flow of the target application according to the configuration information; wherein the target flow is the flow under a remote procedure call protocol;
the flow configuration module is used for configuring the target flow according to the configuration information and sending the configured target flow to at least two corresponding target services so that the target services can play back the target flow and generate response information;
and the flow comparison module is used for receiving the response information of the target service, decoding the response information so as to convert the response information from a binary format under the remote procedure call protocol into an object numbered musical notation format, and comparing the decoded response information to obtain a comparison result.
9. An apparatus, characterized in that the apparatus comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the traffic comparison method of any of claims 1-7.
10. A storage medium containing computer-executable instructions for performing the traffic comparison method of any of claims 1-7 when executed by a computer processor.
CN202011233289.3A 2020-11-06 2020-11-06 Flow comparison method, device, equipment and storage medium Pending CN114448825A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011233289.3A CN114448825A (en) 2020-11-06 2020-11-06 Flow comparison method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011233289.3A CN114448825A (en) 2020-11-06 2020-11-06 Flow comparison method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114448825A true CN114448825A (en) 2022-05-06

Family

ID=81361880

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011233289.3A Pending CN114448825A (en) 2020-11-06 2020-11-06 Flow comparison method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114448825A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030208616A1 (en) * 2002-05-01 2003-11-06 Blade Software, Inc. System and method for testing computer network access and traffic control systems
CN107122289A (en) * 2016-02-25 2017-09-01 阿里巴巴集团控股有限公司 The method of system regression test, apparatus and system
CN108696399A (en) * 2017-04-07 2018-10-23 腾讯科技(深圳)有限公司 The test method and device of business service
CN110457199A (en) * 2018-05-08 2019-11-15 北京京东尚科信息技术有限公司 The method and apparatus of performance test
CN110912783A (en) * 2019-12-18 2020-03-24 北京嘀嘀无限科技发展有限公司 Flow playback method and device, electronic equipment and storage medium
CN111010316A (en) * 2019-12-17 2020-04-14 广州唯品会信息科技有限公司 Flow playback method, device and system
CN111258897A (en) * 2020-01-15 2020-06-09 网银在线(北京)科技有限公司 Service platform testing method, device and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030208616A1 (en) * 2002-05-01 2003-11-06 Blade Software, Inc. System and method for testing computer network access and traffic control systems
CN107122289A (en) * 2016-02-25 2017-09-01 阿里巴巴集团控股有限公司 The method of system regression test, apparatus and system
CN108696399A (en) * 2017-04-07 2018-10-23 腾讯科技(深圳)有限公司 The test method and device of business service
CN110457199A (en) * 2018-05-08 2019-11-15 北京京东尚科信息技术有限公司 The method and apparatus of performance test
CN111010316A (en) * 2019-12-17 2020-04-14 广州唯品会信息科技有限公司 Flow playback method, device and system
CN110912783A (en) * 2019-12-18 2020-03-24 北京嘀嘀无限科技发展有限公司 Flow playback method and device, electronic equipment and storage medium
CN111258897A (en) * 2020-01-15 2020-06-09 网银在线(北京)科技有限公司 Service platform testing method, device and system

Similar Documents

Publication Publication Date Title
CN111083225A (en) Data processing method and device in Internet of things platform and Internet of things platform
CN113923057B (en) Data processing method and device for satellite measurement, operation and control platform, electronic equipment and medium
CN107085549B (en) Method and device for generating fault information
CN112333044B (en) Shunting equipment performance test method, device and system, electronic equipment and medium
CN114356785B (en) Data processing method and device, electronic equipment and storage medium
CN113225339B (en) Network security monitoring method and device, computer equipment and storage medium
KR20130123582A (en) Method for monitoring log and server thereof, and recording medium
CN106778264A (en) The application program analysis method and analysis system of a kind of mobile client
CN114692049A (en) Browser-based screen recording method and device, electronic equipment and storage medium
CN113742250B (en) Automatic interface testing method and device
EP3754998B1 (en) Streaming media quality monitoring method and system
CN113360413A (en) Code testing method and device
CN112615909B (en) Method for storing data in cascade storage server cluster and related equipment
CN114531345B (en) Flow comparison result storage method, device, equipment and storage medium
CN114448825A (en) Flow comparison method, device, equipment and storage medium
JP4487725B2 (en) Analytical data processing system and analyzer
CN116028811A (en) Data backtracking method, medium, device and computing equipment
CN111651330B (en) Data acquisition method, data acquisition device, electronic equipment and computer readable storage medium
CN112202598B (en) Log recording method and device
CN114363202A (en) Terminal access state monitoring method, device, system, electronic equipment and medium
CN111143526B (en) Method and device for generating and controlling configuration information of counsel service control
CN114092169A (en) Ordering test method and system and equipment for executing ordering test method
CN113407424A (en) Automatic analysis method and analysis system for user terminal application program
CN112988560A (en) Method and device for testing system robustness
CN117827588A (en) Event monitoring method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination