Protocol data recording, storage and query method, system and server
Through the first server monitoring its communication and recording protocol data, the protocol data between multiple client programs and server programs are directly collected, solving the problem of inefficiency in the prior art and realizing more efficient protocol data recording.
Patent Information
- Application Number
- CN202111477941.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2041-12-06
AI Technical Summary
In the prior art, when obtaining protocol data that interacts between multiple client programs and application servers, it is necessary to install data collection modules in multiple client programs, resulting in low efficiency in recording protocol data.
The first server monitors its communication, records protocol data, and obtains target protocol data from the protocol data based on the server program address information of the target application, and directly collects protocol data between multiple client programs and server programs.
There is no need to install a data collection module in multiple client programs, and the protocol data is collected directly through the first server, improving the efficiency of recording protocol data.
Smart Images

Figure CN114186104B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, system, server and storage medium for recording, storing and querying protocol data. Background Art
[0002] With the development of computer technology, application companies will develop various applications to provide different functions. For example, application companies will develop game applications to provide entertainment functions for users, and will also develop map applications to provide navigation functions for users. In the process of developing and maintaining applications, the protocol data for the interaction between the application client program and the application server is very important basic data.
[0003] In the related art, it is often necessary to install a data collection module in the client program of the application program, and to obtain the protocol data of the interaction between the client program and the application server through the data collection module.
[0004] However, when it is desired to obtain protocol data of interactions between multiple client programs and an application server, the data collection module needs to be installed in each of the multiple client programs. The recording cycle of the protocol data is relatively long, resulting in low efficiency in recording the protocol data. Summary of the invention
[0005] The embodiment of the present application provides a method, system, server and storage medium for recording, storing and querying protocol data, which can improve the efficiency of recording protocol data. The technical solution is as follows:
[0006] In one aspect, a method for recording protocol data is provided, which is performed by a first server, and the method includes:
[0007] Monitoring the communication of the first server to record protocol data of the first server during communication, wherein the protocol data includes protocol data sent by the first server and protocol data received by the first server;
[0008] Based on the address information of the server program of the target application on the first server, acquiring target protocol data from the protocol data;
[0009] The target protocol data includes protocol data for interaction between multiple client programs of the target application and a server program of the target application.
[0010] On the one hand, a method for storing protocol data is provided, which is performed by a second server, and the method includes:
[0011] Receive target protocol data, the target protocol data including protocol data for interaction between multiple client programs of a target application and a server program of the target application, the target protocol data being protocol data recorded by a first server, and the server program running on the first server;
[0012] Converting the target protocol data into a target format;
[0013] The target protocol data is stored in the target format.
[0014] On the one hand, a method for querying protocol data is provided, which is performed by a third server, and the method includes:
[0015] Sending a data query request to the second server, the data query request including address information of a client program to be queried and address information of a server program to be queried, the client program being a client program of a target application, and the server program being a server program of the target application;
[0016] Acquire second protocol data corresponding to the data query request from the second server, the second protocol data including protocol data for interaction between the client program and the server program, the second protocol data being protocol data recorded by the first server, and the server program running on the first server;
[0017] The second protocol data is sent to the data viewing client program, and the data viewing client program is used to display the second protocol data.
[0018] In one aspect, a protocol data recording device is provided, which is applied to a first server, and the device includes:
[0019] A monitoring module, used for monitoring the communication of the first server to record the protocol data of the first server during communication, wherein the protocol data includes the protocol data sent by the first server and the protocol data received by the first server;
[0020] A target protocol data acquisition module, configured to acquire target protocol data from the protocol data based on address information of a server program of a target application on the first server;
[0021] The target protocol data includes protocol data for interaction between multiple client programs of the target application and a server program of the target application.
[0022] In a possible implementation, the monitoring module is used to monitor a network card of the first server, and obtain protocol data of the first server during communication from the network card.
[0023] In a possible implementation, the target protocol data acquisition module is used to filter the protocol data based on the port number of the server program of the target application when it runs on the first server to obtain the target protocol data.
[0024] In a possible implementation, the device further includes:
[0025] A packet assembly module, used for assembling the target protocol data to obtain a target data packet;
[0026] The target data packet sending module is used to send the target data packet to the second server, and the second server is used to obtain the target protocol data from the target data packet and store the target protocol data.
[0027] On the one hand, a storage device for protocol data is provided, which is applied to a second server, and the device includes:
[0028] A target protocol data receiving module, used to receive target protocol data, wherein the target protocol data includes protocol data for interaction between multiple client programs of a target application and a server program of the target application, wherein the target protocol data is protocol data recorded by a first server, and the server program runs on the first server;
[0029] A format conversion module, used to convert the target protocol data into a target format;
[0030] A storage module is used to store the target protocol data in the target format.
[0031] In a possible implementation, the target protocol data receiving module is used to obtain a target data packet sent by the first server, where the target data packet is obtained after the first server packages the target protocol data; and perform at least one of decrypting, decompressing and decoding the target data packet to obtain the target protocol data.
[0032] In a possible implementation, the storage module is used to determine a plurality of storage processes corresponding to the target protocol data based on address information of the plurality of client programs carried by the target protocol data; and store the target protocol data based on the plurality of storage processes.
[0033] In one possible implementation, the storage module is used to determine the identifier of the storage process corresponding to each of the client programs based on the IP addresses and corresponding port numbers of the multiple client programs; and determine the multiple storage processes corresponding to the target protocol data based on the identifier of the storage process corresponding to each of the client programs.
[0034] In a possible implementation, the storage module is used to perform hash mapping on the IP address of each of the client programs and the corresponding port number to obtain an identifier of a storage process corresponding to each of the client programs.
[0035] In a possible implementation, the storage module is used to obtain, for a first client program among the multiple client programs, first protocol data corresponding to the first client program from the target protocol data based on the address information of the first client program; based on a storage process corresponding to the address information of the first client program, store the protocol data in the first protocol data belonging to the same transmission time period in the same storage unit, where the transmission time period is the time period from the first client program logging into the first server to logging out of the first server.
[0036] In a possible implementation, the device further includes:
[0037] The link generation module is used to generate multiple storage links corresponding to the multiple storage processes based on the address information of the server program of the target application and the address information of the multiple client programs, and the multiple storage links point to the storage units corresponding to the corresponding storage processes.
[0038] In a possible implementation, the device further includes:
[0039] A data query module is used to respond to a data query request and determine a target storage link based on the data query request, wherein the data query request carries address information of a client program to be queried and address information of a server program to be queried; obtain second protocol data from the target storage link and send the second protocol data to a sender of the data query request.
[0040] On the one hand, a device for querying protocol data is provided, which is applied to a third server, and the device includes:
[0041] A data query request sending module, used to send a data query request to the second server, wherein the data query request includes address information of a client program to be queried and address information of a server program to be queried, wherein the client program is a client program of a target application, and the server program is a server program of the target application;
[0042] A second protocol data acquisition module is used to acquire second protocol data corresponding to the data query request from the second server, wherein the second protocol data includes protocol data for interaction between the client program and the server program, and the second protocol data is protocol data recorded by the first server, and the server program runs on the first server;
[0043] A second protocol data sending module, used for sending the second protocol data to the data viewing client program, and the data viewing client program is used for displaying the second protocol data;
[0044] In a possible implementation manner, the second protocol data sending module is configured to generate a data viewing page based on the second protocol data; and send the data viewing page to the data viewing client program.
[0045] In one aspect, a storage system for protocol data is provided, the system comprising: a first server and a second server;
[0046] The first server is used to monitor the communication of the first server to record the protocol data of the first server during communication, wherein the protocol data includes the protocol data sent by the first server and the protocol data received by the first server;
[0047] The first server is further used to obtain target protocol data from the protocol data based on address information of a server program of the target application on the first server;
[0048] The first server is further configured to send the target protocol data to the second server;
[0049] The second server is used to receive the target protocol data and convert the target protocol data into a target format;
[0050] The second server is further configured to store the target protocol data in the target format.
[0051] In a possible implementation manner, the system further includes a third server;
[0052] The third server is used to send a data query request to the second server, wherein the data query request includes address information of a client program to be queried and address information of a server program to be queried, wherein the client program is a client program of a target application, and the server program is a server program of the target application;
[0053] The third server is used to obtain second protocol data corresponding to the data query request from the second server, where the second protocol data includes protocol data for interaction between the client program and the server program;
[0054] The third server is used to send the second protocol data to the data viewing client program, and the data viewing client program is used to display the second protocol data.
[0055] On the one hand, a computer device is provided, which includes one or more processors and one or more memories, wherein at least one computer program is stored in the one or more memories, and the computer program is loaded and executed by the one or more processors to implement the recording method of the protocol data, the storage method of the protocol data, and the query method of the protocol data.
[0056] On the one hand, a computer-readable storage medium is provided, in which at least one computer program is stored, and the computer program is loaded and executed by a processor to implement the recording method of the protocol data, the storage method of the protocol data, and the query method of the protocol data.
[0057] On the one hand, a computer program product or a computer program is provided, which includes a program code, which is stored in a computer-readable storage medium. A processor of a computer device reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the computer device executes the above-mentioned method for recording protocol data, the method for storing protocol data, and the method for querying protocol data.
[0058] Through the technical solution provided by the embodiment of the present application, when recording protocol data, the first server obtains the protocol data of the first server during interaction. After the first server collects the protocol data, it can obtain the target protocol data of the interaction between the client program and the server program of the target application from the protocol data. When it is necessary to collect protocol data for interaction between multiple client programs and server programs, there is no need to install a data collection module in multiple client programs. The corresponding protocol data can be directly collected through the first server, thereby improving the efficiency of recording protocol data. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 is a schematic diagram of the OSI model provided in an embodiment of the present application;
[0061] Figure 2 It is a schematic diagram of the implementation environment of the technical solution provided in the embodiment of the present application;
[0062] Figure 3 It is a schematic diagram of a server providing functions provided by an embodiment of the present application;
[0063] Figure 4 It is a flow chart of the technical solution provided by the embodiment of the present application;
[0064] Figure 5 It is a flow chart of the technical solution provided by the embodiment of the present application;
[0065] Figure 6 is a schematic diagram of a data viewing page provided in an embodiment of the present application;
[0066] Figure 7 is a schematic diagram of a data viewing page provided in an embodiment of the present application;
[0067] Figure 8 It is a flow chart of the technical solution provided by the embodiment of the present application;
[0068] Fig. 9 It is a structural diagram of a storage system for protocol data provided by an embodiment of the present application;
[0069] Fig.10 It is a structural diagram of a protocol data recording device provided in an embodiment of the present application;
[0070] Fig.11 It is a structural diagram of a storage device for protocol data provided in an embodiment of the present application;
[0071] Fig.12 It is a structural diagram of a device for querying protocol data provided in an embodiment of the present application;
[0072] Fig.13 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0073] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0074] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order.
[0075] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more. For example, a plurality of facial images means two or more facial images.
[0076] TPS (Transactions Per Second), in protocol testing, the larger the TPS, the higher the protocol communication frequency and the larger the communication data volume.
[0077] OSI / RM (Open System Interconnection Reference Model): The OSI / RM protocol was developed by ISO (International Organization for Standardization). It has three basic functions: providing developers with a necessary and common concept to develop and improve, and a framework that can be used to explain the connection between different systems. The OSI reference model does not provide an implementation method, but describes some concepts to coordinate the development of inter-process communication standards. That is, the OSI reference model is not a standard, but a conceptual framework used when developing standards.
[0078] See also Figure 1 , OSI divides the computer network architecture into the following seven layers:
[0079] Physical layer: Converts data into electronic signals that can be transmitted through physical media, equivalent to the porters in the post office.
[0080] Data Link Layer: Determines how to access the network medium. Data is framed and flow control is handled at this layer. This layer specifies the topology and provides hardware addressing, which is equivalent to the box loader in the post office.
[0081] Network layer: Usage rights data routing through large networks is equivalent to the sorting workers in the post office.
[0082] Transport layer: provides reliable end-to-end connections, which is equivalent to the postman running to the post office in the company.
[0083] Session layer: allows users to establish connections using simple and easy-to-remember names, which is equivalent to a secretary in a company who receives and sends letters, writes envelopes, and opens envelopes.
[0084] Presentation layer: Negotiating the data exchange format is equivalent to the assistant who briefs the boss and writes letters for the boss in a company.
[0085] Application layer: The interface between the user's application and the network.
[0086] The technical solution provided in the embodiment of the present application is applied between the physical layer and the data link layer.
[0087] It is understandable that in the specific implementation of this application, related data such as protocol data are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0088] Figure 2 This is a schematic diagram of the implementation environment of the technical solution provided in the embodiment of the present application, see Figure 2 , the implementation environment may include a terminal 210 , a first server 220 , a second server 230 , and a third server 240 .
[0089] The terminal 210 is connected to the first server 220 via a wireless network or a wired network. Optionally, the terminal 210 is a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The terminal 210 installs and runs a target application, and in some embodiments, the target application is a game application.
[0090] The first server 220 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, distribution networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. In some embodiments, the first server 220 provides a background server for the target application. When the target application is a game application, the first server 220 also provides a background server for the game application. Accordingly, the first server 220 is also called a game server. In some embodiments, a plurality of virtual machines are independently running on the target server, and each virtual machine is a server. The first server 220 is a server corresponding to a virtual machine on the target server. For example, the target server provides a background server for both application A and application B, that is, on the target server, server A corresponding to application A and server B corresponding to application B are independently running, and the data between server A and server B are isolated. When the target application is application A, the first server 220 is also server A. In some embodiments, see Figure 3In the process of recording protocol data, the functions of the first server 220 include protocol data capture, protocol data filtering and protocol data grouping. The introduction of these three functions will be carried out in turn in the subsequent description.
[0091] The second server 230 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, distribution networks, and big data and artificial intelligence platforms. In some embodiments, the second server 230 is used to process and transfer data during the application testing process. In some embodiments, see Figure 3 In the process of storing protocol data, the functions of the second server 230 include protocol data decompression, protocol data decryption, and protocol data decoding. The introduction of these three functions will be carried out in turn in the subsequent description. The second server 230 provides two storage methods: distributed storage and snapshot storage. The introduction of these two storage methods will be carried out in turn in the subsequent description.
[0092] The third server 240 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, distribution networks, and big data and artificial intelligence platforms. In some embodiments, the third server 240 user obtains data from the storage server 240 during the application testing process and visualizes the obtained data. In some embodiments, see Figure 3 During the application testing process, the third server 240 provides a historical protocol viewing service and a protocol real-time viewing service. The introduction of these two services will be carried out in turn in the subsequent description.
[0093] Those skilled in the art will appreciate that the number of the above-mentioned terminals and servers may be more or less. For example, there may be only one terminal and each server, or there may be dozens or hundreds of terminals and each server, or a greater number, in which case the above-mentioned implementation environment may also include other terminals and servers. The embodiment of the present application does not limit the number of terminals and device types.
[0094] After introducing the implementation environment provided by the embodiments of the present application, the application scenarios of the embodiments of the present application will be introduced in combination with the above-mentioned implementation environment. In the following description, the terminal is the terminal 210 in the above-mentioned implementation environment, the first server is the first server 220 in the above-mentioned implementation environment, the second server is the second server 230 in the above-mentioned implementation environment, and the third server is the third server 240 in the above-mentioned implementation environment.
[0095] The application target of the technical solution provided in the embodiment of the present application can be various target applications that implement corresponding functions based on the interaction between client programs and servers. For example, the method for recording protocol data provided in the embodiment of the present application can be applied in the process of testing various applications, such as in the process of testing game applications, or in the process of testing video playback applications, or in the process of testing shopping applications. In addition, the method for recording protocol data provided in the embodiment of the present application can also be applied in the process of maintaining various applications, such as in the process of maintaining game applications, or in the process of maintaining video playback applications, or in the process of maintaining shopping applications. In addition, the method for recording protocol data provided in the embodiment of the present application can also be applied in other scenarios where protocol data recording, storage and calling are required, and the embodiment of the present application does not limit this.
[0096] Taking the application of the technical solution provided in the embodiment of the present application in the process of testing a game application as an example, a server program of the target application is running on the first server. When the target application is a game application, the server program is also a server program that provides services for the game. The terminal starts the client program of the target application and communicates with the first server through the client program of the target application. The communication here is the communication between the client program and the server program running on the first server, wherein the communication between the client program and the first server is implemented based on protocol data. During the process of testing the game application process, there is a situation where multiple client programs of the game application communicate with the first server at the same time, and the testing of the game application is implemented based on the protocol data of the interaction between the multiple client programs and the first server.
[0097] The first server monitors the communication of the first server to record the protocol data when the first server communicates. The protocol data includes the protocol data sent by the first server and the protocol data received by the first server. That is, the protocol data is obtained by the first server monitoring itself, not obtained through other servers or terminals. In some embodiments, the function of the first server monitoring and recording protocol data is also called protocol data capture. After the first server obtains the protocol data, it can filter the obtained protocol data based on the address information of the server program of the target application on the first server to obtain the target protocol data. The target protocol data includes the protocol data for interaction between the server program and multiple client programs, that is, the protocol data sent by the server program to the multiple client programs through the first server, and the protocol data sent by the multiple client programs to the server program. The first server sends the target protocol data to the second server, and the second server processes and stores the target protocol data. In some embodiments, the second server converts the target protocol data into a target format and stores the target protocol data in the target format. During the application testing process, the technician can test the game application based on the protocol data stored in the second server. For example, the technician can call the protocol data stored in the second server through the third server, that is, the technician sends a data query instruction to the third server through the data viewing client program, and the third server sends a data query request to the second server based on the data query instruction. The second server obtains the corresponding protocol data based on the data query request, and sends the obtained protocol data to the third server. The third server visualizes the protocol data and sends the visualized protocol data to the data viewing client program. The technician can see the protocol data he wants to query through the data viewing client program.
[0098] It should be noted that the above description is based on the example of a target application being a game application. When the target application is a video playback application or a shopping application, the implementation process belongs to the same inventive concept as the above description and will not be repeated here.
[0099] Of course, the method for recording, storing, and viewing protocol data provided in the embodiment of the present application can be applied not only to the scenario of testing the application, but also to the maintenance of the application and other scenarios requiring protocol data recording, storage, and calling, and the embodiment of the present application does not limit this.
[0100] After introducing the implementation environment and application scenarios of the embodiments of the present application, the technical solutions provided by the embodiments of the present application will be described below. Figure 4 , methods include:
[0101] 401. A first server monitors communication of the first server to record protocol data of the first server during communication, where the protocol data includes protocol data sent by the first server and protocol data received by the first server.
[0102] Among them, the first server is the background server of the target application. The first server is used to provide background services for the target application. When the first server communicates with the outside world, it is achieved by sending protocol data to each other. The first server can monitor its communication with the outside world to obtain the sent and received protocol data. It should be noted that the outside world here refers to other servers and terminals.
[0103] 402. The first server obtains target protocol data from the protocol data based on address information of a server program of the target application on the first server.
[0104] Among them, the server program of the target application runs on the first server and is used to provide services for the client program of the target application. The target protocol data includes protocol data for interaction between multiple client programs of the target application and the server program of the target application. That is, the target protocol data includes both protocol data sent to the server program by multiple client programs of the target application through the first server, and protocol data sent to multiple client programs by the server program through the first server. In some embodiments, the address information of the server program of the target application on the first server is an address for indicating that the client program communicates with the server program, and the client program of the target application can interact with the server program running on the server based on the address information. In some embodiments, the target protocol data is used to test the target application, or the target protocol data is used to maintain the target application.
[0105] The above steps 401 and 402 are the method for recording protocol data provided in the embodiment of the present application.
[0106] 403. The first server sends target protocol data to the second server.
[0107] The second server is used to process and store the target protocol data.
[0108] 404. The second server receives the target protocol data.
[0109] 405. The second server converts the target protocol data into a target format.
[0110] Among them, the target format is the format set by the technician, and the second server can convert target protocol data in different formats into the same target format to facilitate subsequent storage and calling.
[0111] 406. The second server stores the target protocol data.
[0112] The above steps 403-405 are a method for storing protocol data provided in an embodiment of the present application.
[0113] 407. The third server sends a data query request to the second server, where the data query request includes address information of the client program to be queried and address information of the server program to be queried.
[0114] The third server can obtain the protocol data from the second server, and send the obtained protocol data to the data viewing client program, and the protocol data is displayed through the data viewing client program.
[0115] 408. The third server obtains second protocol data corresponding to the data query request from the second server, where the second protocol data includes protocol data for interaction between the client program and the server program, and the second protocol data is protocol data recorded by the first server.
[0116] 409. The third server sends the second protocol data to the data viewing client program, and the data viewing client program is used to display the second protocol data.
[0117] The above steps 406-409 are a method for querying protocol data provided in an embodiment of the present application.
[0118] Through the technical solution provided by the embodiment of the present application, when recording protocol data, the first server obtains the protocol data of the first server during interaction. After the first server collects the protocol data, it can obtain the target protocol data of the interaction between the client program and the server program of the target application from the protocol data. When it is necessary to collect protocol data for interaction between multiple client programs and server programs, there is no need to install a data collection module in multiple client programs. The corresponding protocol data can be directly collected through the first server, thereby improving the efficiency of recording protocol data.
[0119] In addition, the first server also sends the target protocol data to the second server, which further processes the data, thereby decoupling data collection and data processing and improving the efficiency of data collection and data processing. The second server can also store the processed target protocol data so that technicians can query and call the protocol data at any time.
[0120] In addition, when a protocol data query is needed, the technician can also obtain the protocol data that he wants to view through a third server, which helps the technician to use the protocol data.
[0121] The above steps 401-409 are a brief introduction to the technical solution provided by the embodiment of the present application. The following will combine some examples to more clearly explain the technical solution provided by the embodiment of the present application. Figure 5 , methods include:
[0122] 501. A first server monitors communication of the first server to record protocol data of the first server during communication, where the protocol data includes protocol data sent by the first server and protocol data received by the first server.
[0123] Among them, the first server can provide background services for the target application, and the first server is also called an application server. In some embodiments, a server program of the target application runs on the first server, and the first server provides background services for the target application through the server program. When the server program on the first server communicates with the client program of the target application, it is achieved by sending protocol data to each other. Protocol data is data that conforms to a certain communication protocol. For example, the protocol data is data that conforms to TCP / IP (Transmission Control Protocol / Internet Protocol). Of course, with the development of technology, protocol data can also be data that conforms to other transmission protocols, and the embodiments of the present application do not limit this. The protocol data includes multiple messages. In some embodiments, the first server is a Linux server. The full name of Linux is GNU / Linux, which is a Unix-like operating system. See. Figure 3 , step 501 is the protocol data capture service provided by the first server.
[0124] In a possible implementation, the first server monitors a network card of the first server, and obtains protocol data of the first server during communication from the network card.
[0125] The network card of the first server is an intermediary device that connects the first server with other servers and electronic devices. The first server sends and receives protocol data through the network card. Since the network card has a MAC (Media Access Control Address), it belongs between the first physical layer and the second data link layer of the OSI model. Figure 1 The relationship between the OSI model and the network card of the first server is also shown.
[0126] In this implementation mode, the first server can directly obtain the protocol data of the first server during communication from the network card without the need for recording with the help of the application client program, thus saving the time of installing the recording tool on multiple client programs of the target application. When the technical solution provided in the embodiment of the present application is applied in the scenario of application testing, it also saves the time of application testing and improves the efficiency of application testing. In addition, obtaining the protocol data directly from the network card means that there is no need for terminal sending, which can also save network resources.
[0127] For example, a protocol recording device is installed on the first server, and the protocol recording device can obtain the protocol data sent and received by the first server through the network card. The protocol recording device can be a virtual device or a physical device, and the embodiment of the present application does not limit this. The first server monitors the network card through the protocol recording device to record the network data packet in the network card, and the network data packet includes the protocol data when the first server communicates. During operation, the first server will not only communicate with the client program of the target application, but also communicate with the client program of other applications. For example, in the process of communicating with the client program of the target application on the first server, the first server may also communicate with the client program of another application at the same time, or communicate with other servers. Communication here refers to sending and receiving protocol data. Since the first server sends and receives protocol data based on the network card, the data packet obtained by the protocol recording device from the network card includes not only the protocol data for interaction between the first server and the client program of the target application, but also the protocol data for interaction between the first server and the client program of other applications or other servers.
[0128] For example, when the target application is a game application, the first server can also be called a game server. The protocol data sent by the client program of the target application to the game server includes a request for obtaining game-related data, an account verification request, and operation data in the game, etc., wherein the game-related data includes data for rendering game scenes, data for virtual props in the game, data for virtual objects in the game, etc.; the account verification request is a request for requesting verification of the game account logged in on the client program; the operation data in the game is data corresponding to the player's operation in the game, such as data for the player to control the movement of virtual objects in the game, data for the player to control the virtual objects to release virtual skills in the game, and data for the player to control the virtual objects to use virtual props in the game, etc. The protocol recording device on the first server monitors and records network data packets in the network card of the game server based on libnids (Network Intrusion Detect System library, network intrusion monitoring system function library). Among them, libnids supports TCP / UDP protocol, supports TCP message reassembly, supports data packet IP segment reassembly and other functions, and libnids supports multi-threaded protocol data capture, with efficient protocol data recording performance. Of course, with the development of technology, other function libraries that support protocol data recording may appear, and the protocol recording device can also record the protocol data of the first server communication based on other types of function libraries. The embodiment of the present application does not limit this.
[0129] 502. The first server obtains target protocol data from the protocol data based on address information of a server program of the target application on the first server.
[0130] Among them, the target protocol data includes protocol data for interaction between multiple client programs of the target application and the server program of the target application. In some embodiments, the target protocol data is used to test the target application, or to maintain the target application, etc. In some embodiments, the address information of the server program of the target application on the first server is an address used to indicate that the client program communicates with the server program of the target application, and the client program of the target application can interact with the server program running on the server based on the address information. In other words, when the client program of the target application interacts with the server program running on the first server, the protocol data sent by the client program to the first server carries the address information of the server program on the first server. Correspondingly, the protocol data sent by the server program to the client program through the first server also carries the address information of the server program on the first server. The first server can filter out the target protocol data from the protocol data based on the address information of the server program of the target application on the first server. The target protocol data includes multiple messages. See. Figure 3 , step 502 is the protocol data filtering service provided by the first server.
[0131] In a possible implementation, the first server filters the protocol data based on the port number of the server program of the target application when it runs on the first server to obtain the target protocol data.
[0132] The address information of the server program of the target application on the first server is also the port number of the target application on the first server.
[0133] In this implementation, since the client program of the target application needs to interact with the server program of the target application, when the client program of the target application sends protocol data to the first server, it will carry the port number of the target application's server program running on the first server. The port number corresponds to the process, and the first server sends the protocol data to the process corresponding to the server program of the target application based on the port number. Correspondingly, when the server program of the target application sends protocol data to the client program through the first server, it will also carry the port number of the server program to indicate the source of the data. The first server is more efficient in filtering out the target protocol data from the protocol data based on the port number of the target application's server program when it is running on the first server.
[0134] For example, the first server compares the port number of the target application's server program when it is running on the first server with the message header of the recorded message in the protocol data. When the message header of any message in the protocol data carries the port number, it indicates that the message is a message for interaction between the target application's client program and the server program, and the first server retains the message; when the message header of another message in the protocol data does not carry the port number, it indicates that the message is not a message for interaction between the target application's client program and the server program, and the first server deletes the message. Through the above process, the retained messages constitute the target protocol data, and the first server achieves the purpose of obtaining the target protocol data from the protocol data.
[0135] In a possible implementation, the first server filters the protocol data based on the port number of the server program of the target application when it runs on the first server and the IP address of the first server to obtain the target protocol data.
[0136] Among them, the address information of the server program of the target application on the first server includes the port number of the server program of the target application on the first server and the IP address of the first server. In this case, the first server is a virtual machine on the target server, and multiple virtual machines are independently running on the target server. One virtual machine corresponds to one server, and each virtual machine has a different IP (Internet Protocol) address. Multiple virtual machines can provide background services for different applications. In other words, the target server is a physical server, and multiple virtual machines are deployed on this physical server. The functions of multiple servers are realized by the multiple virtual machines, and the first server is a virtual server on the target server. Different virtual machines can be distinguished by IP addresses, and different virtual servers on the target server can also be distinguished.
[0137] Through the above implementation, when the first server is a virtual machine on the target server, the protocol data can be quickly screened with high efficiency.
[0138] For example, in this case, the recorded protocol data is the protocol data sent by the target server and the protocol data received by the target server. Since there are multiple virtual machines on the target server, the protocol data recorded through the network card also covers the protocol data when multiple virtual machines communicate. The first server filters the protocol data based on the IP address of the first server to obtain reference protocol data, which is also the protocol data when the first server communicates. The first server filters the reference protocol data based on the port number of the server program of the target application on the first server to obtain the target protocol data.
[0139] For example, the first server compares the IP address of the first server with the message header of the message in the protocol data. When the message header of any message in the protocol data carries the IP address of the first server, it means that the message is a message when the first server is communicating, and the first server retains the message; when the message header of another message in the protocol data does not carry the IP address of the first server, it means that the message is not a message when the first server is communicating, and the first server deletes the message. Through the above process, the retained message constitutes the reference protocol data. The first server compares the port number of the server program of the target application when it is running on the first server with the message header of the reference protocol data. In the case where the port number is carried in the message header of any message in the reference protocol data, it indicates that the message is a message for interaction between the client program of the target application and the server program, and the first server retains the message; in the case where the port number is not carried in the message header of another message in the reference protocol data, it indicates that the message is not a message for interaction between the client program of the target application and the server program, and the first server deletes the message. Through the above process, the retained message also constitutes the target protocol data.
[0140] During the test, a 6-core / 16G memory Linux server was used to deploy the protocol data recording service. At a communication frequency of 1500TPS (if the client program communicates with the server once per second, the protocol data of 1500 client programs can be recorded simultaneously). At the same time, the CPU single-core occupancy rate can be kept at about 10%, and the memory occupancy rate can be kept at 0.08%, which basically has no impact on the operation of the Linux server.
[0141] 503. The first server packages the target protocol data to obtain a target data packet.
[0142] In a possible implementation, the first server packages the target protocol data based on the target protocol to obtain a reference data packet, which is also a data packet of the target protocol. The target protocol is an agreed protocol, which is set by the technician according to the actual situation, and the embodiment of the present application does not limit this. The first server obtains the target data packet based on the reference data packet. Figure 3 , step 503 is the protocol data packet service provided by the first server.
[0143] For example, the first server obtains the address information and the sending and receiving time corresponding to each message in the target protocol data, wherein the address information corresponding to the message is used to indicate the sender and receiver of the message, and the sending and receiving time of the message is used to determine the corresponding time when storing and querying the protocol data. The first server packages the target protocol data based on the target protocol to obtain a reference data packet. The first server packages the reference data packet, the address information and the sending and receiving time corresponding to each message in the reference data packet to obtain the target data packet. In some embodiments, the first server can also package the reference data packet, the address information and the sending and receiving time corresponding to each message in the reference data packet, and the size of the reference data packet to obtain the target data packet, and the size of the reference data packet can be used to verify the data packet to ensure the integrity of the data packet.
[0144] For example, the first server obtains the address information and the sending and receiving time of each message based on the message headers of multiple messages in the target protocol data, wherein the address information includes the source IP, destination IP, source port number and destination port number of the corresponding message. For the message sent by the target application running on the first server to the target application running on the terminal, the source IP of the message is the IP of the first server, the destination IP is the IP of the terminal, the source port number is the port number corresponding to the server program of the target application running on the first server, and the destination port number is the port number corresponding to the client program of the target application running on the terminal. The first server assembles the target protocol data through libnids to obtain a reference data packet, which is a data packet of the TCP / UDP protocol. The first server packages the reference data packet, the address information corresponding to each message in the reference data packet, and the sending and receiving time to obtain the target data packet. Alternatively, the first server can also package the reference data packet, the address information corresponding to each message in the reference data packet, the sending and receiving time, and the size of the reference data packet to obtain the target data packet. In some embodiments, the target data packet also carries the account number used to log in to the client program, so as to facilitate subsequent queries based on the account number. When the client program is a game client program and the first server is a game server, the account number is also a game account.
[0145] In some embodiments, in the above implementation, when the first server obtains the target data packet based on the reference data packet, the first server can also encrypt, compress and serialize the reference data packet to obtain the target data packet, wherein serialization is also called encoding, which is the process of processing data according to preset rules. By encrypting the reference data packet, the security of the data packet transmission process can be improved; by compressing the reference data packet, the size of the data packet can be reduced to improve the transmission efficiency of the data packet; serialization is a personalized configuration for different electronic devices so that the target data packet can be processed by the electronic device that receives it later.
[0146] For example, the first server packages the reference data packet, the address information corresponding to each message in the reference data packet, and the sending and receiving time to obtain the target data packet. Alternatively, the first server can also package the reference data packet, the address information corresponding to each message in the reference data packet, the sending and receiving time, and the size of the reference data packet. In the process of obtaining the target data packet, the first server can perform at least one of encryption, compression, and serialization during the packaging process to obtain the target data packet.
[0147] 504. The first server sends the target data packet to the second server.
[0148] The above steps 501-504 are a method for recording protocol data provided in an embodiment of the present application.
[0149] 505. The second server obtains the target data packet.
[0150] The second server is also called a relay server and is used to process the protocol data.
[0151] 506. The second server performs at least one of decryption, decompression and decoding on the target data packet to obtain the target protocol data.
[0152] In a possible implementation, the second server performs at least one of decryption, compression, and decoding on the target data packet based on the configuration file to obtain the target protocol data. Figure 3 , step 506 is the protocol data decompression, protocol data decryption and protocol data decoding services provided by the second server.
[0153] Among them, the configuration file is a file prepared in advance by the technician, and the configuration file is used to indicate whether to decrypt, decompress and decode the target data packet. In some embodiments, when it is determined to decrypt the target data packet, the configuration file also includes a method for decrypting the target data packet, for example, the configuration file includes a key for decrypting the target data packet; when it is determined to decompress the target data packet, the configuration file also includes a way to decompress the target data packet; when it is determined to decode the target data packet, the configuration file also includes a way to decode the target data packet; when it is determined to decrypt and decompress the target data packet, the configuration file also includes the order of decrypting and decompressing the target data packet. Decoding refers to deserializing the target data packet. For example, if the target protocol data is serialized through Protocol Buffers (Protobuf), the data format generated after deserialization is the Protocol Buffers data format.
[0154] For example, if the target data packet sent by the first server to the second server is encrypted, the second server can decrypt the target data packet based on the configuration file to obtain the target protocol data; if the target data packet sent by the first server to the second server is compressed, the second server can decompress the target data packet based on the configuration file to obtain the target protocol data; if the target data packet sent by the first server to the second server is encoded, the second server can decode the target data packet based on the configuration file to obtain the target protocol data. In some embodiments, the target data packet is a TCP / UDP data packet.
[0155] In some embodiments, when the client program sends protocol data to the first server, it will perform encryption and compression. In this case, the first server packages the reference data packet, the address information corresponding to each message in the reference data packet, and the sending and receiving time. In the process of obtaining the target data packet, the first server does not need to perform encryption or compression operations, but only needs to encode. Accordingly, the method for decrypting the target data packet recorded in the configuration file corresponds to the method for encrypting the protocol data by the client program, and the method for decompressing the target data packet recorded in the configuration file corresponds to the method for compressing the protocol data by the client program. That is, when the protocol data communicated between the client program and the first server is encrypted, the decryption operation of the data is configured on the second server, and the configured decryption operation of the data is recorded in the configuration file; when the protocol data communicated between the client program and the first server is compressed, the decompression operation of the data is configured on the second server, and the configured decompression operation of the data is recorded in the configuration file.
[0156] Through step 506, the recorded protocol data is processed by the second server, thereby achieving decoupling of the recording and processing processes of the protocol data, improving the efficiency of data recording and processing, and improving the scalability of the data processing module.
[0157] 507. The second server converts the target protocol data into a target format.
[0158] Among them, the target format is the format set by the technician, and the second server can convert target protocol data in different formats into the same target format to facilitate subsequent storage and calling.
[0159] In a possible implementation, the second server performs format conversion on the target protocol data to obtain the target protocol data in the target format, wherein the process of the relay server performing format conversion on the target protocol data can be implemented by a format conversion tool installed on the second server, and the format conversion tool can convert protocol data of different formats into the target format. In some embodiments, the second server uses the format conversion tool to convert the target protocol data into JSON format, which is a lightweight data exchange format that uses a text format completely independent of the programming language to store and represent data, and has a concise and clear hierarchical structure.
[0160] It should be noted that in the above description, the example of the second server converting the target protocol data into JSON format is used for explanation. In other possible implementations, the second server can also convert the target protocol data into other formats, and the embodiment of the present application does not limit this.
[0161] In some embodiments, after step 507, the second server can store the target protocol data in the target format. During the storage process, the second server can store the target protocol data in the target format in its own storage medium, or can use a storage server to store the target protocol data in the target format, wherein the storage server is a subserver of the second server, or the storage server is an independent server. In the following description, the second server uses the storage server to store the target protocol data as an example. When the second server stores the target protocol data in the target format in its own storage medium, the implementation process and the method for storing the target protocol data by the storage server belong to the same inventive concept.
[0162] 508. The second server sends the target protocol data in the target format to the storage server.
[0163] 509. The storage server obtains the target protocol data in the target format.
[0164] 510. The storage server determines multiple storage processes corresponding to the target protocol data based on address information of multiple client programs carried by the target protocol data.
[0165] Among them, the address information of the client program is also the communication address of the client program. In some embodiments, the address information of the client program includes the IP address of the terminal where the client program is located and the port number of the client program. The first server can send protocol data to the corresponding client program based on the address information of the client program. Of course, when the client program sends protocol data to the first server, it will also carry its own address information to indicate its identity. The storage server determines the corresponding storage process based on the address of the client program. For the protocol data corresponding to the same client program in the target protocol data, the storage server can use the same storage process to store the protocol data of the same client program, which is convenient for subsequent queries.
[0166] In a possible implementation, the storage server determines the identifier of the storage process corresponding to each client program based on the IP addresses and corresponding port numbers of the multiple client programs. The storage server determines the multiple storage processes corresponding to the target protocol data based on the identifier of the storage process corresponding to each client program.
[0167] Under this implementation, the storage process is determined based on the IP address and port number of the client program. This ensures that the protocol data of a client program will be stored through the same storage process. Since the same storage process points to the same storage location, the storage server will store the protocol data of the same client program in the same storage location. This ensures the continuity of the protocol data of the same client program and improves subsequent query efficiency.
[0168] For example, the storage server encrypts the IP addresses and corresponding port numbers of each client program based on an asymmetric encryption algorithm through a storage task distribution node to obtain the identification of the storage process corresponding to each client program. The storage server determines the corresponding storage process through the identification of the storage process. For example, the storage server performs hash mapping on the IP addresses and corresponding port numbers of each client program through a storage task distribution node to obtain the identification of the storage process corresponding to each client program, and the identification is also a hash value. The storage server determines the storage process corresponding to the identification of the storage process through the storage task distribution node. In some embodiments, the storage server performs hash mapping on the IP addresses and corresponding port numbers of each client program through the storage task distribution node to obtain the identification of the storage process corresponding to each client program. In the process, the storage server can splice the IP addresses and corresponding port numbers of each client program through the storage task distribution node to obtain the spliced address information. The storage server performs hash mapping on the spliced address information through the storage task distribution node to obtain the identification of the storage process corresponding to each client program.
[0169] It should be noted that in the above description, the asymmetric encryption algorithm is taken as an example of hash mapping. In other possible implementations, the asymmetric encryption algorithm involved in the embodiments of the present application can also be other types of encryption algorithms, and the embodiments of the present application do not limit this.
[0170] 511. The storage server stores the target protocol data based on the multiple storage processes.
[0171] In a possible implementation, for a first client program among the multiple client programs, the storage server obtains first protocol data corresponding to the first client program from the target protocol data based on the address information of the first client program. The storage server stores protocol data belonging to the same transmission time period in the first protocol data in the same storage unit based on the storage process corresponding to the address information of the first client program, and the transmission time period is the time period from the first client program logging in to the first server to logging out of the first server.
[0172] In some embodiments, a transmission time period is referred to as a login session, where the login session refers to the period from when the client program actively logs in to the first server to when it actively logs out of the first server, or when it is automatically kicked offline by the first server because it has not communicated with the first server for a long time. A storage unit corresponds to a session. Under this embodiment, the storage server can store the target protocol data in a multi-process manner, which can improve the efficiency of storing the target protocol data. At the same time, when storing the protocol data information corresponding to different client programs in the target protocol data, the protocol data of the same client program in the same transmission time period will be stored in the same storage unit, which can ensure the continuity of the protocol data stored by the same client program. This storage method allows the protocol data stored in each storage unit to have good time continuity, and is convenient for subsequent identification and viewing of historical protocol data by using different login times.
[0173] In some embodiments, the storage server stores the target protocol data based on the FastDFS distributed file system. The FastDFS distributed file system can continuously store the recorded protocol data for more than one year. In addition, when the storage capacity of the storage server is insufficient, the storage server can be dynamically expanded without the user's perception.
[0174] In a possible implementation, in the process of the storage server storing the target protocol data based on the multiple storage processes, the storage server can also generate multiple storage links corresponding to the multiple storage processes based on the address information of the server program of the target application and the address information of the multiple client programs, and the multiple storage links point to the storage units of the corresponding storage processes respectively. The multiple storage links are stored in the cache of the storage server for fast query.
[0175] For example, when the storage server stores each login session based on the FastDFS distributed file system, it will generate a unique URL (Uniform Resource Locator) pointing to the storage address of the corresponding storage unit. The URL is also a link. At this time, the storage task distribution node stores the URL of the storage address, the source IP of the protocol data, the source port number, the destination IP, the destination port number, the login session start time and other information in Redis. When the protocol data belonging to the same login session arrives at the storage server, it can quickly match the URL address of the login session stored in the FastDFS distributed file system corresponding to the specified source IP and source port number by querying Redis (RemoteDictionary Server), and then complete the storage operation with high efficiency. Among them, Redis is the service corresponding to the cache of the storage server, or the service corresponding to the FastDFS distributed file system. See Figure 3 , steps 510 and 511 are the distributed file storage and Redis snapshot storage services provided by the storage server.
[0176] The above steps 505-511 are a method for storing protocol data provided in an embodiment of the present application.
[0177] Through the above steps 501-511, the recording and storage of the target protocol data are realized. In order to facilitate the viewing and calling of the target protocol data, the embodiment of the present application also provides the following data query method.
[0178] 512. The third server sends a data query request to the storage server, where the data query request includes address information of a client program to be queried and address information of a server program to be queried, where the client program is a client program of a target application and the server program is a server program of the target application.
[0179] In a possible implementation, in response to a data query instruction of a data viewing client program, the third server sends a data query request to the storage server, where the data query instruction includes address information of the client program to be queried and address information of the server program to be queried.
[0180] Among them, the data viewing client program can display protocol data, and the data viewing client program provides the technician with a protocol data viewing function, and the technician can view the protocol data through the data viewing client program. The data viewing client program can communicate with the storage server. The data viewing request is triggered by the storage server based on the data query instruction sent by the data viewing client program, and the data viewing request carries all the contents in the data query instruction. The client program is also the client program that wants to query. In some embodiments, the address information of the client program includes the IP address of the terminal running the client program and the port number of the client program running on the terminal. The address information of the server program to be queried includes the IP address of the server where the server program is located and the port number when the server program is running. In some embodiments, the third server is also referred to as a data viewing server or a Web (World Wide Web) server.
[0181] In order to explain the above implementation steps more clearly, the method of sending a data query instruction from the data viewing client program to the third server is explained below.
[0182] In a possible implementation, the terminal runs the data viewing client program and displays the data viewing page of the data viewing client program. The data viewing page includes a server program selection area and a client program selection area. The server program selection area is used to select the server program; the client program selection area is used to select the client program of the target application. In some embodiments, the identifier of the server where the server program is located is used to represent the corresponding server program, and the account logged in on the client program is used to represent the corresponding client program, or the account logged in on the client program corresponds to the address information of the client program. In response to the selection operation on the server program selection area and the client program selection area, the terminal displays the selected server program and the selected client program. The selected server program is also the server program to be queried, and the selected client program is also the client program to be queried. In response to the operation on the data viewing page, the terminal sends a data query instruction to the third server through the data viewing client program, and the data query instruction includes the address information of the client program and the address information of the server program.
[0183] It should be noted that the data viewing client program provides two protocol data viewing functions, one is a real-time protocol data viewing function, and the other is a historical protocol data viewing function.
[0184] For the real-time protocol data viewing function, the data viewing client program can establish a long connection with the third server and obtain the protocol data stored on the storage server from the third server in real time. That is, the data query instruction sent by the data viewing client program to the third server carries the real-time receiving function identifier. After the third server obtains the data query instruction, it can obtain the real-time receiving function identifier from the data query instruction, and establish a long connection with the storage server based on the real-time receiving function identifier to obtain the protocol data from the storage server in real time. For example, see Figure 6 , the terminal displays the data viewing page 600 of the data viewing client program, selects "Real-time View of Protocol" on the data viewing page 600, selects the server program in the server program selection area 601 of the data viewing page 600, and selects the client program in the client program selection area 602. In response to the click operation on the real-time viewing control 603, the terminal sends a data query instruction to the third server through the data viewing client program, and the data query instruction carries a functional identifier of real-time reception. The terminal can display the protocol data obtained in real time in the protocol data display area 604. In some embodiments, in response to the click operation on the pause refresh control 605, the data viewing client program stops receiving protocol data. In some embodiments, the protocol data display area 604 displays the name of the protocol data, the time of the protocol data, the size of the protocol data, the type of the protocol data, the field information in the protocol data packet, etc. The query method for protocol data provided in the embodiment of the present application supports real-time viewing of protocol data, that is, the communication protocol data between the specified client program and the first server where the protocol recording service is deployed can be viewed in real time. In some embodiments, the data viewing page 600 also provides functions such as template editing, protocol testing, protocol data analysis, protocol comparison and project configuration, among which template editing is used to layout the data viewing page 600, that is, to adjust the position of each display module in the data viewing page 600; protocol testing is used to select different protocol data for testing; protocol data analysis is used to perform statistical analysis on protocol data; protocol comparison is used to compare different protocol data; project configuration is used to configure related projects of the target protocol data.
[0185] For the historical protocol data viewing function, the data viewing client program sends a data query instruction to the third server, which carries the historical time period. After the third server obtains the data query instruction, it can generate a data query request based on the data query instruction. After receiving the data query request, the storage server obtains the historical time period from the data query request, performs a query based on the historical time period, and obtains the protocol data corresponding to the historical time period. For example, see Figure 7, the terminal displays the data viewing page 700 of the data viewing client program, selects "Historical Protocol View" on the data viewing page 700, selects the first server in the server program selection area 701 of the data viewing page 700, that is, selects the server program of the target application on the first service, selects the client program in the client program selection area 702, and selects the historical time period in the historical time period selection area 703. In response to the click operation on the historical viewing control 704, the terminal sends a data query instruction to the third server through the data viewing client program, and the data query instruction carries the historical time period. The terminal can display the acquired protocol data in the protocol data display area 705. The query method for protocol data provided in the embodiment of the present application supports efficient query of historical protocol data, and the data query can achieve a millisecond-level response speed.
[0186] See also Figure 3 The above-mentioned real-time protocol data viewing and historical protocol data viewing are also real-time protocol data viewing services and historical protocol data viewing services provided by the storage server.
[0187] 513. The third server obtains second protocol data corresponding to the data query request from the storage server, where the second protocol data includes protocol data for interaction between the client program and the server program, and the second protocol data is protocol data recorded by the first server.
[0188] In a possible implementation, in response to a data query request sent by a third server, the storage server determines a target storage link based on the data query request, the data query request carries address information of a client program to be queried and address information of a server program to be queried. The storage server obtains the second protocol data from the target storage link and sends the second protocol data to the third server.
[0189] For example, in response to a data query request sent by a third server, the storage server queries the cache based on the address information of the client program and the address information of the server program carried in the data query request to obtain a target storage link. The storage server obtains the second protocol data from the target storage link and sends the second protocol data to the third server. For example, when the storage server receives a user's request to view protocol data, it will query the corresponding login session in Redis through the server IP where the server program is located, the port number of the server program, the terminal IP where the client program is located, the port number of the client program, and the login Session start time. The storage address URL in FastDFS, where the server IP where the server program is located and the port number of the server program are collectively referred to as the address information of the server program; the terminal IP where the client program is located and the port number of the client program are collectively referred to as the address information of the client program. Then, the FastDFS storage address pointed to by the URL is accessed through the FastDFS client program, and the protocol data stored in FastDFS is obtained, which is also the second protocol data.
[0190] 514. The third server sends the second protocol data to the data viewing client program.
[0191] In a possible implementation, the third server generates a data viewing page based on the second protocol data, and sends the data viewing page to the data viewing client program.
[0192] In this implementation, the third server can visualize the second protocol data, generate a data viewing page, and send the data viewing page to the data viewing client program. The data viewing client program can display the data viewing page.
[0193] For example, the third server displays the second protocol data on the data viewing page through a structured display of data based on Vue (progressive framework).
[0194] In order to more clearly illustrate the technical solution provided in the embodiment of the present application, Figure 8 Together with the above steps 501-514, the technical solution provided in the embodiment of the present application is described.
[0195] See also Figure 8, taking the first server as game server 801 and the client program as game client program as an example, game server 801 monitors the network card and records the protocol data through libnids library. Game server 801 performs data filtering on the protocol data obtained from the network card to obtain target protocol data. In the process of data filtering, game server 801 performs data filtering based on the destination IP address (IP address of game server 801) and destination port number (port number when the server program of the target application runs on game server 801) of the protocol data. The target protocol data is also the protocol data for interaction between game server 801 and the game client program. Game server 801 groups the target protocol data to obtain a reference data packet. Game server 801 packages the reference data packet, the address information corresponding to each message in the reference data packet, the sending and receiving time, and the size of the reference data packet to obtain the target data packet, wherein the address information includes the source IP, destination IP, source port number, and destination port number of the corresponding message. Game server 801 sends the target data packet to relay server 802. The relay server 802 receives the target data packet, and decompresses and decrypts the target data packet based on the configuration file. The relay server 802 decodes (deserializes) the decrypted or decompressed data packet to obtain the target protocol data. The relay server 802 converts the target protocol data into JSON format, and sends the target protocol data in JSON format to the storage server 803. The storage server 803 encrypts the IP address and the corresponding port number of each client program based on the asymmetric encryption algorithm through the storage task distribution node, obtains the identification of the storage process corresponding to each client program, and the corresponding storage process can be determined by the identification of the storage process. The storage server 803 calls different storage processes to store the target protocol data in different storage units through the storage task distribution node, and the storage unit is a storage unit of the FastDFS distributed file system. In some embodiments, the storage unit is also referred to as a storage container. In the process of storing the target protocol data, the first server generates multiple storage link URLs corresponding to multiple storage processes respectively through the storage task distribution node, and stores the storage link in the cache Redis. The data viewing client program sends a data query instruction to the data viewing server 804. The data viewing server 804 sends a data query request to the Redis cache of the storage server 803 through the Redis client program. The data query request includes the address information of the target client program to be queried and the address information of the corresponding first server. The storage server 803 determines the target storage link based on the address information of the target client program and the address information of the corresponding first server.The storage server 803 obtains the second protocol data from the FastDFS distributed file system based on the target storage link, and sends the second protocol data to the data viewing server 804. The data viewing server 804 receives the second protocol data through the FastDFS client program.
[0196] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0197] Through the technical solution provided by the embodiment of the present application, when recording protocol data, the first server obtains the protocol data of the first server during interaction. After the first server collects the protocol data, it can obtain the target protocol data of the interaction between the client program and the server program of the target application from the protocol data. When it is necessary to collect protocol data for interaction between multiple client programs and server programs, there is no need to install a data collection module in multiple client programs. The corresponding protocol data can be directly collected through the first server, thereby improving the efficiency of recording protocol data.
[0198] In addition, the first server also sends the target protocol data to the second server, which further processes the data, thereby decoupling data collection and data processing and improving the efficiency of data collection and data processing. The second server can also store the processed target protocol data so that technicians can query and call the protocol data at any time.
[0199] The above-mentioned first server, second server and storage server constitute a storage system for protocol data provided in an embodiment of the present application, and the system includes: a first server and a second server;
[0200] The first server is used to monitor the communication of the first server to record the protocol data of the first server during communication, wherein the protocol data includes the protocol data sent by the first server and the protocol data received by the first server;
[0201] The first server is further used to obtain target protocol data from the protocol data based on address information of a server program of the target application on the first server;
[0202] The first server is also used to send the target protocol data to the second server;
[0203] The second server is used to receive the target protocol data and convert the target protocol data into a target format;
[0204] The second server is also used to store the target protocol data in the target format.
[0205] It should be noted that the recording and storage process of the protocol data by the first server and the second server and the interaction process between the servers refer to the above steps 501-511, which will not be repeated here.
[0206] In a possible implementation manner, the system further includes a third server.
[0207] The third server is used to send a data query request to the second server, the data query request includes address information of a client program to be queried and address information of a server program to be queried, the client program is a client program of a target application, and the server program is a server program of the target application.
[0208] The third server is used to obtain second protocol data corresponding to the data query request from the second server, and the second protocol data includes protocol data for interaction between the client program and the server program.
[0209] The third server is used to send the second protocol data to the data viewing client program, and the data viewing client program is used to display the second protocol data.
[0210] See also Fig. 9 The storage system of protocol data provided in the embodiment of the present application is divided into an access layer 901, a relay layer 902, a data layer 903 and a service layer 904, wherein the functions of the access layer 901 are provided by the first server, including the functions of recording protocol data and configuring projects based on the network card, wherein the project configuration is also the function of configuring the storage system of the protocol data, including configuring the IP addresses of each server and the port number of the target application, etc. The functions of the relay layer 902 are provided by the second server, including protocol data decompression, protocol data decryption, protocol data decoding and related configuration. The functions of the data layer 903 are implemented by the storage server, including the FastDFS distributed file system and the Redis cache. The functions of the service layer 904 are implemented by the third server, including page generation services and data query services.
[0211] Fig.10 This is a schematic diagram of the structure of a protocol data recording device provided in an embodiment of the present application, see Fig.10 , applied to the first server, the device includes: a monitoring module 1001 and a target protocol data acquisition module 1002.
[0212] The monitoring module 1001 is used to monitor the communication of the first server to record the protocol data of the first server during communication, wherein the protocol data includes the protocol data sent by the first server and the protocol data received by the first server.
[0213] The target protocol data acquisition module 1002 is used to acquire target protocol data from the protocol data based on the address information of the server program of the target application on the first server.
[0214] The target protocol data includes protocol data for interaction between multiple client programs of the target application and a server program of the target application.
[0215] In a possible implementation, the monitoring module 1001 is used to monitor the network card of the first server, and obtain protocol data of the first server during communication from the network card.
[0216] In a possible implementation, the target protocol data acquisition module 1002 is used to filter the protocol data based on the port number of the server program of the target application when it runs on the first server to obtain the target protocol data.
[0217] In a possible implementation, the device further includes:
[0218] The packet assembly module is used to assemble the target protocol data to obtain a target data packet.
[0219] The target data packet sending module is used to send the target data packet to the second server, and the second server is used to obtain the target protocol data from the target data packet and store the target protocol data.
[0220] It should be noted that: the recording device for protocol data provided in the above embodiment only uses the division of the above functional modules as an example when recording protocol data. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the recording device for protocol data provided in the above embodiment and the recording method embodiment of protocol data belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0221] Through the technical solution provided by the embodiment of the present application, when recording protocol data, the first server obtains the protocol data of the first server during interaction. After the first server collects the protocol data, it can obtain the target protocol data of the interaction between the client program and the server program of the target application from the protocol data. When it is necessary to collect protocol data for interaction between multiple client programs and server programs, there is no need to install a data collection module in multiple client programs. The corresponding protocol data can be directly collected through the first server, thereby improving the efficiency of recording protocol data.
[0222] Fig.11is a schematic diagram of a storage device for protocol data provided in an embodiment of the present application, see Fig.11 , applied to the second server, the device includes: a target protocol data receiving module 1101, a format conversion module 1102 and a storage module 1103.
[0223] The target protocol data receiving module 1101 is used to receive target protocol data, which includes protocol data for interaction between multiple client programs of the target application and the server program of the target application. The target protocol data is protocol data recorded by the first server, and the server program runs on the first server.
[0224] The format conversion module 1102 is used to convert the target protocol data into a target format.
[0225] The storage module 1103 is used to store the target protocol data in the target format.
[0226] In a possible implementation, the target protocol data receiving module 1101 is used to obtain a target data packet sent by the first server, where the target data packet is obtained after the first server packages the target protocol data, and perform at least one of decryption, decompression and decoding on the target data packet to obtain the target protocol data.
[0227] In a possible implementation, the storage module 1103 is configured to determine a plurality of storage processes corresponding to the target protocol data based on the address information of the plurality of client programs carried by the target protocol data, and store the target protocol data based on the plurality of storage processes.
[0228] In a possible implementation, the storage module 1103 is used to determine the identification of the storage process corresponding to each of the client programs based on the IP addresses and corresponding port numbers of the multiple client programs. Based on the identification of the storage process corresponding to each of the client programs, determine the multiple storage processes corresponding to the target protocol data.
[0229] In a possible implementation, the storage module 1103 is used to perform hash mapping on the IP addresses of the various client programs and the corresponding port numbers to obtain the identifiers of the storage processes corresponding to the various client programs.
[0230] In a possible implementation, the storage module 1103 is used to obtain, for a first client program among the multiple client programs, first protocol data corresponding to the first client program from the target protocol data based on the address information of the first client program. Based on the storage process corresponding to the address information of the first client program, the protocol data belonging to the same transmission time period in the first protocol data is stored in the same storage unit, and the transmission time period is the time period from the first client program logging into the first server to logging out of the first server.
[0231] In a possible implementation, the device further includes:
[0232] The link generation module is used to generate multiple storage links corresponding to the multiple storage processes based on the address information of the server program of the target application and the address information of the multiple client programs, and the multiple storage links point to the storage units corresponding to the corresponding storage processes.
[0233] In a possible implementation, the device further includes:
[0234] The data query module is used to respond to a data query request and determine a target storage link based on the data query request, wherein the data query request carries address information of a client program to be queried and address information of a server program to be queried, obtain second protocol data from the target storage link, and send the second protocol data to a sender of the data query request.
[0235] It should be noted that: the storage device for protocol data provided in the above embodiment only uses the division of the above functional modules as an example when storing protocol data. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the storage device for protocol data provided in the above embodiment and the storage method embodiment of protocol data belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0236] When storing protocol data, the first server also sends the target protocol data to the second server, which further processes the data, thereby decoupling data collection and data processing and improving the efficiency of data collection and data processing. The second server can also store the processed target protocol data so that technicians can query and call the protocol data at any time.
[0237] Fig.12 This is a schematic diagram of the structure of a protocol data query device provided in an embodiment of the present application, see Fig.12, applied to the third server, the device includes: a data query request sending module 1201, a second protocol data acquisition module 1202 and a second protocol data sending module 1203.
[0238] The data query request sending module 1201 is used to send a data query request to the second server, wherein the data query request includes the address information of the client program to be queried and the address information of the server program to be queried, wherein the client program is the client program of the target application, and the server program is the server program of the target application.
[0239] The second protocol data acquisition module 1202 is used for the second server to obtain the second protocol data corresponding to the data query request, the second protocol data includes the protocol data for interaction between the client program and the server program, the second protocol data is the protocol data recorded by the first server, and the server program runs on the first server.
[0240] The second protocol data sending module 1203 is used to send the second protocol data to the data viewing client program, and the data viewing client program is used to display the second protocol data.
[0241] The second protocol data is used to test the target application.
[0242] In a possible implementation, the second protocol data sending module 1203 is used to generate a data viewing page based on the second protocol data, and send the data viewing page to the data viewing client program.
[0243] It should be noted that: the query device for protocol data provided in the above embodiment only uses the division of the above functional modules as an example when querying protocol data. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the query device for protocol data provided in the above embodiment and the query method embodiment for protocol data belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0244] The technicians can check the protocol data at any time through the third server, and thus select different protocol data for corresponding applications, which is highly efficient.
[0245] Fig.13It is a structural diagram of a server provided in an embodiment of the present application. The server 1300 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1301 and one or more memories 1302, wherein the one or more memories 1302 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 1301 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server 1300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1300 may also include other components for implementing device functions, which will not be described in detail here.
[0246] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including a computer program, and the computer program can be loaded and executed by a processor to implement the methods provided by the above-mentioned various method embodiments. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0247] In an exemplary embodiment, a computer program product or a computer program is also provided, which includes a program code, and the program code is stored in a computer-readable storage medium. The processor of the server reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the server executes the methods provided by the above-mentioned various method embodiments.
[0248] In some embodiments, the computer program involved in the embodiments of the present application may be deployed and executed on one server, or on multiple servers located in one location, or on multiple servers distributed in multiple locations and interconnected by a communication network. Multiple servers distributed in multiple locations and interconnected by a communication network may constitute a blockchain system.
[0249] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0250] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for recording protocol data, It is characterized in that Executed by a first server, the method includes: Monitoring the communication of the first server to record protocol data of the first server during communication, wherein the protocol data includes protocol data sent by the first server and protocol data received by the first server; Based on the address information of the server program of the target application on the first server, acquiring the target protocol data from the protocol data, the address information indicating the address at which the client program of the target application communicates with the server program; The target protocol data includes protocol data for interaction between multiple client programs of the target application and a server program of the target application.
2. The method according to claim 1, It is characterized in that The monitoring of the communication of the first server to record the protocol data of the communication of the first server includes: The network card of the first server is monitored, and protocol data of the first server during communication is obtained from the network card.
3. The method according to claim 1, It is characterized in that The acquiring target protocol data from the protocol data based on the address information of the server program of the target application on the first server includes: The protocol data is filtered based on the port number of the server program of the target application when it is running on the first server to obtain the target protocol data.
4. The method according to claim 1, It is characterized in that After acquiring the target protocol data from the protocol data based on the address information of the server program of the target application on the first server, the method further includes: Packaging the target protocol data to obtain a target data packet; The target data packet is sent to a second server, and the second server is used to obtain the target protocol data from the target data packet and store the target protocol data.
5. A method for storing protocol data, It is characterized in that Executed by the second server, the method includes: Receive target protocol data, the target protocol data including protocol data for interaction between multiple client programs of a target application and a server program of the target application, the target protocol data being acquired by a first server from recorded protocol data based on address information of the server program on the first server, the address information indicating an address at which the client program communicates with the server program, the recorded protocol data including protocol data sent by the first server and protocol data received by the first server, and the server program running on the first server; Converting the target protocol data into a target format; The target protocol data is stored in the target format.
6. The method according to claim 5, It is characterized in that The receiving target protocol data comprises: Acquire a target data packet, wherein the target data packet is obtained by packaging the target protocol data; At least one of decrypting, decompressing and decoding the target data packet is performed to obtain the target protocol data.
7. The method according to claim 5, It is characterized in that The target protocol data stored in the target format includes: Determine multiple storage processes corresponding to the target protocol data based on the address information of the multiple client programs carried by the target protocol data; The target protocol data is stored based on the plurality of storage processes.
8. The method according to claim 7, It is characterized in that The determining, based on the address information of the multiple client programs carried by the target protocol data, multiple storage processes corresponding to the target protocol data includes: Determine, based on the IP addresses and corresponding port numbers of the multiple client programs, an identifier of a storage process corresponding to each of the client programs; Based on the identifiers of the storage processes corresponding to the respective client programs, a plurality of storage processes corresponding to the target protocol data are determined.
9. The method according to claim 8, It is characterized in that The step of determining the identifier of the storage process corresponding to each of the client programs based on the IP address and the corresponding port number of each of the client programs includes: Hash mapping is performed on the IP address and the corresponding port number of each client program to obtain the identifier of the storage process corresponding to each client program.
10. The method according to claim 7, It is characterized in that The storing of the target protocol data based on the multiple storage processes comprises: For a first client program among the multiple client programs, based on the address information of the first client program, acquiring first protocol data corresponding to the first client program from the target protocol data; Based on the storage process corresponding to the address information of the first client program, the protocol data belonging to the same transmission time period in the first protocol data is stored in the same storage unit, and the transmission time period is the time period from the first client program logging into the first server to logging out of the first server.
11. The method according to claim 7, It is characterized in that The method further comprises: Based on the address information of the server program of the target application and the address information of the multiple client programs, multiple storage links corresponding to the multiple storage processes are generated, and the multiple storage links point to storage units corresponding to the corresponding storage processes.
12. The method according to claim 11, It is characterized in that The method further comprises: In response to a data query request, determining a target storage link based on the data query request, the data query request carrying address information of a client program to be queried and address information of a server program to be queried; Acquire second protocol data from the target storage link, and send the second protocol data to the sender of the data query request.
13. A method for querying protocol data, It is characterized in that Executed by a third server, the method includes: Sending a data query request to the second server, the data query request including address information of a client program to be queried and address information of a server program to be queried, the client program being a client program of a target application, and the server program being a server program of the target application; Acquire second protocol data corresponding to the data query request from the second server, the second protocol data including protocol data for interaction between the client program and the server program, the second protocol data being acquired by the first server from recorded protocol data based on address information of the server program on the first server, the address information of the server program on the first server indicating an address for communication between the client program and the server program, the recorded protocol data including protocol data sent by the first server and protocol data received by the first server, and the server program running on the first server; The second protocol data is sent to a data viewing client program, and the data viewing client program is used to display the second protocol data.
14. The method according to claim 13, It is characterized in that The sending the second protocol data to the data viewing client program comprises: generating a data viewing page based on the second protocol data; The data viewing page is sent to the data viewing client program.
15. A storage system for protocol data, It is characterized in that The system comprises: a first server and a second server; The first server is used to monitor the communication of the first server to record the protocol data of the first server during communication, wherein the protocol data includes the protocol data sent by the first server and the protocol data received by the first server; The first server is further used to obtain target protocol data from the protocol data based on address information of a server program of the target application on the first server, wherein the address information indicates an address at which a client program of the target application communicates with the server program; The first server is further configured to send the target protocol data to the second server; The second server is used to receive the target protocol data and convert the target protocol data into a target format; The second server is further configured to store the target protocol data in the target format.
16. A server, It is characterized in that The server includes one or more processors and one or more memories, and at least one computer program is stored in the one or more memories. The computer program is loaded and executed by the one or more processors to implement the recording method of the protocol data as described in any one of claims 1 to 4, or to implement the storage method of the protocol data as described in any one of claims 5 to 12, or to implement the query method of the protocol data as described in claim 13 or 14.
17. A computer-readable storage medium, It is characterized in that At least one computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by the processor to implement the recording method of the protocol data as described in any one of claims 1 to 4, or to implement the storage method of the protocol data as described in any one of claims 5 to 12, or to implement the query method of the protocol data as described in claim 13 or 14.
18. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, it implements the method for recording the protocol data as described in any one of claims 1 to 4, or implements the method for storing the protocol data as described in any one of claims 5 to 12, or implements the method for querying the protocol data as described in claim 13 or 14.
Citation Information
Patent Citations
Method, system and equipment for network communication process monitoring
CN103368783A
Interface testing method and apparatus, computer equipment and storage medium
CN107908541A
Data transmission method and articulated naturality web system
CN110022295A