WO2015124073A1 - Process monitoring method, apparatus, and system - Google Patents
Process monitoring method, apparatus, and system Download PDFInfo
- Publication number
- WO2015124073A1 WO2015124073A1 PCT/CN2015/072712 CN2015072712W WO2015124073A1 WO 2015124073 A1 WO2015124073 A1 WO 2015124073A1 CN 2015072712 W CN2015072712 W CN 2015072712W WO 2015124073 A1 WO2015124073 A1 WO 2015124073A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- communications
- processes
- data
- node
- relay
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
Definitions
- the present disclosure relates to the data processing field, and more specifically, to a process monitoring method, apparatus, and system.
- an existing solution is generally to use a method for analyzing network communications data between a client and a server, and most tools that are used perform the analysis by capturing a communications packet between the client and the server, and furthermore perform the test in a manner of tampering with the data.
- Embodiments of the present invention provide a process monitoring method, apparatus, and system, so as to at least solve a technical problem that a communication logic between multiple processes cannot be tested in the existing technology.
- a process monitoring method including: obtaining processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple; establishing communications channels between the processes according to the obtained communications relationship; adding a relay communications node connected to each of the communications channels; and monitoring data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- a process monitoring apparatus including: an obtaining unit, configured to obtain processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple; an establishing unit, configured to establish communications channels between the processes according to the obtained communications relationship; an adding unit, configured to add a relay communications node connected to each of the communications channels; and a first monitoring unit, configured to monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- a process monitoring system is further provided, including any process monitoring apparatus provided in the foregoing content.
- the relay communications node connected to each communications channel between the processes is added, so that the data content that flows through the relay communications node and the flow direction can be monitored, to obtain the communications data transmitted between the processes connected by the communications channel and a transmission direction of the data, and thereby monitoring of a communications logic between the multiple processes of the to-be-tested system is implemented, which solves a technical problem that the communications logic between the multiple processes cannot be monitored in the existing technology, thereby achieving a technical effect of performing a gray-box test on the communications logic between the processes of the to-be-tested system.
- FIG. 1 is a flowchart of a process monitoring method according to an embodiment of the present invention
- FIG. 2a and FIG. 2b are schematic diagrams of adding a relay communications node connected to each communications channel in a monitoring method according to an embodiment of the present invention
- FIG. 3 is a schematic diagram of a communications topology view generated by a monitoring method according to an embodiment of the present invention
- FIG. 4 is a schematic diagram of a communications sequence diagram generated by a monitoring method according to an embodiment of the present invention.
- FIG. 5a is a flowchart of a monitoring method according to an optional embodiment of the present invention.
- FIG. 5b is a flowchart of a monitoring method according to another optional embodiment of the present invention.
- FIG. 5c is a flowchart of a monitoring method according to another optional embodiment of the present invention.
- FIG. 6 is a flowchart of a monitoring method according to another optional embodiment of the present invention.
- FIG. 7 is a schematic diagram of a process monitoring apparatus according to an embodiment of the present invention.
- FIG. 8a is a schematic diagram of a monitoring apparatus according to an optional embodiment of the present invention.
- FIG. 8b is a schematic diagram of a monitoring apparatus according to another optional embodiment of the present invention.
- FIG. 8c is a schematic diagram of a monitoring apparatus according to another optional embodiment of the present invention.
- FIG. 9 is a schematic diagram of a monitoring apparatus according to another optional embodiment of the present invention.
- a process monitoring method is provided. As shown in FIG. 1, the method includes the following step S102 to step S108:
- S102 Obtain processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple.
- all of the processes of the to-be-tested system may be obtained according to a working directory in which the to-be-tested system is located and by using a script language provided by an operating system.
- the processes of the to-be-tested system are obtained by remotely executing a shell command by using ssh.
- the communications relationship between the processes may be obtained by remotely executing netstat and ipcm commands by using ssh.
- S104 Establish communications channels between the processes according to the obtained communications relationship, that is, establish one communications channel between every two processes that have the communications relationship.
- S108 Monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- the relay communications node is connected to each communications channel, and therefore by monitoring the data content that flows through the relay communications node and the data flow direction, the data content transmitted through the communications channel and a transmission direction may be obtained, that is, the communications data and the communications direction between the processes may be obtained.
- a relay communications node connected to each communications channel between processes is added, so that data content that flows through the relay communications node and a flow direction can be monitored, to obtain communications data transmitted between the processes connected by the communications channel and a transmission direction of the data, and thereby monitoring of a communications logic between the multiple processes of the to-be-tested system is implemented, which solves a technical problem that the communications logic between the multiple processes cannot be monitored in the existing technology, thereby achieving a technical effect of performing a gray-box test on the communications logic between the processes of the to-be-tested system.
- the monitoring data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes includes: monitoring data content of a first process and a second process that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the first process and the second process, where the first process and the second process are any two processes that have a communications relationship in the multiple processes.
- the communications relationship obtained in step S102 includes a communications manner, and in this embodiment of the present invention, the relay communications node connected to each communications channel may be added in the following manner:
- a first communications manner in which a first process and a second process send data to and receive data from each other is obtained, where the first process and the second process are any two processes that have a communications relationship in the multiple processes.
- a connection between the first process and a first conversion process is established, and a connection between the second process and a second conversion process is established, where the first conversion process and the second conversion process are both processes connected to the relay communications node in the second communications manner, a manner in which the first conversion process communicates with the first process is the first communications manner, and a manner in which the second conversion process communicates with the second process is the first communications manner; and in a case in which it is determined that the first communications manner is the same as the second communications manner, a connection between the first process and the relay communications node is established, and a connection between the second process and the relay communications node is established.
- a connection between a process and a corresponding conversion process may be established in a manner of changing a target connection address of the process, and a connection between a process and the relay communications node may be established in the manner of changing a target connection address of the process; the following steps may be used in the specific establishing manner:
- the establishing a connection between the first process and a first conversion process, and establishing a connection between the second process and a second conversion process is specifically: obtaining a target connection address of the first process and a target connection address of the second process; and changing the target connection address of the first process to an address of the first conversion process, and changing the target connection address of the second process to an address of the second conversion process. More specifically, when a process initializes a connection, a target connection address of the process may be changed in a hook manner.
- the establishing a connection between the first process and the relay communications node, and establishing a connection between the second process and the relay communications node is specifically: obtaining the target connection address of the first process and the target connection address of the second process; and changing the target connection address of the first process to a first connection address, and changing the target connection address of the second process to a second connection address, where the first connection address is an address, which is in the relay communications node, for communicating with the first process, and the second connection address is an address, which is in the relay communications node, for communicating with the second process.
- a communications protocol on which a manner of communication between processes is based generally includes memory sharing, a tcp protocol, a udp protocol, piping, a file, a semaphore, and the like.
- a second communications manner in which the relay communications node sends and receives data is similarly based on one of the foregoing protocols.
- a different communications protocol used indicates a different corresponding communications manner.
- a second communications manner used by a relay communications node P is a tcp protocol-based communications manner, which is shown in FIG. 2a and FIG. 2b, and then that the relay communications node connected to each communications channel is added is specifically:
- the process A is connected to a udp converter 1, to make the process A communicate with the udp converter 1 by using udp
- the process C is connected to a udp converter 2, to make the process C communicate with the udp converter 2 by using udp
- the udp converter 1 and the udp converter 2 are both connected to the relay communications node P, where the two udp converters both communicate with the relay communications node P by using tcp, so as to add the relay communications node P to a communications channel between the process A and the process C.
- a target connection address of the process A may be changed to an address of the udp converter 1, to connect the process A to the udp converter 1, where to change the target connection address of the process A to the address of the udp converter 1 is to change the target connection address of the process A to a network port of the udp converter 1.
- a target connection address of the process C may be changed to an address of the udp converter 2, to connect the process C to the udp converter 2, where to change a target connection address of a process C to the address of the udp converter 2 is to change the target connection address of the process C to a network port of the udp converter 2.
- the process B is connected to a memory converter 1, to make the process B communicate with the memory converter 1 in the memory sharing manner
- the process C is connected to a memory converter 2, to make the process C communicate with the memory converter 2 in the memory sharing manner
- the memory converter 1 and the memory converter 2 are both connected to the relay communications node P, where the two memory converters both communicate with the relay communications node P by using tcp, so as to add the relay communications node P to a communications channel between the process B and the process C.
- a target connection address of the process B may be changed to an address of the memory converter 1, to connect the process B to the memory converter 1, where to change the target connection address of the process B to the address of the memory converter 1 is to change a memory keyword of the process B to a memory keyword of the memory converter 1.
- a target connection address of the process C may be changed to an address of the memory converter 2, to connect the process C to the memory converter 2, where to change the target connection address of the process C to the address of the memory converter 2 is to change a memory keyword of the process C to a memory keyword of the memory converter 2.
- the process A and the process B communicate with each other by directly using the tcp protocol, and the communications manner is the same as that used by the relay communications node P. Therefore, the process A and the process B may be directly connected to a relevant communications address of the relay communications node P without a need to establish a connection between a process and a converter again.
- the communications manner used by the relay communications node P is not a manner that is based on the tcp protocol, it needs to connect the process A to a tcp converter 1, to make the process A communicate with the tcp converter 1 by using tcp, and connect the process C to a tcp converter 2, to make the process C communicate with the tcp converter 2 by using tcp, and the tcp converter 1 and the tcp converter 2 are both connected to the relay communications node P, where the two tcp converters both communicate with the relay communications node P in the communications manner used by the relay communications node P, so as to add the relay communications node P to a communications channel between the process A and the process C.
- a target connection address of the process A may be changed to an address of the tcp converter 1, to connect the process A to the tcp converter 1, where to change the target connection address of the process A to the address of the tcp converter 1 is to change the target connection address of the process A to a network port of the tcp converter 1.
- a target connection address of the process C may be changed to an address of the tcp converter 2, to connect the process C to the tcp converter 2, where to change a target connection address of the process C to the address of the tcp converter 2 is to change the target connection address of the process C to a network port of the tcp converter 2.
- a tcp converter, a udp converter, a memory converter, and another converter for performing communications manner conversion all implement conversion processes by using programs.
- a connection path between a process and the relay communications node is established. Accordingly, after the process is restarted, an original communications channel of the process is modified to a communications channel connected to the relay communications node. In this way, the data content that flows through the relay communications node, and the data flow direction may be monitored, to obtain communications data and a communications direction between the processes.
- the monitoring method in this embodiment of the present invention further includes: drawing a communications topology view by using each of the processes as a node and using each of the communications channels as a node connection path; and displaying the communications topology view.
- drawing a communications topology view by using each of the processes as a node and using each of the communications channels as a node connection path; and displaying the communications topology view.
- the monitoring method further includes: controlling the multiple processes to be distributed in a multi-column form, where the processes that have the communications relationship are distributed in adjacent columns; or controlling the multiple processes to be distributed in a multi-row form, where the processes that have the communications relationship are distributed in adjacent rows. In this way, crossing of connection paths between the processes is prevented to the greatest extent, so that the communications topology view that is drawn can clearly and concisely reflect the communications relationship between processes. As shown in FIG.
- FIG. 3 is a schematic diagram of a communications topology view generated by a monitoring method according to an embodiment of the present invention, this figure schematically shows that multiple processes are distributed in a multi-column form, and in FIG. 3, p0 indicates an external process, and p1, p2, ..., and pn indicate multiple processes.
- the monitoring method in this embodiment of the present invention further includes:
- the communications sequence diagram may further be displayed, which provides a sequence diagram that can visually reflect a communications flow direction between processes for the tester.
- the monitoring method further includes: receiving a second instruction from a client, where the second instruction from a client is used to change, from the communications topology view, the selected processes; and controlling the communications link between the changed processes to be displayed on the communications sequence diagram. In this way, the communications link between the processes displayed on the communications sequence diagram is increased or decreased.
- the monitoring method further includes: receiving a third instruction from a client, where the third instruction from a client is used to select, from the communications sequence diagram, a target communications link; and displaying the communications data corresponding to the target communications link.
- the communications data between the processes is visually displayed for the tester.
- the monitoring method further includes: controlling the multiple processes to be distributed in a multi-column form, where only one of the processes is distributed in each column, and the processes in adjacent columns are different; or controlling the multiple processes to be distributed in a multi-row form, where only one of the processes is distributed in each row, and the processes in adjacent rows are different.
- FIG. 4 which is a schematic diagram of a communications sequence diagram generated by a monitoring method according to an embodiment of the present invention, this figure schematically shows that 7 processes, which are p1 to p7, are distributed in a multi-column form.
- FIG. 5a is a flowchart of a process monitoring method according to an optional embodiment of the present invention.
- the monitoring method provided in the optional embodiment mainly includes the following step S5a02 to step S5a14:
- S5a02 Obtain processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple.
- This step is the same as the foregoing step S102.
- S5a04 Establish communications channels between the processes according to the obtained communications relationship.
- This step is the same as the foregoing step S104.
- S5a06 Add a relay communications node connected to each of the communications channels.
- This step is the same as the foregoing step S106.
- S5a08 Monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- This step is the same as the foregoing step S108.
- S5a10 When it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, send, by using the relay communications node, a second request transmitted by a third process to the first process, where the first request includes a first feature, the second request includes a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features.
- S5a12 Monitor a processing result of the first process for the second request.
- S5a14 Determine a competition state of the first process according to the processing result.
- step Sa510 the tester inserts one data test request into one hierarchical invocation of a process group, to test whether a target process correctly processes the request. If the processing result indicates that the first process collapses, it may be determined that the competition state reflected in a response of the first process to a competition mechanism is weak. On the contrary, if the processing result indicates that the first process can correctly feed back a feedback for the second request, it may be determined that the competition state reflected in the response of the first process to the competition mechanism is strong. Testing, in a case in which a first process sends a request, a situation of a competition of the first process for a request received from a third party is implemented.
- the first process is a process maysvrd
- the second process is a process world_login
- the third process is a process tconnd
- the foregoing monitoring manner is that: when the process maysvrd sends a piece of data whose content includes a feature D1 to the process world_login, a piece of data whose content includes a feature D2 is sent from the process tconnd to the process maysvrd by using the relay communications node, to test whether the process maysvrd correctly processes the request.
- the foregoing test rule may be defined in a JSON format as follows:
- FIG. 5b is a flowchart of a process monitoring method according to another optional embodiment of the present invention.
- the monitoring method provided in the optional embodiment mainly includes the following step S5b02 to step S5b14:
- S5b02 Obtain processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple.
- This step is the same as the foregoing step S102.
- S5b04 Establish communications channels between the processes according to the obtained communications relationship.
- This step is the same as the foregoing step S104.
- S5b06 Add a relay communications node connected to each of the communications channels.
- This step is the same as the foregoing step S106.
- S5b08 Monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- This step is the same as the foregoing step S108.
- S5b10 When it is monitored, by using the relay communications node, that a first process receives a first request transmitted from a second process, send, by using the relay communications node, a second request transmitted by a third process to the first process, where the first request includes a first feature, the second request includes a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features.
- S5b12 Monitor a processing result of the first process for the second request.
- S5b14 Determine a competition state of the first process according to the processing result.
- FIG. 5c is a flowchart of a process monitoring method according to another optional embodiment of the present invention.
- the monitoring method provided in the optional embodiment mainly includes the following step S5c02 to step S5c14:
- S5c02 Obtain processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple.
- This step is the same as the foregoing step S102.
- S5c04 Establish communications channels between the processes according to the obtained communications relationship.
- This step is the same as the foregoing step S104.
- S5c06 Add a relay communications node connected to each of the communications channels.
- This step is the same as the foregoing step S106.
- S5c08 Monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- This step is the same as the foregoing step S108.
- S5c10 When it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, send, by using the relay communications node, a second request transmitted by the first process to a third process, where the first request includes a first feature, the second request includes a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features.
- S5c12 Monitor a processing result of the third process for the second request.
- S5c14 Determine a competition state of the first process according to the processing result.
- FIG. 6 is a flowchart of a monitoring method according to another optional embodiment of the present invention. As shown in FIG. 6, the monitoring method provided in the optional embodiment mainly includes the following step S602 to step S614:
- S602 Obtain processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple.
- This step is the same as the foregoing step S102.
- S604 Establish communications channels between the processes according to the obtained communications relationship.
- This step is the same as the foregoing step S104.
- This step is the same as the foregoing step S106.
- S608 Monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- This step is the same as the foregoing step S108.
- S614 Determine a correspondence between the external input data and the SQL statement according to a matching relationship between the parameter value and the external input data.
- the external input data and the SQL statement are extracted, and the correspondence between the two is determined, so that an effect of testing what kind of SQL statement can be generated from the external input data is achieved.
- the determined correspondence between the external input data and the SQL statement may further be displayed, so that the SQL statement generated from the external input data is visually provided for a tester.
- the correspondence between the external input data and the SQL statement may be determined in the following manner: first, whether same data exists in the external input data and the extracted value is determined; next, in a case in which it is determined that the same data exists in the external input data and the extracted value, an SQL statement in which the same data is located is obtained; and after that, it is determined that the obtained SQL statement is an SQL statement corresponding to the external input data.
- the SQL statement in the communications data is extracted in the following manner: first, SQL data that flows to a database of the to-be-tested system is obtained from the monitored communications data; and after that, the SQL statement is extracted from the SQL data.
- the monitoring method in this embodiment of the present invention further includes: modifying the external input data; sending the modified external input data to the to-be-tested system; and re-determining a correspondence between the modified external input data and the SQL statement, where a specific determining method is the same as the foregoing method for determining the correspondence between the external input data and the SQL statement, and details are not provided again herein.
- the modified external input data is sent to the to-be-tested system, and then the correspondence between the modified external input data and the SQL statement is re-determined, so that an effect of purposely testing an SQL statement that can be generated from specific external data is achieved.
- the methods according to the foregoing embodiments may be implemented by hardware only or by software and a necessary universal hardware platform. However, in most cases, using software and a necessary universal hardware platform are preferred.
- the technical solutions of the present disclosure essentially, or the part contributing to the existing technology may be implemented in a form of a software product.
- the computer software product is stored in a storage medium (such as a ROM/RAM, a magnetic disk, or an optical disc) and includes several instructions for instructing a terminal device (which may be a mobile phone, a computer, a server, a network device, or the like) to perform the methods described in the embodiments of the present invention.
- a process monitoring apparatus for implementing the foregoing process monitoring method is further provided, where the monitoring apparatus is mainly configured to execute the monitoring method provided in the foregoing content in the embodiments of the present invention.
- FIG. 7 is a schematic diagram of a process monitoring apparatus according to an embodiment of the present invention.
- the monitoring apparatus mainly includes an obtaining unit 10, an establishing unit 20, an adding unit 30, and a first monitoring unit 40, where:
- the obtaining unit 10 is configured to obtain processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple,
- all of the processes of the to-be-tested system may be obtained according to a working directory in which the to-be-tested system is located and by using a script language provided by an operating system; for example, the processes of the to-be-tested system are obtained by remotely executing a shell command by using ssh; for the obtaining of the communications relationship between the processes, the communications relationship between the processes may be obtained by remotely executing netstat and ipcm commands by using ssh;
- the establishing unit 20 is configured to establish communications channels between the processes according to the obtained communications relationship, that is, establish one communications channel between every two processes that have the communications relationship;
- the adding unit 30 is configured to add a relay communications node connected to each of the communications channels, that is, add the relay communications node as an agent communications node, so that each communications channel communicates by using this added relay communications node;
- the first monitoring unit 40 is configured to monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- the relay communications node is connected to each communications channel, and therefore by monitoring the data content that flows through the relay communications node and the data flow direction, the data content transmitted through the communications channel and a transmission direction may be obtained, that is, the communications data and the communications direction between the processes may be obtained.
- a relay communications node connected to each communications channel between processes is added, so that data content that flows through the relay communications node and a flow direction can be monitored, to obtain communications data transmitted between the processes connected by the communications channel and a transmission direction of the data, and thereby monitoring of a communications logic between the multiple processes of the to-be-tested system is implemented, which solves a technical problem that the communications logic between the multiple processes cannot be monitored in the existing technology, thereby achieving a technical effect of performing a gray-box test on the communications logic between the processes of the to-be-tested system.
- the first monitoring unit 40 includes a monitoring subunit, where the monitoring subunit is configured to monitor data content of a first process and a second process that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the first process and the second process, where the first process and the second process are any two processes that have a communications relationship in the multiple processes.
- the communications relationship obtained by the obtaining unit 10 includes a communications manner.
- the adding unit 30 mainly includes a first obtaining subunit, a first judging subunit, a first establishing subunit, and a second establishing subunit.
- the foregoing subunits mainly add, in the following manner, the relay communications node connected to each communications channel:
- the first obtaining subunit is configured to obtain a first communications manner in which a first process and a second process send data to and receive data from each other, where the first process and the second process are any two processes that have a communications relationship in the multiple processes.
- the first judging subunit is configured to determine whether the first communications manner is the same as a second communications manner in which the relay communications node sends and receives data.
- the first establishing subunit is configured to: in a case in which the first judging subunit determines that the first communications manner is different from the second communications manner, establish a connection between the first process and a first conversion process, and establish a connection between the second process and a second conversion process, where the first conversion process and the second conversion process are both processes connected to the relay communications node in the second communications manner, a manner in which the first conversion process communicates with the first process is the first communications manner, and a manner in which the second conversion process communicates with the second process is the first communications manner.
- the second establishing subunit is configured to: in a case in which the first judging subunit determines that the first communications manner is the same as the second communications manner, establish a connection between the first process and the relay communications node, and establish a connection between the second process and the relay communications node.
- first establishing subunit includes a first obtaining module and a first changing module
- second establishing subunit includes a second obtaining module and a second changing module
- the first obtaining module is configured to obtain a target connection address of the first process and a target connection address of the second process; and the first changing module is configured to change the target connection address of the first process to an address of the first conversion process, and change the target connection address of the second process to an address of the second conversion process; that is, by using a collaboration between the first obtaining module and the first changing module, a connection between a process and a corresponding conversion process is established in a manner of changing a target connection address of the process; and
- the second obtaining module is configured to obtain the target connection address of the first process and the target connection address of the second process; and the second changing module is configured to change the target connection address of the first process to a first connection address, and change the target connection address of the second process to a second connection address, where the first connection address is an address, which is in the relay communications node, for communicating with the first process, and the second connection address is an address, which is in the relay communications node, for communicating with the second process; that is, by using a collaboration between the second obtaining module and the second changing module, a connection between a process and the relay communications node is established in a manner of changing a target connection address of the process.
- a communications protocol on which a manner of communication between processes is based generally includes memory sharing, a tcp protocol, a udp protocol, piping, a file, a semaphore, and the like.
- a second communications manner in which the relay communications node sends and receives data is similarly based on one of the foregoing protocols.
- a different communications protocol used indicates a different corresponding communications manner.
- a second communications manner used by a relay communications node P is a tcp protocol-based communications manner, which is shown in FIG. 2a and FIG. 2b, the following specifically describes a specific principle for the adding unit 30 to add the relay communications node connected to each communications channel:
- the process A is connected to a udp converter 1, to make the process A communicate with the udp converter 1 by using udp
- the process C is connected to a udp converter 2, to make the process C communicate with the udp converter 2 by using udp
- the udp converter 1 and the udp converter 2 are both connected to the relay communications node P, where the two udp converters both communicate with the relay communications node P by using tcp, so as to add the relay communications node P to a communications channel between the process A and the process C.
- a target connection address of the process A may be changed to an address of the udp converter 1, to connect the process A to the udp converter 1, where to change the target connection address of the process A to the address of the udp converter 1 is to change the target connection address of the process A to a network port of the udp converter 1.
- a target connection address of the process C may be changed to an address of the udp converter 2, to connect the process C to the udp converter 2, where to change a target connection address of a process C to the address of the udp converter 2 is to change the target connection address of the process C to a network port of the udp converter 2.
- the process B is connected to a memory converter 1, to make the process B communicate with the memory converter 1 in the memory sharing manner
- the process C is connected to a memory converter 2, to make the process C communicate with the memory converter 2 in the memory sharing manner
- the memory converter 1 and the memory converter 2 are both connected to the relay communications node P, where the two memory converters both communicate with the relay communications node P by using tcp, so as to add the relay communications node P to a communications channel between the process B and the process C.
- a target connection address of the process B may be changed to an address of the memory converter 1, to connect the process B to the memory converter 1, where to change the target connection address of the process B to the address of the memory converter 1 is to change a memory keyword of the process B to a memory keyword of the memory converter 1.
- a target connection address of the process C may be changed to an address of the memory converter 2, to connect the process C to the memory converter 2, where to change the target connection address of the process C to the address of the memory converter 2 is to change a memory keyword of the process C to a memory keyword of the memory converter 2.
- the process A and the process B communicate with each other by directly using the tcp protocol, and the communications manner is the same as that used by the relay communications node P. Therefore, the process A and the process B may be directly connected to a relevant communications address of the relay communications node P without a need to establish a connection between a process and a converter again.
- the communications manner used by the relay communications node P is not a manner that is based on the tcp protocol, it needs to connect the process A to a tcp converter 1, to make the process A communicate with the tcp converter 1 by using tcp, and connect the process C to a tcp converter 2, to make the process C communicate with the tcp converter 2 by using tcp, and the tcp converter 1 and the tcp converter 2 are both connected to the relay communications node P, where the two tcp converters both communicate with the relay communications node P in the communications manner used by the relay communications node P, so as to add the relay communications node P to a communications channel between the process A and the process C.
- a target connection address of the process A may be changed to an address of the tcp converter 1, to connect the process A to the tcp converter 1, where to change the target connection address of the process A to the address of the tcp converter 1 is to change the target connection address of the process A to a network port of the tcp converter 1.
- a target connection address of the process C may be changed to an address of the tcp converter 2, to connect the process C to the tcp converter 2, where to change a target connection address of the process C to the address of the tcp converter 2 is to change the target connection address of the process C to a network port of the tcp converter 2.
- a tcp converter, a udp converter, a memory converter, and another converter for performing communications manner conversion all implement conversion processes by using programs.
- a connection path between a process and the relay communications node is established. Accordingly, after the process is restarted, an original communications channel of the process is modified to a communications channel connected to the relay communications node. In this way, the data content that flows through the relay communications node, and the data flow direction may be monitored, to obtain communications data and a communications direction between the processes.
- the monitoring apparatus in this embodiment of the present invention further includes a first drawing unit and a first displaying unit, where after the establishing unit 20 establishes communications channels between the processes according to the obtained communications relationship, the first drawing unit draws a communications topology view by using each of the processes as a node and using each of the communications channels as a node connection path.
- the first displaying unit is configured to display the communications topology view. In this way, a communications topology view that can visually reflect the communications relationship between the processes is provided for a tester.
- the monitoring apparatus further includes a first control unit, where before the first drawing unit draws a communications topology view by using each of the processes as a node and using each of the communications channels as a node connection path, the first control unit is configured to control the multiple processes to be distributed in a multi-column form, where the processes that have the communications relationship are distributed in adjacent columns. Alternatively, the first control unit is configured to control the multiple processes to be distributed in a multi-row form, where the processes that have the communications relationship are distributed in adjacent rows. In this way, crossing of connection paths between the processes is prevented to the greatest extent, so that the communications topology view that is drawn by the first drawing unit can clearly and concisely reflect the communications relationship between processes.
- the monitoring apparatus further includes a second drawing unit, an associating unit, a first receiving unit, and a second control unit, where after the first monitoring unit 40 monitors the data content that flows through the relay communications node, and the data flow direction, to obtain communications data and a communications direction between the processes, the second drawing unit is configured to draw a communications link, which points to the communications direction, between every two of the processes that have the communications relationship, and generate a communications sequence diagram, where each communications link has corresponding communications data; the associating unit is configured to associate the communications topology view with the communications sequence diagram; the first receiving unit is configured to receive a first instruction from a client, where the first instruction from a client is used to select, from the communications topology view, at least two of the processes; and the second control unit is configured to control the communications link between the selected processes to be displayed on the communications sequence diagram.
- the first monitoring unit 40 monitors the data content that flows through the relay communications node, and the data flow direction, to obtain communications data and a communications direction between the processes
- the second drawing unit
- the communications sequence diagram may further be displayed, which provides a sequence diagram that can visually reflect a communications flow direction between processes for the tester.
- the monitoring apparatus further includes a second receiving unit and a third control unit, where specifically, after the second control unit controls the communications link between the selected processes to be displayed on the communications sequence diagram, the second receiving unit is configured to receive a second instruction from a client, where the second instruction from a client is used to change, from the communications topology view, the selected processes; and the third control unit is configured to control the communications link between the changed processes to be displayed on the communications sequence diagram. In this way, the communications link between the processes displayed on the communications sequence diagram is increased or decreased.
- the monitoring apparatus further includes a third receiving unit and a second displaying unit, where after the communications link between the selected processes is controlled to be displayed on the communications sequence diagram, the third receiving unit is configured to receive a third instruction from a client, where the third instruction from a client is used to select, from the communications sequence diagram, a target communications link; and the second displaying unit is configured to display the communications data corresponding to the target communications link.
- the communications data between the processes is visually displayed for the tester.
- the monitoring apparatus further includes a fourth control unit, where before the communications link, which points to the communications direction, between every two of the processes that have the communications relationship is drawn, and the communications sequence diagram is generated, the fourth control unit controls the multiple processes to be distributed in a multi-column form, where only one of the processes is distributed in each column, and the processes in adjacent columns are different; or the fourth control unit controls the multiple processes to be distributed in a multi-row form, where only one of the processes is distributed in each row, and the processes in adjacent rows are different.
- FIG. 8a is a schematic diagram of a process monitoring apparatus according to an optional embodiment of the present invention.
- the monitoring apparatus provided in this optional embodiment mainly includes an obtaining unit 10, an establishing unit 20, an adding unit 30, a first monitoring unit 40, a first sending unit 501, a second monitoring unit 601, and a first judging unit 701.
- compositions and operating principles of the obtaining unit 10, the establishing unit 20, the adding unit 30, and the first monitoring unit 40 are the same as specific compositions and operating principles of the obtaining unit 10, the establishing unit 20, the adding unit 30, and the first monitoring unit 40 that are shown in FIG. 7, and details are not provided again herein.
- the first sending unit 501 is configured to: when it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, send, by using the relay communications node, a second request transmitted by a third process to the first process, where the first request includes a first feature, the second request includes a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features.
- the second monitoring unit 601 is configured to monitor a processing result of the first process for the second request.
- the first judging unit 701 is configured to determine a competition state of the first process according to the processing result.
- the to-be-tested system needs to properly process a request in this period.
- the tester inserts one data test request into one hierarchical invocation of a process group, to test whether a target process correctly processes the request. If the processing result indicates that the first process collapses, it may be determined that the competition state reflected in a response of the first process to a competition mechanism is weak.
- the processing result indicates that the first process can correctly feed back a feedback for the second request
- Testing in a case in which a first process sends a request, a situation of a competition of the first process for a request received from a third party is implemented.
- the first process is a process maysvrd
- the second process is a process world_login
- the third process is a process tconnd
- the foregoing monitoring manner is that: when the process maysvrd sends a piece of data whose content includes a feature D1 to the process world_login, a piece of data whose content includes a feature D2 is sent from the process tconnd to the process maysvrd by using the relay communications node, to test whether the process maysvrd correctly processes the request.
- the foregoing test rule may be defined in a JSON format as follows:
- FIG. 8b is a schematic diagram of a process monitoring apparatus according to another optional embodiment of the present invention.
- the monitoring apparatus provided in this optional embodiment mainly includes an obtaining unit 10, an establishing unit 20, an adding unit 30, a first monitoring unit 40, a second sending unit 502, a third monitoring unit 602, and a second judging unit 702.
- compositions and operating principles of the obtaining unit 10, the establishing unit 20, the adding unit 30, and the first monitoring unit 40 are the same as specific compositions and operating principles of the obtaining unit 10, the establishing unit 20, the adding unit 30, and the first monitoring unit 40 that are shown in FIG. 7, and details are not provided again herein.
- the second sending unit 502 is configured to: when it is monitored, by using the relay communications node, that a first process receives a first request transmitted from a second process, send, by using the relay communications node, a second request transmitted by a third process to the first process, where the first request includes a first feature, the second request includes a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features.
- the third monitoring unit 602 is configured to monitor a processing result of the first process for the second request.
- the second judging unit 702 is configured to determine a competition state of the first process according to the processing result.
- FIG. 8c is a schematic diagram of a process monitoring apparatus according to another optional embodiment of the present invention.
- the monitoring apparatus provided in this optional embodiment mainly includes an obtaining unit 10, an establishing unit 20, an adding unit 30, a first monitoring unit 40, a third sending unit 503, a fourth monitoring unit 603, and a third judging unit 703.
- the third sending unit 503 is configured to: when it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, send, by using the relay communications node, a second request transmitted by the first process to a third process, where the first request includes a first feature, the second request includes a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features.
- the fourth monitoring unit 603 is configured to monitor a processing result of the third process for the second request.
- the third judging unit 703 is configured to determine a competition state of the first process according to the processing result.
- FIG. 9 is a schematic diagram of a monitoring apparatus according to another optional embodiment of the present invention.
- the monitoring apparatus provided in this optional embodiment mainly includes an obtaining unit 10, an establishing unit 20, an adding unit 30, a first monitoring unit 40, a first extracting unit 80, a second extracting unit 90, and a first determining unit 100, where:
- compositions and operating principles of the obtaining unit 10 are the same as specific compositions and operating principles of the obtaining unit 10, the establishing unit 20, the adding unit 30, and the first monitoring unit 40 that are shown in FIG. 7, and details are not provided again herein;
- the first extracting unit 80 is configured to extract external input data and an SQL statement that are in the communications data, that is, extract the external input data and the SQL statement from the communications data between the processes that are monitored by the first monitoring unit 40;
- the second extracting unit 90 is configured to extract a parameter value Value_set from the SQL statement.
- the first determining unit 100 is configured to determine a correspondence between the external input data and the SQL statement according to a matching relationship between the parameter value and the external input data.
- the external input data and the SQL statement are extracted, and the correspondence between the two is determined, so that an effect of testing what kind of SQL statement can be generated from the external input data is achieved.
- the determined correspondence between the external input data and the SQL statement may further be displayed, so that the SQL statement generated from the external input data is visually provided for a tester.
- the first determining unit 100 mainly includes a second judging subunit, a second obtaining subunit, and a determining subunit, where: the second judging subunit is configured to determine whether same data exists in the external input data and the extracted value; the second obtaining subunit is configured to: in a case in which it is determined that the same data exists in the external input data and the extracted value, obtain an SQL statement in which the same data is located; and the determining subunit is configured to determine that the obtained SQL statement is an SQL statement corresponding to the external input data.
- the first extracting unit 80 mainly includes a third obtaining subunit and an extracting subunit, where: the third obtaining subunit is configured to obtain, from the monitored communications data, SQL data that flows to a database of the to-be-tested system; and the extracting subunit is configured to extract the SQL statement from the SQL data.
- the monitoring apparatus further includes a modifying unit, a fourth sending unit, and a second determining unit, where after the first determining unit 100 determines a correspondence between the external input data and the SQL statement according to a matching relationship between the parameter value and the external input data, the modifying unit is configured to modify the external input data; the fourth sending unit is configured to send the modified external input data to the to-be-tested system; and the second determining unit is configured to re-determine a correspondence between the modified external input data and the SQL statement.
- a specific determining method is the same as the foregoing method for the first determining unit 100 to determine the correspondence between the external input data and the SQL statement, and details are not provided again herein.
- the modified external input data is sent to the to-be-tested system, and then the correspondence between the modified external input data and the SQL statement is re-determined, so that an effect of purposely testing an SQL statement that can be generated from specific external data is achieved.
- This embodiment of the present invention further provides a process monitoring system, where the monitoring system includes any process monitoring apparatus provided in the foregoing content of this embodiment of the present invention and a to-be-tested system.
- the present disclosure implements monitoring of a communications logic between multiple processes of a to-be-tested system, which solves a technical problem that the communications logic between the multiple processes cannot be monitored in the existing technology, thereby achieving a technical effect of performing a gray-box test on the communications logic between the processes of the to-be-tested system.
- the described apparatus embodiments are merely exemplary.
- the unit division is merely logical function division and may be other division in actual implementation.
- a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed.
- the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces.
- the indirect couplings or communication connections between the units or modules may be implemented in electronic or other forms.
- the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. A part of or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
- functional units in the embodiments of the present invention may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units may be integrated into one unit.
- the integrated unit may be implemented in the form of hardware, or may be implemented in the form of a software functional unit.
- the functions may be stored in a computer-readable storage medium.
- the computer software product is stored in a storage medium and includes several instructions for instructing a computer device (which may be a personal computer, a server, a network device, or the like) to perform all or a part of the steps of the methods described in the embodiments of the present invention.
- the foregoing storage medium includes: any medium that can store program code, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a removable hard disk, a magnetic disk, or an optical disc.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
A process monitoring method, apparatus, and system are described. The method includes: obtaining processes of a to-be-tested system and a communications relationship between the processes, where the number of the processes is multiple; establishing communications channels between the processes according to the obtained communications relationship; adding a relay communications node connected to each of the communications channels; and monitoring data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
Description
FIELD OF THE TECHNOLOGY
The present disclosure relates to the data processing
field, and more specifically, to a process monitoring method, apparatus, and
system.
BACKGROUND OF THE DISCLOSURE
For testing a network software system, an existing
solution is generally to use a method for analyzing network communications data
between a client and a server, and most tools that are used perform the
analysis by capturing a communications packet between the client and the
server, and furthermore perform the test in a manner of tampering with the
data.
However, such an existing technology can only help a
tester perform a black-box test, and is feasible in a case in which there is
only one process in a background server. However, if multiple processes in the
background server jointly complete a request of the client, the tester cannot
analyze and test, by using the existing tools, such a logic of invocation
between background processes, and cannot perform a further gray-box test.
For a problem that a communications logic between
multiple processes cannot be monitored in the existing technology, no effective
solution has been put forward currently.
SUMMARY
Embodiments of the present invention provide a process
monitoring method, apparatus, and system, so as to at least solve a technical
problem that a communication logic between multiple processes cannot be tested
in the existing technology.
According to one aspect of the embodiments of the
present invention, a process monitoring method is provided, including:
obtaining processes of a to-be-tested system and a communications relationship
between the processes, where the number of the processes is multiple;
establishing communications channels between the processes according to the
obtained communications relationship; adding a relay communications node
connected to each of the communications channels; and monitoring data content
that flows through the relay communications node, and a data flow direction, to
obtain communications data and a communications direction between the
processes.
According to another aspect of the embodiments of the
present invention, a process monitoring apparatus is further provided,
including: an obtaining unit, configured to obtain processes of a to-be-tested
system and a communications relationship between the processes, where the
number of the processes is multiple; an establishing unit, configured to
establish communications channels between the processes according to the
obtained communications relationship; an adding unit, configured to add a relay
communications node connected to each of the communications channels; and a
first monitoring unit, configured to monitor data content that flows through
the relay communications node, and a data flow direction, to obtain
communications data and a communications direction between the processes.
According to a yet another aspect of the embodiments
of the present invention, a process monitoring system is further provided,
including any process monitoring apparatus provided in the foregoing
content.
In the embodiments of the present invention, in a
manner of obtaining processes of a to-be-tested system and a communications
relationship between the processes, where the number of the processes is
multiple; establishing communications channels between the processes according
to the obtained communications relationship; adding a relay communications node
connected to each of the communications channels; and monitoring data content
that flows through the relay communications node, and a data flow direction, to
obtain communications data and a communications direction between the
processes, the relay communications node connected to each communications
channel between the processes is added, so that the data content that flows
through the relay communications node and the flow direction can be monitored,
to obtain the communications data transmitted between the processes connected
by the communications channel and a transmission direction of the data, and
thereby monitoring of a communications logic between the multiple processes of
the to-be-tested system is implemented, which solves a technical problem that
the communications logic between the multiple processes cannot be monitored in
the existing technology, thereby achieving a technical effect of performing a
gray-box test on the communications logic between the processes of the
to-be-tested system.
BRIEF DESCRIPTION OF THE DRAWINGS
Accompanying drawings described herein are used to
provide further understanding about the present disclosure, and constitute one
portion of this application; and schematic embodiments of the present invention
and their description are used to explain the present disclosure, and do not
constitute an inappropriate limit on the present disclosure. In the
accompanying drawings:
FIG. 1 is a flowchart of a process monitoring method
according to an embodiment of the present invention;
FIG. 2a and FIG. 2b are schematic diagrams of adding
a relay communications node connected to each communications channel in a
monitoring method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a communications
topology view generated by a monitoring method according to an embodiment of
the present invention;
FIG. 4 is a schematic diagram of a communications
sequence diagram generated by a monitoring method according to an embodiment of
the present invention;
FIG. 5a is a flowchart of a monitoring method
according to an optional embodiment of the present invention;
FIG. 5b is a flowchart of a monitoring method
according to another optional embodiment of the present invention;
FIG. 5c is a flowchart of a monitoring method
according to another optional embodiment of the present invention;
FIG. 6 is a flowchart of a monitoring method
according to another optional embodiment of the present invention;
FIG. 7 is a schematic diagram of a process monitoring
apparatus according to an embodiment of the present invention;
FIG. 8a is a schematic diagram of a monitoring
apparatus according to an optional embodiment of the present invention;
FIG. 8b is a schematic diagram of a monitoring
apparatus according to another optional embodiment of the present
invention;
FIG. 8c is a schematic diagram of a monitoring
apparatus according to another optional embodiment of the present invention;
and
FIG. 9 is a schematic diagram of a monitoring
apparatus according to another optional embodiment of the present
invention.
DESCRIPTION OF EMBODIMENTS
To make the solutions of the present disclosure more
comprehensible for persons skilled in the art, the following clearly and
completely describes the technical solutions in the embodiments of the present
invention with reference to the accompanying drawings in the embodiments of the
present invention. Apparently, the described embodiments are merely a part
rather than all of the embodiments of the present invention. All other
embodiments obtained by persons of ordinary skill in the art based on the
embodiments of the present invention without creative efforts shall fall within
the protection scope of the present disclosure.
It should be noted that, terms "first" and "second"
in the specification, claims, and the foregoing accompanying drawings of the
present disclosure are used to distinguish similar objects, but are
unnecessarily used to describe a specific sequence or order. It should be
understood that, data used in this way can be interchanged in an appropriate
case, so that the embodiments of the present invention that are described
herein can be implemented in a sequence other than those sequences illustrated
or described herein. In addition, terms "include" and "have" and any of their
variations are intended to cover nonexclusive including, for example, a
process, method, system, product, or device that includes a series of steps or
units does not have to be limited to those clearly listed steps or units, but
may include another step or unit that is not clearly listed or is inherent to
the process, method, product, or device.
Embodiment 1
According to this embodiment of the present
invention, a process monitoring method is provided. As shown in FIG. 1, the
method includes the following step S102 to step S108:
S102: Obtain processes of a to-be-tested system and a
communications relationship between the processes, where the number of the
processes is multiple.
For the obtaining of the processes of the
to-be-tested system, all of the processes of the to-be-tested system may be
obtained according to a working directory in which the to-be-tested system is
located and by using a script language provided by an operating system. For
example, the processes of the to-be-tested system are obtained by remotely
executing a shell command by using ssh. For the obtaining of the communications
relationship between the processes, the communications relationship between the
processes may be obtained by remotely executing netstat and ipcm commands by
using ssh.
S104: Establish communications channels between the
processes according to the obtained communications relationship, that is,
establish one communications channel between every two processes that have the
communications relationship.
S106: Add a relay communications node connected to
each of the communications channels, that is, add the relay communications node
as an agent communications node, so that each communications channel
communicates by using this added relay communications node.
S108: Monitor data content that flows through the
relay communications node, and a data flow direction, to obtain communications
data and a communications direction between the processes. The relay
communications node is connected to each communications channel, and therefore
by monitoring the data content that flows through the relay communications node
and the data flow direction, the data content transmitted through the
communications channel and a transmission direction may be obtained, that is,
the communications data and the communications direction between the processes
may be obtained.
For a process monitoring method provided in this
embodiment of the present invention, a relay communications node connected to
each communications channel between processes is added, so that data content
that flows through the relay communications node and a flow direction can be
monitored, to obtain communications data transmitted between the processes
connected by the communications channel and a transmission direction of the
data, and thereby monitoring of a communications logic between the multiple
processes of the to-be-tested system is implemented, which solves a technical
problem that the communications logic between the multiple processes cannot be
monitored in the existing technology, thereby achieving a technical effect of
performing a gray-box test on the communications logic between the processes of
the to-be-tested system.
Specifically, the monitoring data content that flows
through the relay communications node, and a data flow direction, to obtain
communications data and a communications direction between the processes
includes: monitoring data content of a first process and a second process that
flows through the relay communications node, and a data flow direction, to
obtain communications data and a communications direction between the first
process and the second process, where the first process and the second process
are any two processes that have a communications relationship in the multiple
processes.
Further, the communications relationship obtained in
step S102 includes a communications manner, and in this embodiment of the
present invention, the relay communications node connected to each
communications channel may be added in the following manner:
First, a first communications manner in which a first
process and a second process send data to and receive data from each other is
obtained, where the first process and the second process are any two processes
that have a communications relationship in the multiple processes.
Next, whether the first communications manner is the
same as a second communications manner in which the relay communications node
sends and receives data is determined.
In a case in which it is determined that the first
communications manner is different from the second communications manner, a
connection between the first process and a first conversion process is
established, and a connection between the second process and a second
conversion process is established, where the first conversion process and the
second conversion process are both processes connected to the relay
communications node in the second communications manner, a manner in which the
first conversion process communicates with the first process is the first
communications manner, and a manner in which the second conversion process
communicates with the second process is the first communications manner; and in
a case in which it is determined that the first communications manner is the
same as the second communications manner, a connection between the first
process and the relay communications node is established, and a connection
between the second process and the relay communications node is
established.
Still further, in this embodiment of the present
invention, a connection between a process and a corresponding conversion
process may be established in a manner of changing a target connection address
of the process, and a connection between a process and the relay communications
node may be established in the manner of changing a target connection address
of the process; the following steps may be used in the specific establishing
manner:
The establishing a connection between the first
process and a first conversion process, and establishing a connection between
the second process and a second conversion process is specifically: obtaining a
target connection address of the first process and a target connection address
of the second process; and changing the target connection address of the first
process to an address of the first conversion process, and changing the target
connection address of the second process to an address of the second conversion
process. More specifically, when a process initializes a connection, a target
connection address of the process may be changed in a hook manner.
The establishing a connection between the first
process and the relay communications node, and establishing a connection
between the second process and the relay communications node is specifically:
obtaining the target connection address of the first process and the target
connection address of the second process; and changing the target connection
address of the first process to a first connection address, and changing the
target connection address of the second process to a second connection address,
where the first connection address is an address, which is in the relay
communications node, for communicating with the first process, and the second
connection address is an address, which is in the relay communications node,
for communicating with the second process.
Further, for example, a communications protocol on
which a manner of communication between processes is based generally includes
memory sharing, a tcp protocol, a udp protocol, piping, a file, a semaphore,
and the like. A second communications manner in which the relay communications
node sends and receives data is similarly based on one of the foregoing
protocols. A different communications protocol used indicates a different
corresponding communications manner. The following specifically provides
description by using an example in which a process A and a process B
communicate with each other by using the tcp protocol, the process A and a
process C communicate with each other by using the udp protocol, the process B
and the process C communicate with each other by using the content sharing, and
a second communications manner used by a relay communications node P is a tcp
protocol-based communications manner, which is shown in FIG. 2a and FIG. 2b,
and then that the relay communications node connected to each communications
channel is added is specifically:
The process A is connected to a udp converter 1, to
make the process A communicate with the udp converter 1 by using udp, the
process C is connected to a udp converter 2, to make the process C communicate
with the udp converter 2 by using udp, and the udp converter 1 and the udp
converter 2 are both connected to the relay communications node P, where the
two udp converters both communicate with the relay communications node P by
using tcp, so as to add the relay communications node P to a communications
channel between the process A and the process C. A target connection address of
the process A may be changed to an address of the udp converter 1, to connect
the process A to the udp converter 1, where to change the target connection
address of the process A to the address of the udp converter 1 is to change the
target connection address of the process A to a network port of the udp
converter 1. Similarly, a target connection address of the process C may be
changed to an address of the udp converter 2, to connect the process C to the
udp converter 2, where to change a target connection address of a process C to
the address of the udp converter 2 is to change the target connection address
of the process C to a network port of the udp converter 2.
The process B is connected to a memory converter 1,
to make the process B communicate with the memory converter 1 in the memory
sharing manner, the process C is connected to a memory converter 2, to make the
process C communicate with the memory converter 2 in the memory sharing manner,
and the memory converter 1 and the memory converter 2 are both connected to the
relay communications node P, where the two memory converters both communicate
with the relay communications node P by using tcp, so as to add the relay
communications node P to a communications channel between the process B and the
process C. A target connection address of the process B may be changed to an
address of the memory converter 1, to connect the process B to the memory
converter 1, where to change the target connection address of the process B to
the address of the memory converter 1 is to change a memory keyword of the
process B to a memory keyword of the memory converter 1. Similarly, a target
connection address of the process C may be changed to an address of the memory
converter 2, to connect the process C to the memory converter 2, where to
change the target connection address of the process C to the address of the
memory converter 2 is to change a memory keyword of the process C to a memory
keyword of the memory converter 2.
The process A and the process B communicate with each
other by directly using the tcp protocol, and the communications manner is the
same as that used by the relay communications node P. Therefore, the process A
and the process B may be directly connected to a relevant communications
address of the relay communications node P without a need to establish a
connection between a process and a converter again.
Certainly, if the communications manner used by the
relay communications node P is not a manner that is based on the tcp protocol,
it needs to connect the process A to a tcp converter 1, to make the process A
communicate with the tcp converter 1 by using tcp, and connect the process C to
a tcp converter 2, to make the process C communicate with the tcp converter 2
by using tcp, and the tcp converter 1 and the tcp converter 2 are both
connected to the relay communications node P, where the two tcp converters both
communicate with the relay communications node P in the communications manner
used by the relay communications node P, so as to add the relay communications
node P to a communications channel between the process A and the process C. A
target connection address of the process A may be changed to an address of the
tcp converter 1, to connect the process A to the tcp converter 1, where to
change the target connection address of the process A to the address of the tcp
converter 1 is to change the target connection address of the process A to a
network port of the tcp converter 1. Similarly, a target connection address of
the process C may be changed to an address of the tcp converter 2, to connect
the process C to the tcp converter 2, where to change a target connection
address of the process C to the address of the tcp converter 2 is to change the
target connection address of the process C to a network port of the tcp
converter 2.
A tcp converter, a udp converter, a memory converter,
and another converter for performing communications manner conversion all
implement conversion processes by using programs.
After the relay communications node connected to each
communications channel is added, a connection path between a process and the
relay communications node is established. Accordingly, after the process is
restarted, an original communications channel of the process is modified to a
communications channel connected to the relay communications node. In this way,
the data content that flows through the relay communications node, and the data
flow direction may be monitored, to obtain communications data and a
communications direction between the processes.
Preferably, after the establishing communications
channels between the processes according to the obtained communications
relationship in step S104, the monitoring method in this embodiment of the
present invention further includes: drawing a communications topology view by
using each of the processes as a node and using each of the communications
channels as a node connection path; and displaying the communications topology
view. In this way, a communications topology view that can visually reflect the
communications relationship between the processes is provided for a tester.
Further, before the drawing a communications topology
view by using each of the processes as a node and using each of the
communications channels as a node connection path, the monitoring method
further includes: controlling the multiple processes to be distributed in a
multi-column form, where the processes that have the communications
relationship are distributed in adjacent columns; or controlling the multiple
processes to be distributed in a multi-row form, where the processes that have
the communications relationship are distributed in adjacent rows. In this way,
crossing of connection paths between the processes is prevented to the greatest
extent, so that the communications topology view that is drawn can clearly and
concisely reflect the communications relationship between processes. As shown
in FIG. 3, which is a schematic diagram of a communications topology view
generated by a monitoring method according to an embodiment of the present
invention, this figure schematically shows that multiple processes are
distributed in a multi-column form, and in FIG. 3, p0 indicates an external
process, and p1, p2, …, and pn indicate multiple processes.
Preferably, after the monitoring data content that
flows through the relay communications node, and a data flow direction, to
obtain communications data and a communications direction between the processes
in step S108, the monitoring method in this embodiment of the present invention
further includes:
drawing a communications link, which points to the
communications direction, between every two of the processes that have the
communications relationship, and generating a communications sequence diagram,
where each communications link has corresponding communications data;
associating the communications topology view with the communications sequence
diagram; receiving a first instruction from a client, where the first
instruction from a client is used to select, from the communications topology
view, at least two of the processes; and controlling the communications link
between the selected processes to be displayed on the communications sequence
diagram.
By drawing the communications sequence diagram,
associating the communications sequence diagram with the communications
topology view, and controlling the selected communications link to be displayed
on the communications sequence diagram, an effect that the tester can
voluntarily select, according to an intention of the tester, a process which
the tester is concerned with, to observe a communications flow direction of the
process is achieved.
After the communications sequence diagram is
generated, the communications sequence diagram may further be displayed, which
provides a sequence diagram that can visually reflect a communications flow
direction between processes for the tester.
Further, after the controlling the communications
link between the selected processes to be displayed on the communications
sequence diagram, the monitoring method further includes: receiving a second
instruction from a client, where the second instruction from a client is used
to change, from the communications topology view, the selected processes; and
controlling the communications link between the changed processes to be
displayed on the communications sequence diagram. In this way, the
communications link between the processes displayed on the communications
sequence diagram is increased or decreased.
Still further, after the controlling the
communications link between the selected processes to be displayed on the
communications sequence diagram, the monitoring method further includes:
receiving a third instruction from a client, where the third instruction from a
client is used to select, from the communications sequence diagram, a target
communications link; and displaying the communications data corresponding to
the target communications link. The communications data between the processes
is visually displayed for the tester.
Before the drawing a communications link, which
points to the communications direction, between every two of the processes that
have the communications relationship, and generating a communications sequence
diagram, the monitoring method further includes: controlling the multiple
processes to be distributed in a multi-column form, where only one of the
processes is distributed in each column, and the processes in adjacent columns
are different; or controlling the multiple processes to be distributed in a
multi-row form, where only one of the processes is distributed in each row, and
the processes in adjacent rows are different. As shown in FIG. 4, which is a
schematic diagram of a communications sequence diagram generated by a
monitoring method according to an embodiment of the present invention, this
figure schematically shows that 7 processes, which are p1 to p7, are
distributed in a multi-column form.
FIG. 5a is a flowchart of a process monitoring method
according to an optional embodiment of the present invention. As shown in FIG.
5a, the monitoring method provided in the optional embodiment mainly includes
the following step S5a02 to step S5a14:
S5a02: Obtain processes of a to-be-tested system and
a communications relationship between the processes, where the number of the
processes is multiple.
This step is the same as the foregoing step S102.
S5a04: Establish communications channels between the
processes according to the obtained communications relationship.
This step is the same as the foregoing step S104.
S5a06: Add a relay communications node connected to
each of the communications channels.
This step is the same as the foregoing step S106.
S5a08: Monitor data content that flows through the
relay communications node, and a data flow direction, to obtain communications
data and a communications direction between the processes.
This step is the same as the foregoing step S108.
S5a10: When it is monitored, by using the relay
communications node, that a first process transmits a first request to a second
process, send, by using the relay communications node, a second request
transmitted by a third process to the first process, where the first request
includes a first feature, the second request includes a second feature, the
first process and the second process are any two processes that have a
communications relationship in the multiple processes, the third process is a
process, which is in the multiple processes, that has a communications
relationship with the first process, the third process and the second process
are different processes, and the first feature and the second feature are
different features.
S5a12: Monitor a processing result of the first
process for the second request.
S5a14: Determine a competition state of the first
process according to the processing result.
In a procedure in which multiple processes complete a
transaction collaboratively, a competition state window period exists.
Therefore, for maintaining transactionality, the to-be-tested system needs to
properly process a request in this period. By performing the foregoing step
Sa510 to step Sa514, the tester inserts one data test request into one
hierarchical invocation of a process group, to test whether a target process
correctly processes the request. If the processing result indicates that the
first process collapses, it may be determined that the competition state
reflected in a response of the first process to a competition mechanism is
weak. On the contrary, if the processing result indicates that the first
process can correctly feed back a feedback for the second request, it may be
determined that the competition state reflected in the response of the first
process to the competition mechanism is strong. Testing, in a case in which a
first process sends a request, a situation of a competition of the first
process for a request received from a third party is implemented.
It is assumed that, the first process is a process
maysvrd, the second process is a process world_login, and the third process is
a process tconnd, and then the foregoing monitoring manner is that: when the
process maysvrd sends a piece of data whose content includes a feature D1 to
the process world_login, a piece of data whose content includes a feature D2 is
sent from the process tconnd to the process maysvrd by using the relay
communications node, to test whether the process maysvrd correctly processes
the request. Specifically, the foregoing test rule may be defined in a JSON
format as follows:
{
"when_from":maysvrd,//Condition of a source
process
"when_to":world_login,//Condition of a target
process
"feature":D1,//Feature of data content
"hack_from":tconnd,//Testing a to-be-sent source
process
"hack_to":maysvrd,//Testing a to-be-sent target
process
"payload":D2//Testing to-be-sent data
}
FIG. 5b is a flowchart of a process monitoring method
according to another optional embodiment of the present invention. As shown in
FIG. 5b, the monitoring method provided in the optional embodiment mainly
includes the following step S5b02 to step S5b14:
S5b02: Obtain processes of a to-be-tested system and
a communications relationship between the processes, where the number of the
processes is multiple.
This step is the same as the foregoing step S102.
S5b04: Establish communications channels between the
processes according to the obtained communications relationship.
This step is the same as the foregoing step S104.
S5b06: Add a relay communications node connected to
each of the communications channels.
This step is the same as the foregoing step S106.
S5b08: Monitor data content that flows through the
relay communications node, and a data flow direction, to obtain communications
data and a communications direction between the processes.
This step is the same as the foregoing step S108.
S5b10: When it is monitored, by using the relay
communications node, that a first process receives a first request transmitted
from a second process, send, by using the relay communications node, a second
request transmitted by a third process to the first process, where the first
request includes a first feature, the second request includes a second feature,
the first process and the second process are any two processes that have a
communications relationship in the multiple processes, the third process is a
process, which is in the multiple processes, that has a communications
relationship with the first process, the third process and the second process
are different processes, and the first feature and the second feature are
different features.
S5b12: Monitor a processing result of the first
process for the second request.
S5b14: Determine a competition state of the first
process according to the processing result.
Same as the foregoing principle, testing, in a case
in which a first process receives a request, a situation of a competition of
the first process for a request received from a third party is implemented.
FIG. 5c is a flowchart of a process monitoring method
according to another optional embodiment of the present invention. As shown in
FIG. 5c, the monitoring method provided in the optional embodiment mainly
includes the following step S5c02 to step S5c14:
S5c02: Obtain processes of a to-be-tested system and
a communications relationship between the processes, where the number of the
processes is multiple.
This step is the same as the foregoing step
S102.
S5c04: Establish communications channels between the
processes according to the obtained communications relationship.
This step is the same as the foregoing step
S104.
S5c06: Add a relay communications node connected to
each of the communications channels.
This step is the same as the foregoing step
S106.
S5c08: Monitor data content that flows through the
relay communications node, and a data flow direction, to obtain communications
data and a communications direction between the processes.
This step is the same as the foregoing step
S108.
S5c10: When it is monitored, by using the relay
communications node, that a first process transmits a first request to a second
process, send, by using the relay communications node, a second request
transmitted by the first process to a third process, where the first request
includes a first feature, the second request includes a second feature, the
first process and the second process are any two processes that have a
communications relationship in the multiple processes, the third process is a
process, which is in the multiple processes, that has a communications
relationship with the first process, the third process and the second process
are different processes, and the first feature and the second feature are
different features.
S5c12: Monitor a processing result of the third
process for the second request.
S5c14: Determine a competition state of the first
process according to the processing result.
Same as the foregoing principle, testing, in a case
in which a first process sends a request, a situation of a competition of the
first process for sending another request is implemented.
FIG. 6 is a flowchart of a monitoring method
according to another optional embodiment of the present invention. As shown in
FIG. 6, the monitoring method provided in the optional embodiment mainly
includes the following step S602 to step S614:
S602: Obtain processes of a to-be-tested system and
a communications relationship between the processes, where the number of the
processes is multiple.
This step is the same as the foregoing step
S102.
S604: Establish communications channels between the
processes according to the obtained communications relationship.
This step is the same as the foregoing step
S104.
S606: Add a relay communications node connected to
each of the communications channels.
This step is the same as the foregoing step
S106.
S608: Monitor data content that flows through the
relay communications node, and a data flow direction, to obtain communications
data and a communications direction between the processes.
This step is the same as the foregoing step
S108.
S610: Extract external input data and an SQL
statement that are in the communications data, that is, extract the external
input data and the SQL statement from the communications data between the
processes that are monitored in the foregoing step S608.
S612: Extract a parameter value Value_set from the
SQL statement.
S614: Determine a correspondence between the
external input data and the SQL statement according to a matching relationship
between the parameter value and the external input data.
The external input data and the SQL statement are
extracted, and the correspondence between the two is determined, so that an
effect of testing what kind of SQL statement can be generated from the external
input data is achieved.
Further, the determined correspondence between the
external input data and the SQL statement may further be displayed, so that the
SQL statement generated from the external input data is visually provided for a
tester.
Specifically, in this embodiment of the present
invention, the correspondence between the external input data and the SQL
statement may be determined in the following manner: first, whether same data
exists in the external input data and the extracted value is determined; next,
in a case in which it is determined that the same data exists in the external
input data and the extracted value, an SQL statement in which the same data is
located is obtained; and after that, it is determined that the obtained SQL
statement is an SQL statement corresponding to the external input data.
The SQL statement in the communications data is
extracted in the following manner: first, SQL data that flows to a database of
the to-be-tested system is obtained from the monitored communications data; and
after that, the SQL statement is extracted from the SQL data.
Still further, after the determining a
correspondence between the external input data and the SQL statement according
to a matching relationship between the parameter value and the external input
data, the monitoring method in this embodiment of the present invention further
includes: modifying the external input data; sending the modified external
input data to the to-be-tested system; and re-determining a correspondence
between the modified external input data and the SQL statement, where a
specific determining method is the same as the foregoing method for determining
the correspondence between the external input data and the SQL statement, and
details are not provided again herein.
The modified external input data is sent to the
to-be-tested system, and then the correspondence between the modified external
input data and the SQL statement is re-determined, so that an effect of
purposely testing an SQL statement that can be generated from specific external
data is achieved.
It should be noted that, for brevity, the above
method embodiments are represented as a series of actions. But those skilled in
the art should appreciate that the present disclosure is not limited to the
order of the described actions, because according to the present disclosure,
some steps may adopt other order or occur simultaneously. It should be further
understood by persons skilled in the art that the described embodiments all
belong to exemplary embodiments, and the involved actions and modules are not
necessarily required by the present disclosure.
Through the descriptions of the preceding
embodiments, persons skilled in the art may understand that the methods
according to the foregoing embodiments may be implemented by hardware only or
by software and a necessary universal hardware platform. However, in most
cases, using software and a necessary universal hardware platform are
preferred. Based on such an understanding, the technical solutions of the
present disclosure essentially, or the part contributing to the existing
technology may be implemented in a form of a software product. The computer
software product is stored in a storage medium (such as a ROM/RAM, a magnetic
disk, or an optical disc) and includes several instructions for instructing a
terminal device (which may be a mobile phone, a computer, a server, a network
device, or the like) to perform the methods described in the embodiments of the
present invention.
Embodiment 2
According to this embodiment of the present
invention, a process monitoring apparatus for implementing the foregoing
process monitoring method is further provided, where the monitoring apparatus
is mainly configured to execute the monitoring method provided in the foregoing
content in the embodiments of the present invention. The following specifically
describes the process monitoring apparatus provided in this embodiment of the
present invention:
FIG. 7 is a schematic diagram of a process
monitoring apparatus according to an embodiment of the present invention. As
shown in FIG. 7, the monitoring apparatus mainly includes an obtaining unit 10,
an establishing unit 20, an adding unit 30, and a first monitoring unit 40,
where:
the obtaining unit 10 is configured to obtain
processes of a to-be-tested system and a communications relationship between
the processes, where the number of the processes is multiple,
where, for the obtaining of the processes of the
to-be-tested system, all of the processes of the to-be-tested system may be
obtained according to a working directory in which the to-be-tested system is
located and by using a script language provided by an operating system; for
example, the processes of the to-be-tested system are obtained by remotely
executing a shell command by using ssh; for the obtaining of the communications
relationship between the processes, the communications relationship between the
processes may be obtained by remotely executing netstat and ipcm commands by
using ssh;
the establishing unit 20 is configured to establish
communications channels between the processes according to the obtained
communications relationship, that is, establish one communications channel
between every two processes that have the communications relationship;
the adding unit 30 is configured to add a relay
communications node connected to each of the communications channels, that is,
add the relay communications node as an agent communications node, so that each
communications channel communicates by using this added relay communications
node; and
the first monitoring unit 40 is configured to
monitor data content that flows through the relay communications node, and a
data flow direction, to obtain communications data and a communications
direction between the processes. The relay communications node is connected to
each communications channel, and therefore by monitoring the data content that
flows through the relay communications node and the data flow direction, the
data content transmitted through the communications channel and a transmission
direction may be obtained, that is, the communications data and the
communications direction between the processes may be obtained.
For a process monitoring apparatus provided in this
embodiment of the present invention, a relay communications node connected to
each communications channel between processes is added, so that data content
that flows through the relay communications node and a flow direction can be
monitored, to obtain communications data transmitted between the processes
connected by the communications channel and a transmission direction of the
data, and thereby monitoring of a communications logic between the multiple
processes of the to-be-tested system is implemented, which solves a technical
problem that the communications logic between the multiple processes cannot be
monitored in the existing technology, thereby achieving a technical effect of
performing a gray-box test on the communications logic between the processes of
the to-be-tested system.
Specifically, the first monitoring unit 40 includes
a monitoring subunit, where the monitoring subunit is configured to monitor
data content of a first process and a second process that flows through the
relay communications node, and a data flow direction, to obtain communications
data and a communications direction between the first process and the second
process, where the first process and the second process are any two processes
that have a communications relationship in the multiple processes.
Further, the communications relationship obtained by
the obtaining unit 10 includes a communications manner. In this embodiment of
the present invention, the adding unit 30 mainly includes a first obtaining
subunit, a first judging subunit, a first establishing subunit, and a second
establishing subunit. The foregoing subunits mainly add, in the following
manner, the relay communications node connected to each communications
channel:
The first obtaining subunit is configured to obtain
a first communications manner in which a first process and a second process
send data to and receive data from each other, where the first process and the
second process are any two processes that have a communications relationship in
the multiple processes.
The first judging subunit is configured to determine
whether the first communications manner is the same as a second communications
manner in which the relay communications node sends and receives data.
The first establishing subunit is configured to: in
a case in which the first judging subunit determines that the first
communications manner is different from the second communications manner,
establish a connection between the first process and a first conversion
process, and establish a connection between the second process and a second
conversion process, where the first conversion process and the second
conversion process are both processes connected to the relay communications
node in the second communications manner, a manner in which the first
conversion process communicates with the first process is the first
communications manner, and a manner in which the second conversion process
communicates with the second process is the first communications manner.
The second establishing subunit is configured to: in
a case in which the first judging subunit determines that the first
communications manner is the same as the second communications manner,
establish a connection between the first process and the relay communications
node, and establish a connection between the second process and the relay
communications node.
Still further, the first establishing subunit
includes a first obtaining module and a first changing module, and the second
establishing subunit includes a second obtaining module and a second changing
module, where:
the first obtaining module is configured to obtain a
target connection address of the first process and a target connection address
of the second process; and the first changing module is configured to change
the target connection address of the first process to an address of the first
conversion process, and change the target connection address of the second
process to an address of the second conversion process; that is, by using a
collaboration between the first obtaining module and the first changing module,
a connection between a process and a corresponding conversion process is
established in a manner of changing a target connection address of the process;
and
the second obtaining module is configured to obtain
the target connection address of the first process and the target connection
address of the second process; and the second changing module is configured to
change the target connection address of the first process to a first connection
address, and change the target connection address of the second process to a
second connection address, where the first connection address is an address,
which is in the relay communications node, for communicating with the first
process, and the second connection address is an address, which is in the relay
communications node, for communicating with the second process; that is, by
using a collaboration between the second obtaining module and the second
changing module, a connection between a process and the relay communications
node is established in a manner of changing a target connection address of the
process.
Further, for example, a communications protocol on
which a manner of communication between processes is based generally includes
memory sharing, a tcp protocol, a udp protocol, piping, a file, a semaphore,
and the like. A second communications manner in which the relay communications
node sends and receives data is similarly based on one of the foregoing
protocols. A different communications protocol used indicates a different
corresponding communications manner. By using an example in which a process A
and a process B communicate with each other by using the tcp protocol, the
process A and a process C communicate with each other by using the udp
protocol, the process B and the process C communicate with each other by using
the content sharing, and a second communications manner used by a relay
communications node P is a tcp protocol-based communications manner, which is
shown in FIG. 2a and FIG. 2b, the following specifically describes a specific
principle for the adding unit 30 to add the relay communications node connected
to each communications channel:
The process A is connected to a udp converter 1, to
make the process A communicate with the udp converter 1 by using udp, the
process C is connected to a udp converter 2, to make the process C communicate
with the udp converter 2 by using udp, and the udp converter 1 and the udp
converter 2 are both connected to the relay communications node P, where the
two udp converters both communicate with the relay communications node P by
using tcp, so as to add the relay communications node P to a communications
channel between the process A and the process C. A target connection address of
the process A may be changed to an address of the udp converter 1, to connect
the process A to the udp converter 1, where to change the target connection
address of the process A to the address of the udp converter 1 is to change the
target connection address of the process A to a network port of the udp
converter 1. Similarly, a target connection address of the process C may be
changed to an address of the udp converter 2, to connect the process C to the
udp converter 2, where to change a target connection address of a process C to
the address of the udp converter 2 is to change the target connection address
of the process C to a network port of the udp converter 2.
The process B is connected to a memory converter 1,
to make the process B communicate with the memory converter 1 in the memory
sharing manner, the process C is connected to a memory converter 2, to make the
process C communicate with the memory converter 2 in the memory sharing manner,
and the memory converter 1 and the memory converter 2 are both connected to the
relay communications node P, where the two memory converters both communicate
with the relay communications node P by using tcp, so as to add the relay
communications node P to a communications channel between the process B and the
process C. A target connection address of the process B may be changed to an
address of the memory converter 1, to connect the process B to the memory
converter 1, where to change the target connection address of the process B to
the address of the memory converter 1 is to change a memory keyword of the
process B to a memory keyword of the memory converter 1. Similarly, a target
connection address of the process C may be changed to an address of the memory
converter 2, to connect the process C to the memory converter 2, where to
change the target connection address of the process C to the address of the
memory converter 2 is to change a memory keyword of the process C to a memory
keyword of the memory converter 2.
The process A and the process B communicate with
each other by directly using the tcp protocol, and the communications manner is
the same as that used by the relay communications node P. Therefore, the
process A and the process B may be directly connected to a relevant
communications address of the relay communications node P without a need to
establish a connection between a process and a converter again.
Certainly, if the communications manner used by the
relay communications node P is not a manner that is based on the tcp protocol,
it needs to connect the process A to a tcp converter 1, to make the process A
communicate with the tcp converter 1 by using tcp, and connect the process C to
a tcp converter 2, to make the process C communicate with the tcp converter 2
by using tcp, and the tcp converter 1 and the tcp converter 2 are both
connected to the relay communications node P, where the two tcp converters both
communicate with the relay communications node P in the communications manner
used by the relay communications node P, so as to add the relay communications
node P to a communications channel between the process A and the process C. A
target connection address of the process A may be changed to an address of the
tcp converter 1, to connect the process A to the tcp converter 1, where to
change the target connection address of the process A to the address of the tcp
converter 1 is to change the target connection address of the process A to a
network port of the tcp converter 1. Similarly, a target connection address of
the process C may be changed to an address of the tcp converter 2, to connect
the process C to the tcp converter 2, where to change a target connection
address of the process C to the address of the tcp converter 2 is to change the
target connection address of the process C to a network port of the tcp
converter 2.
A tcp converter, a udp converter, a memory
converter, and another converter for performing communications manner
conversion all implement conversion processes by using programs.
After the relay communications node connected to
each communications channel is added, a connection path between a process and
the relay communications node is established. Accordingly, after the process is
restarted, an original communications channel of the process is modified to a
communications channel connected to the relay communications node. In this way,
the data content that flows through the relay communications node, and the data
flow direction may be monitored, to obtain communications data and a
communications direction between the processes.
Preferably, the monitoring apparatus in this
embodiment of the present invention further includes a first drawing unit and a
first displaying unit, where after the establishing unit 20 establishes
communications channels between the processes according to the obtained
communications relationship, the first drawing unit draws a communications
topology view by using each of the processes as a node and using each of the
communications channels as a node connection path. The first displaying unit is
configured to display the communications topology view. In this way, a
communications topology view that can visually reflect the communications
relationship between the processes is provided for a tester.
Further, the monitoring apparatus further includes a
first control unit, where before the first drawing unit draws a communications
topology view by using each of the processes as a node and using each of the
communications channels as a node connection path, the first control unit is
configured to control the multiple processes to be distributed in a
multi-column form, where the processes that have the communications
relationship are distributed in adjacent columns. Alternatively, the first
control unit is configured to control the multiple processes to be distributed
in a multi-row form, where the processes that have the communications
relationship are distributed in adjacent rows. In this way, crossing of
connection paths between the processes is prevented to the greatest extent, so
that the communications topology view that is drawn by the first drawing unit
can clearly and concisely reflect the communications relationship between
processes.
Preferably, the monitoring apparatus further
includes a second drawing unit, an associating unit, a first receiving unit,
and a second control unit, where after the first monitoring unit 40 monitors
the data content that flows through the relay communications node, and the data
flow direction, to obtain communications data and a communications direction
between the processes, the second drawing unit is configured to draw a
communications link, which points to the communications direction, between
every two of the processes that have the communications relationship, and
generate a communications sequence diagram, where each communications link has
corresponding communications data; the associating unit is configured to
associate the communications topology view with the communications sequence
diagram; the first receiving unit is configured to receive a first instruction
from a client, where the first instruction from a client is used to select,
from the communications topology view, at least two of the processes; and the
second control unit is configured to control the communications link between
the selected processes to be displayed on the communications sequence
diagram.
By drawing the communications sequence diagram,
associating the communications sequence diagram with the communications
topology view, and controlling the selected communications link to be displayed
on the communications sequence diagram, an effect that the tester can
voluntarily select, according to an intention of the tester, a process which
the tester is concerned with, to observe a communications flow direction of the
process is achieved.
After the communications sequence diagram is
generated, the communications sequence diagram may further be displayed, which
provides a sequence diagram that can visually reflect a communications flow
direction between processes for the tester.
Further, the monitoring apparatus further includes a
second receiving unit and a third control unit, where specifically, after the
second control unit controls the communications link between the selected
processes to be displayed on the communications sequence diagram, the second
receiving unit is configured to receive a second instruction from a client,
where the second instruction from a client is used to change, from the
communications topology view, the selected processes; and the third control
unit is configured to control the communications link between the changed
processes to be displayed on the communications sequence diagram. In this way,
the communications link between the processes displayed on the communications
sequence diagram is increased or decreased.
Still further, the monitoring apparatus further
includes a third receiving unit and a second displaying unit, where after the
communications link between the selected processes is controlled to be
displayed on the communications sequence diagram, the third receiving unit is
configured to receive a third instruction from a client, where the third
instruction from a client is used to select, from the communications sequence
diagram, a target communications link; and the second displaying unit is
configured to display the communications data corresponding to the target
communications link. The communications data between the processes is visually
displayed for the tester.
The monitoring apparatus further includes a fourth
control unit, where before the communications link, which points to the
communications direction, between every two of the processes that have the
communications relationship is drawn, and the communications sequence diagram
is generated, the fourth control unit controls the multiple processes to be
distributed in a multi-column form, where only one of the processes is
distributed in each column, and the processes in adjacent columns are
different; or the fourth control unit controls the multiple processes to be
distributed in a multi-row form, where only one of the processes is distributed
in each row, and the processes in adjacent rows are different.
FIG. 8a is a schematic diagram of a process
monitoring apparatus according to an optional embodiment of the present
invention. As shown in FIG. 8a, the monitoring apparatus provided in this
optional embodiment mainly includes an obtaining unit 10, an establishing unit
20, an adding unit 30, a first monitoring unit 40, a first sending unit 501, a
second monitoring unit 601, and a first judging unit 701.
Specific compositions and operating principles of
the obtaining unit 10, the establishing unit 20, the adding unit 30, and the
first monitoring unit 40 are the same as specific compositions and operating
principles of the obtaining unit 10, the establishing unit 20, the adding unit
30, and the first monitoring unit 40 that are shown in FIG. 7, and details are
not provided again herein.
The first sending unit 501 is configured to: when it
is monitored, by using the relay communications node, that a first process
transmits a first request to a second process, send, by using the relay
communications node, a second request transmitted by a third process to the
first process, where the first request includes a first feature, the second
request includes a second feature, the first process and the second process are
any two processes that have a communications relationship in the multiple
processes, the third process is a process, which is in the multiple processes,
that has a communications relationship with the first process, the third
process and the second process are different processes, and the first feature
and the second feature are different features.
The second monitoring unit 601 is configured to
monitor a processing result of the first process for the second request.
The first judging unit 701 is configured to
determine a competition state of the first process according to the processing
result.
In a procedure in which the multiple processes
complete a transaction collaboratively, a competition state window period
exists. Therefore, for maintaining transactionality, the to-be-tested system
needs to properly process a request in this period. By using the first sending
unit 501, the second monitoring unit 601, and the first judging unit 701, the
tester inserts one data test request into one hierarchical invocation of a
process group, to test whether a target process correctly processes the
request. If the processing result indicates that the first process collapses,
it may be determined that the competition state reflected in a response of the
first process to a competition mechanism is weak. On the contrary, if the
processing result indicates that the first process can correctly feed back a
feedback for the second request, it may be determined that the competition
state reflected in the response of the first process to the competition
mechanism is strong. Testing, in a case in which a first process sends a
request, a situation of a competition of the first process for a request
received from a third party is implemented.
It is assumed that, the first process is a process
maysvrd, the second process is a process world_login, and the third process is
a process tconnd, and then the foregoing monitoring manner is that: when the
process maysvrd sends a piece of data whose content includes a feature D1 to
the process world_login, a piece of data whose content includes a feature D2 is
sent from the process tconnd to the process maysvrd by using the relay
communications node, to test whether the process maysvrd correctly processes
the request. Specifically, the foregoing test rule may be defined in a JSON
format as follows:
{
"when_from":maysvrd,//Condition of a source
process
"when_to":world_login,//Condition of a target
process
"feature":D1,//Feature of data content
"hack_from":tconnd,//Testing a to-be-sent source
process
"hack_to":maysvrd,//Testing a to-be-sent target
process
"payload":D2//Testing to-be-sent data
}
FIG. 8b is a schematic diagram of a process
monitoring apparatus according to another optional embodiment of the present
invention. As shown in FIG. 8b, the monitoring apparatus provided in this
optional embodiment mainly includes an obtaining unit 10, an establishing unit
20, an adding unit 30, a first monitoring unit 40, a second sending unit 502, a
third monitoring unit 602, and a second judging unit 702.
Specific compositions and operating principles of
the obtaining unit 10, the establishing unit 20, the adding unit 30, and the
first monitoring unit 40 are the same as specific compositions and operating
principles of the obtaining unit 10, the establishing unit 20, the adding unit
30, and the first monitoring unit 40 that are shown in FIG. 7, and details are
not provided again herein.
The second sending unit 502 is configured to: when
it is monitored, by using the relay communications node, that a first process
receives a first request transmitted from a second process, send, by using the
relay communications node, a second request transmitted by a third process to
the first process, where the first request includes a first feature, the second
request includes a second feature, the first process and the second process are
any two processes that have a communications relationship in the multiple
processes, the third process is a process, which is in the multiple processes,
that has a communications relationship with the first process, the third
process and the second process are different processes, and the first feature
and the second feature are different features.
The third monitoring unit 602 is configured to
monitor a processing result of the first process for the second request.
The second judging unit 702 is configured to
determine a competition state of the first process according to the processing
result.
Same as the foregoing operating principles of the
first sending unit 501, the second monitoring unit 601, and the first judging
unit 701, testing, in a case in which a first process receives a request, a
situation of a competition of the first process for a request received from a
third party is implemented by using the second sending unit 502, the third
monitoring unit 602, and the second judging unit 702.
FIG. 8c is a schematic diagram of a process
monitoring apparatus according to another optional embodiment of the present
invention. As shown in FIG. 8c, the monitoring apparatus provided in this
optional embodiment mainly includes an obtaining unit 10, an establishing unit
20, an adding unit 30, a first monitoring unit 40, a third sending unit 503, a
fourth monitoring unit 603, and a third judging unit 703.
The third sending unit 503 is configured to: when it
is monitored, by using the relay communications node, that a first process
transmits a first request to a second process, send, by using the relay
communications node, a second request transmitted by the first process to a
third process, where the first request includes a first feature, the second
request includes a second feature, the first process and the second process are
any two processes that have a communications relationship in the multiple
processes, the third process is a process, which is in the multiple processes,
that has a communications relationship with the first process, the third
process and the second process are different processes, and the first feature
and the second feature are different features.
The fourth monitoring unit 603 is configured to
monitor a processing result of the third process for the second request.
The third judging unit 703 is configured to
determine a competition state of the first process according to the processing
result.
Same as the foregoing operating principles of the
first sending unit 501, the second monitoring unit 601, and the first judging
unit 701, testing, in a case in which a first process sends a request, a
situation of a competition of the first process for sending another request is
implemented by using the third sending unit 503, the fourth monitoring unit
603, and the third judging unit 703.
FIG. 9 is a schematic diagram of a monitoring
apparatus according to another optional embodiment of the present invention. As
shown in FIG. 9, the monitoring apparatus provided in this optional embodiment
mainly includes an obtaining unit 10, an establishing unit 20, an adding unit
30, a first monitoring unit 40, a first extracting unit 80, a second extracting
unit 90, and a first determining unit 100, where:
specific compositions and operating principles of
the obtaining unit 10, the establishing unit 20, the adding unit 30, and the
first monitoring unit 40 are the same as specific compositions and operating
principles of the obtaining unit 10, the establishing unit 20, the adding unit
30, and the first monitoring unit 40 that are shown in FIG. 7, and details are
not provided again herein;
the first extracting unit 80 is configured to
extract external input data and an SQL statement that are in the communications
data, that is, extract the external input data and the SQL statement from the
communications data between the processes that are monitored by the first
monitoring unit 40;
the second extracting unit 90 is configured to
extract a parameter value Value_set from the SQL statement; and
the first determining unit 100 is configured to
determine a correspondence between the external input data and the SQL
statement according to a matching relationship between the parameter value and
the external input data.
The external input data and the SQL statement are
extracted, and the correspondence between the two is determined, so that an
effect of testing what kind of SQL statement can be generated from the external
input data is achieved.
Further, the determined correspondence between the
external input data and the SQL statement may further be displayed, so that the
SQL statement generated from the external input data is visually provided for a
tester.
Specifically, the first determining unit 100 mainly
includes a second judging subunit, a second obtaining subunit, and a
determining subunit, where: the second judging subunit is configured to
determine whether same data exists in the external input data and the extracted
value; the second obtaining subunit is configured to: in a case in which it is
determined that the same data exists in the external input data and the
extracted value, obtain an SQL statement in which the same data is located; and
the determining subunit is configured to determine that the obtained SQL
statement is an SQL statement corresponding to the external input data.
The first extracting unit 80 mainly includes a third
obtaining subunit and an extracting subunit, where: the third obtaining subunit
is configured to obtain, from the monitored communications data, SQL data that
flows to a database of the to-be-tested system; and the extracting subunit is
configured to extract the SQL statement from the SQL data.
Still further, the monitoring apparatus further
includes a modifying unit, a fourth sending unit, and a second determining
unit, where after the first determining unit 100 determines a correspondence
between the external input data and the SQL statement according to a matching
relationship between the parameter value and the external input data, the
modifying unit is configured to modify the external input data; the fourth
sending unit is configured to send the modified external input data to the
to-be-tested system; and the second determining unit is configured to
re-determine a correspondence between the modified external input data and the
SQL statement. A specific determining method is the same as the foregoing
method for the first determining unit 100 to determine the correspondence
between the external input data and the SQL statement, and details are not
provided again herein.
The modified external input data is sent to the
to-be-tested system, and then the correspondence between the modified external
input data and the SQL statement is re-determined, so that an effect of
purposely testing an SQL statement that can be generated from specific external
data is achieved.
This embodiment of the present invention further
provides a process monitoring system, where the monitoring system includes any
process monitoring apparatus provided in the foregoing content of this
embodiment of the present invention and a to-be-tested system.
It can be seen from the foregoing description that,
the present disclosure implements monitoring of a communications logic between
multiple processes of a to-be-tested system, which solves a technical problem
that the communications logic between the multiple processes cannot be
monitored in the existing technology, thereby achieving a technical effect of
performing a gray-box test on the communications logic between the processes of
the to-be-tested system.
The sequence numbers of the foregoing embodiments of
the present invention are merely for the convenience of description, and do not
imply the preference among the embodiments.
In the foregoing embodiments of the present
invention, descriptions of the embodiments have different emphases, and as for
parts that are not described in detail in one embodiment, reference can be made
to the relevant description of the other embodiments.
In the foregoing embodiments of the present
invention, the described apparatus embodiments are merely exemplary. For
example, the unit division is merely logical function division and may be other
division in actual implementation. For example, a plurality of units or
components may be combined or integrated into another system, or some features
may be ignored or not performed. In addition, the displayed or discussed mutual
couplings or direct couplings or communication connections may be implemented
through some interfaces. The indirect couplings or communication connections
between the units or modules may be implemented in electronic or other
forms.
The units described as separate parts may or may not
be physically separate, and the parts displayed as units may or may not be
physical units, may be located in one position, or may be distributed on a
plurality of network units. A part of or all of the units may be selected
according to actual needs to achieve the objectives of the solutions of the
embodiments.
In addition, functional units in the embodiments of
the present invention may be integrated into one processing unit, or each of
the units may exist alone physically, or two or more units may be integrated
into one unit. The integrated unit may be implemented in the form of hardware,
or may be implemented in the form of a software functional unit.
When the integrated unit is implemented in a form of
a software functional module and sold or used as an independent product, the
functions may be stored in a computer-readable storage medium. Based on such an
understanding, the technical solutions of the present disclosure essentially,
or the part contributing to the existing technology, or all or a part of the
technical solutions may be implemented in a form of a software product. The
computer software product is stored in a storage medium and includes several
instructions for instructing a computer device (which may be a personal
computer, a server, a network device, or the like) to perform all or a part of
the steps of the methods described in the embodiments of the present invention.
The foregoing storage medium includes: any medium that can store program code,
such as a USB flash drive, a read-only memory (ROM), a random access memory
(RAM), a removable hard disk, a magnetic disk, or an optical disc.
The above descriptions are merely preferred
embodiments of the present invention, and it should be noted that, a person of
ordinary skill in the art may make various improvements and refinements without
departing from the spirit of the invention. All such modifications and
refinements should also be intended to be covered by the present
disclosure.
Claims (34)
- A process monitoring method, comprising:obtaining processes of a to-be-tested system and a communications relationship between the processes, wherein the number of the processes is multiple;establishing communications channels between the processes according to the obtained communications relationship;adding a relay communications node connected to each of the communications channels; andmonitoring data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- The monitoring method according to claim 1, wherein the monitoring data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes comprises:monitoring data content of a first process and a second process that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the first process and the second process, wherein the first process and the second process are any two processes that have a communications relationship in the multiple processes.
- The monitoring method according to claim 1, wherein the obtained communications relationship comprises a communications manner, wherein the adding a relay communications node connected to each of the communications channels comprises:obtaining a first communications manner in which a first process and a second process send data to and receive data from each other, wherein the first process and the second process are any two processes that have a communications relationship in the multiple processes;determining whether the first communications manner is the same as a second communications manner in which the relay communications node sends and receives data;in a case in which it is determined that the first communications manner is different from the second communications manner, establishing a connection between the first process and a first conversion process, and establishing a connection between the second process and a second conversion process, wherein the first conversion process and the second conversion process are both processes connected to the relay communications node in the second communications manner, a manner in which the first conversion process communicates with the first process is the first communications manner, and a manner in which the second conversion process communicates with the second process is the first communications manner; andin a case in which it is determined that the first communications manner is the same as the second communications manner, establishing a connection between the first process and the relay communications node, and establishing a connection between the second process and the relay communications node.
- The monitoring method according to claim 3, wherein:the establishing a connection between the first process and a first conversion process, and establishing a connection between the second process and a second conversion process comprises: obtaining a target connection address of the first process and a target connection address of the second process; and changing the target connection address of the first process to an address of the first conversion process, and changing the target connection address of the second process to an address of the second conversion process; andthe establishing a connection between the first process and the relay communications node, and establishing a connection between the second process and the relay communications node comprises: obtaining the target connection address of the first process and the target connection address of the second process; and changing the target connection address of the first process to a first connection address, and changing the target connection address of the second process to a second connection address, wherein the first connection address is an address, which is in the relay communications node, for communicating with the first process, and the second connection address is an address, which is in the relay communications node, for communicating with the second process.
- The monitoring method according to claim 1, wherein after the adding a relay communications node connected to each of the communications channels, the monitoring method further comprises:when it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, sending, by using the relay communications node, a second request transmitted by a third process to the first process, wherein the first request comprises a first feature, the second request comprises a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features;monitoring a processing result of the first process for the second request; anddetermining a competition state of the first process according to the processing result.
- The monitoring method according to claim 1, wherein after the adding a relay communications node connected to each of the communications channels, the monitoring method further comprises:when it is monitored, by using the relay communications node, that a first process receives a first request transmitted from a second process, sending, by using the relay communications node, a second request transmitted by a third process to the first process, wherein the first request comprises a first feature, the second request comprises a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features;monitoring a processing result of the first process for the second request; anddetermining a competition state of the first process according to the processing result.
- The monitoring method according to claim 1, wherein after the adding a relay communications node connected to each of the communications channels, the monitoring method further comprises:when it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, sending, by using the relay communications node, a second request transmitted by the first process to a third process, wherein the first request comprises a first feature, the second request comprises a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features;monitoring a processing result of the third process for the second request; anddetermining a competition state of the first process according to the processing result.
- The monitoring method according to claim 1, wherein after the establishing communications channels between the processes according to the obtained communications relationship, the monitoring method further comprises:drawing a communications topology view by using each of the processes as a node and using each of the communications channels as a node connection path; anddisplaying the communications topology view.
- The monitoring method according to claim 8, wherein before the drawing a communications topology view by using each of the processes as a node and using each of the communications channels as a node connection path, the monitoring method further comprises:controlling the multiple processes to be distributed in a multi-column form, wherein the processes that have the communications relationship are distributed in adjacent columns; orcontrolling the multiple processes to be distributed in a multi-row form, wherein the processes that have the communications relationship are distributed in adjacent rows.
- The monitoring method according to claim 8, wherein after the monitoring data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes, the monitoring method further comprises:drawing a communications link, which points to the communications direction, between every two of the processes that have the communications relationship, and generating a communications sequence diagram, wherein each communications link has corresponding communications data;associating the communications topology view with the communications sequence diagram;receiving a first instruction from a client, wherein the first instruction is used to select, from the communications topology view, at least two of the processes; andcontrolling the communications link between the selected processes to be displayed on the communications sequence diagram.
- The monitoring method according to claim 10, wherein after the controlling the communications link between the selected processes to be displayed on the communications sequence diagram, the monitoring method further comprises:receiving a second instruction from the client, wherein the second instruction is used to change, from the communications topology view, the selected processes; andcontrolling the communications link between the changed processes to be displayed on the communications sequence diagram.
- The monitoring method according to claim 10, wherein after the controlling the communications link between the selected processes to be displayed on the communications sequence diagram, the monitoring method further comprises:receiving a third instruction from the client, wherein the third instruction is used to select, from the communications sequence diagram, a target communications link; anddisplaying the communications data corresponding to the target communications link.
- The monitoring method according to claim 10, wherein before the drawing a communications link, which points to the communications direction, between every two of the processes that have the communications relationship, and generating a communications sequence diagram, the monitoring method further comprises:controlling the multiple processes to be distributed in a multi-column form, wherein only one of the processes is distributed in each column, and the processes in adjacent columns are different; orcontrolling the multiple processes to be distributed in a multi-row form, wherein only one of the processes is distributed in each row, and the processes in adjacent rows are different.
- The monitoring method according to claim 1, wherein after the monitoring data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes, the monitoring method further comprises:extracting external input data and an SQL statement that are in the communications data;extracting a parameter value from the SQL statement; anddetermining a correspondence between the external input data and the SQL statement according to a matching relationship between the parameter value and the external input data.
- The monitoring method according to claim 14, wherein the determining a correspondence between the external input data and the SQL statement according to a matching relationship between the extracted value and the external input data comprises:determining whether same data exists in the external input data and the extracted value;in a case in which it is determined that the same data exists in the external input data and the extracted value, obtaining an SQL statement in which the same data is located; anddetermining that the obtained SQL statement is an SQL statement corresponding to the external input data.
- The monitoring method according to claim 14, wherein the extracting an SQL statement that is in the communications data comprises:obtaining, from the monitored communications data, SQL data that flows to a database of the to-be-tested system; andextracting the SQL statement from the SQL data.
- The monitoring method according to claim 14, wherein after the determining a correspondence between the external input data and the SQL statement according to a matching relationship between the parameter value and the external input data, the monitoring method further comprises:modifying the external input data;sending the modified external input data to the to-be-tested system; andre-determining a correspondence between the modified external input data and the SQL statement.
- A process monitoring apparatus, comprising:an obtaining unit, configured to obtain processes of a to-be-tested system and a communications relationship between the processes, wherein the number of the processes is multiple;an establishing unit, configured to establish communications channels between the processes according to the obtained communications relationship;an adding unit, configured to add a relay communications node connected to each of the communications channels; anda first monitoring unit, configured to monitor data content that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the processes.
- The monitoring apparatus according to claim 18, wherein the first monitoring unit comprises:a monitoring subunit, configured to monitor data content of a first process and a second process that flows through the relay communications node, and a data flow direction, to obtain communications data and a communications direction between the first process and the second process, wherein the first process and the second process are any two processes that have a communications relationship in the multiple processes.
- The monitoring apparatus according to claim 18, wherein the obtained communications relationship comprises a communications manner, wherein the adding unit comprises:a first obtaining subunit, configured to obtain a first communications manner in which a first process and a second process send data to and receive data from each other, wherein the first process and the second process are any two processes that have a communications relationship in the multiple processes;a first judging subunit, configured to determine whether the first communications manner is the same as a second communications manner in which the relay communications node sends and receives data;a first establishing subunit, configured to: in a case in which it is determined that the first communications manner is different from the second communications manner, establish a connection between the first process and a first conversion process, and establish a connection between the second process and a second conversion process, wherein the first conversion process and the second conversion process are both processes connected to the relay communications node in the second communications manner, a manner in which the first conversion process communicates with the first process is the first communications manner, and a manner in which the second conversion process communicates with the second process is the first communications manner; anda second establishing subunit, configured to: in a case in which it is determined that the first communications manner is the same as the second communications manner, establish a connection between the first process and the relay communications node, and establish a connection between the second process and the relay communications node.
- The monitoring apparatus according to claim 20, wherein:the first establishing subunit comprises: a first obtaining module, configured to obtain a target connection address of the first process and a target connection address of the second process; and a first changing module, configured to change the target connection address of the first process to an address of the first conversion process, and change the target connection address of the second process to an address of the second conversion process; andthe second establishing subunit comprises: a second obtaining module, configured to obtain the target connection address of the first process and the target connection address of the second process; and a second changing module, configured to change the target connection address of the first process to a first connection address, and change the target connection address of the second process to a second connection address, wherein the first connection address is an address, which is in the relay communications node, for communicating with the first process, and the second connection address is an address, which is in the relay communications node, for communicating with the second process.
- The monitoring apparatus according to claim 18, wherein the monitoring apparatus further comprises:a first sending unit, configured to: when it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, send, by using the relay communications node, a second request transmitted by a third process to the first process, wherein the first request comprises a first feature, the second request comprises a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features;a second monitoring unit, configured to monitor a processing result of the first process for the second request; anda first judging unit, configured to determine a competition state of the first process according to the processing result.
- The monitoring apparatus according to claim 18, wherein the monitoring apparatus further comprises:a second sending unit, configured to: when it is monitored, by using the relay communications node, that a first process receives a first request transmitted from a second process, send, by using the relay communications node, a second request transmitted by a third process to the first process, wherein the first request comprises a first feature, the second request comprises a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features;a third monitoring unit, configured to monitor a processing result of the first process for the second request; anda second judging unit, configured to determine a competition state of the first process according to the processing result.
- The monitoring apparatus according to claim 18, wherein the monitoring apparatus further comprises:a third sending unit, configured to: when it is monitored, by using the relay communications node, that a first process transmits a first request to a second process, send, by using the relay communications node, a second request transmitted by the first process to a third process, wherein the first request comprises a first feature, the second request comprises a second feature, the first process and the second process are any two processes that have a communications relationship in the multiple processes, the third process is a process, which is in the multiple processes, that has a communications relationship with the first process, the third process and the second process are different processes, and the first feature and the second feature are different features;a fourth monitoring unit, configured to monitor a processing result of the third process for the second request; anda third judging unit, configured to determine a competition state of the first process according to the processing result.
- The monitoring apparatus according to claim 18, wherein the monitoring apparatus further comprises:a first drawing unit, configured to draw a communications topology view by using each of the processes as a node and using each of the communications channels as a node connection path; anda first displaying unit, configured to display the communications topology view.
- The monitoring apparatus according to claim 25, wherein the monitoring apparatus further comprises:a first control unit, configured to control the multiple processes to be distributed in a multi-column form, wherein the processes that have the communications relationship are distributed in adjacent columns; ora first control unit, configured to control the multiple processes to be distributed in a multi-row form, wherein the processes that have the communications relationship are distributed in adjacent rows.
- The monitoring apparatus according to claim 25, wherein the monitoring apparatus further comprises:a second drawing unit, configured to draw a communications link, which points to the communications direction, between every two of the processes that have the communications relationship, and generate a communications sequence diagram, wherein each communications link has corresponding communications data;an associating unit, configured to associate the communications topology view with the communications sequence diagram;a first receiving unit, configured to receive a first instruction from a client, wherein the first instruction is used to select, from the communications topology view, at least two of the processes; anda second control unit, configured to control the communications link between the selected processes to be displayed on the communications sequence diagram.
- The monitoring apparatus according to claim 27, wherein the monitoring apparatus further comprises:a second receiving unit, configured to receive a second instruction from the client, wherein the second instruction is used to change, from the communications topology view, the selected processes; anda third control unit, configured to control the communications link between the changed processes to be displayed on the communications sequence diagram.
- The monitoring apparatus according to claim 27, wherein the monitoring apparatus further comprises:a third receiving unit, configured to receive a third instruction from the client, wherein the third instruction is used to select, from the communications sequence diagram, a target communications link; anda second displaying unit, configured to display the communications data corresponding to the target communications link.
- The monitoring apparatus according to claim 27, wherein the monitoring apparatus further comprises:a fourth control unit, configured to control the multiple processes to be distributed in a multi-column form, wherein only one of the processes is distributed in each column, and the processes in adjacent columns are different; ora fourth control unit, configured to control the multiple processes to be distributed in a multi-row form, wherein only one of the processes is distributed in each row, and the processes in adjacent rows are different.
- The monitoring apparatus according to claim 18, wherein the monitoring apparatus further comprises:a first extracting unit, configured to extract external input data and an SQL statement that are in the communications data;a second extracting unit, configured to extract a parameter value from the SQL statement; anda first determining unit, configured to determine a correspondence between the external input data and the SQL statement according to a matching relationship between the parameter value and the external input data.
- The monitoring apparatus according to claim 31, wherein the first determining unit comprises:a second judging subunit, configured to determine whether same data exists in the external input data and the extracted value;a second obtaining subunit, configured to: in a case in which it is determined that the same data exists in the external input data and the extracted value, obtain an SQL statement in which the same data is located; anda determining subunit, configured to determine that the obtained SQL statement is an SQL statement corresponding to the external input data.
- The monitoring apparatus according to claim 31, wherein the first extracting unit comprises:a third obtaining subunit, configured to obtain, from the monitored communications data, SQL data that flows to a database of the to-be-tested system; andan extracting subunit, configured to extract the SQL statement from the SQL data.
- The monitoring apparatus according to claim 31, wherein the monitoring apparatus further comprises:a modifying unit, configured to modify the external input data;a fourth sending unit, configured to send the modified external input data to the to-be-tested system; anda second determining unit, configured to re-determine a correspondence between the modified external input data and the SQL statement.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410055292.9 | 2014-02-18 | ||
CN201410055292.9A CN104852823B (en) | 2014-02-18 | 2014-02-18 | Monitoring method, the device and system of process |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2015124073A1 true WO2015124073A1 (en) | 2015-08-27 |
Family
ID=53852190
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2015/072712 WO2015124073A1 (en) | 2014-02-18 | 2015-02-11 | Process monitoring method, apparatus, and system |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN104852823B (en) |
WO (1) | WO2015124073A1 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110809304A (en) * | 2019-11-01 | 2020-02-18 | 北京星河亮点技术股份有限公司 | Method for forwarding data stream message in network and network system |
CN112685287A (en) * | 2020-11-30 | 2021-04-20 | 青岛海尔科技有限公司 | Product data testing method and device, storage medium and electronic device |
CN114615169A (en) * | 2020-12-03 | 2022-06-10 | 腾讯科技(深圳)有限公司 | Path monitoring method, device and computer readable storage medium |
WO2023123458A1 (en) * | 2021-12-31 | 2023-07-06 | 京东方科技集团股份有限公司 | Process communication method and apparatus |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110221928B (en) * | 2019-06-11 | 2021-06-04 | Oppo广东移动通信有限公司 | Information recording method, information recording apparatus, terminal, and storage medium |
CN110224899B (en) * | 2019-06-28 | 2023-04-18 | 深圳前海微众银行股份有限公司 | TCP application call chain acquisition method and device |
CN113055339B (en) * | 2019-12-26 | 2023-04-28 | 中国移动通信集团海南有限公司 | Process data processing method and device, storage medium and computer equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5675798A (en) * | 1993-07-27 | 1997-10-07 | International Business Machines Corporation | System and method for selectively and contemporaneously monitoring processes in a multiprocessing server |
CN1507210A (en) * | 2002-12-10 | 2004-06-23 | 深圳市中兴通讯股份有限公司 | Message transmission method in multiple node system |
CN1791037A (en) * | 2005-12-26 | 2006-06-21 | 北京航空航天大学 | Method for realizing Web service automatic test |
CN103455380A (en) * | 2012-06-05 | 2013-12-18 | 上海斐讯数据通信技术有限公司 | Multi-process communication system and establishment and communication method thereof |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102591726B (en) * | 2011-12-31 | 2014-04-09 | 青岛海信宽带多媒体技术有限公司 | Multiprocess communication method |
-
2014
- 2014-02-18 CN CN201410055292.9A patent/CN104852823B/en active Active
-
2015
- 2015-02-11 WO PCT/CN2015/072712 patent/WO2015124073A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5675798A (en) * | 1993-07-27 | 1997-10-07 | International Business Machines Corporation | System and method for selectively and contemporaneously monitoring processes in a multiprocessing server |
CN1507210A (en) * | 2002-12-10 | 2004-06-23 | 深圳市中兴通讯股份有限公司 | Message transmission method in multiple node system |
CN1791037A (en) * | 2005-12-26 | 2006-06-21 | 北京航空航天大学 | Method for realizing Web service automatic test |
CN103455380A (en) * | 2012-06-05 | 2013-12-18 | 上海斐讯数据通信技术有限公司 | Multi-process communication system and establishment and communication method thereof |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110809304A (en) * | 2019-11-01 | 2020-02-18 | 北京星河亮点技术股份有限公司 | Method for forwarding data stream message in network and network system |
CN112685287A (en) * | 2020-11-30 | 2021-04-20 | 青岛海尔科技有限公司 | Product data testing method and device, storage medium and electronic device |
CN112685287B (en) * | 2020-11-30 | 2023-11-28 | 青岛海尔科技有限公司 | Product data testing method and device, storage medium and electronic device |
CN114615169A (en) * | 2020-12-03 | 2022-06-10 | 腾讯科技(深圳)有限公司 | Path monitoring method, device and computer readable storage medium |
CN114615169B (en) * | 2020-12-03 | 2023-10-20 | 腾讯科技(深圳)有限公司 | Path monitoring method, path monitoring device and computer readable storage medium |
WO2023123458A1 (en) * | 2021-12-31 | 2023-07-06 | 京东方科技集团股份有限公司 | Process communication method and apparatus |
Also Published As
Publication number | Publication date |
---|---|
CN104852823A (en) | 2015-08-19 |
CN104852823B (en) | 2019-04-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2015124073A1 (en) | Process monitoring method, apparatus, and system | |
WO2019051908A1 (en) | Terminal control method and device, and computer readable storage medium | |
WO2019019340A1 (en) | Application program page opening method and apparatus, terminal and readable storage medium | |
WO2019019374A1 (en) | Method, apparatus, and system for controlling household appliance with intelligent voice device | |
WO2019019378A1 (en) | Service processing method and apparatus, adapter and computer-readable storage medium | |
WO2019019376A1 (en) | Service process management method, apparatus, and device, and computer readable storage medium | |
WO2019062194A1 (en) | Home appliance and method and system for controling home applicance and computer readable storage medium | |
WO2015158132A1 (en) | Voice control method and system | |
WO2015108283A1 (en) | Application error detection method for cloud streaming service, and apparatus and system therefor | |
WO2019056462A1 (en) | Name list distribution method, apparatus and device, and computer readable storage medium | |
WO2019051899A1 (en) | Terminal control method and device, and storage medium | |
WO2015127859A1 (en) | Sensitive text detecting method and apparatus | |
WO2018166107A1 (en) | Hybrid-based compatibility method, adapter, operating apparatus and system, and computer-readable storage medium | |
WO2012173423A2 (en) | Wireless data communication apparatus and wireless data communication method | |
WO2016107224A1 (en) | Method and device for controlling movement of interface focus | |
WO2018086293A1 (en) | Method and apparatus for detecting data leakage interface, device, and storage medium | |
WO2019031856A1 (en) | Method for transmitting/receiving reference signal in wireless communication system, and device therefor | |
WO2021002696A1 (en) | Method for transferring subscription and electronic device for supporting the same | |
WO2017063369A1 (en) | Method of establishing wireless direct connection and device utilizing same | |
WO2015158133A1 (en) | Error correction method and system for voice control instruction | |
WO2014189323A1 (en) | Apparatus and method for performing wireless docking operation in communication system supporting universal plug and play protocol | |
WO2018000856A1 (en) | Method implementing sdn overlay network message forwarding, terminal, apparatus, and computer readable storage medium | |
WO2017148028A1 (en) | Remote network connection method and system based on smart television | |
WO2020067715A1 (en) | Method and device for configuring node to transmit and receive data | |
WO2017080403A1 (en) | Projection equipment control method, projection equipment and smart terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 15752731 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13.01.2017) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 15752731 Country of ref document: EP Kind code of ref document: A1 |