CN112714042A - Pressure testing method and device, electronic equipment and storage medium - Google Patents

Pressure testing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112714042A
CN112714042A CN202011529964.7A CN202011529964A CN112714042A CN 112714042 A CN112714042 A CN 112714042A CN 202011529964 A CN202011529964 A CN 202011529964A CN 112714042 A CN112714042 A CN 112714042A
Authority
CN
China
Prior art keywords
data request
test
test state
request
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011529964.7A
Other languages
Chinese (zh)
Other versions
CN112714042B (en
Inventor
曹紫光
廖尧
毛雪
甘铭乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202011529964.7A priority Critical patent/CN112714042B/en
Publication of CN112714042A publication Critical patent/CN112714042A/en
Application granted granted Critical
Publication of CN112714042B publication Critical patent/CN112714042B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS

Abstract

The embodiment of the disclosure relates to a pressure testing method, a pressure testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: detecting whether the received data request carries a first preset mark or not; the first preset mark is used for marking a data request participating in a stress test; acquiring a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes a data request carrying a first preset mark; and if the received data request carries a first preset mark, performing pressure test processing based on the received data request according to the acquired test state. The embodiment of the disclosure realizes execution control of the data request in the pressure test process, and solves the problem that the data request transmitted in the pressure test process is lack of effective execution control in the existing scheme.

Description

Pressure testing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer application technologies, and in particular, to a pressure testing method and apparatus, an electronic device, and a storage medium.
Background
In the development or maintenance process of the service system, the pressure test is executed, the operation performance of the service system can be determined in time, and the performance defect of the service system is found, so that how to optimize the service system is determined according to the test result, the normal operation of the service system is ensured, and high-quality service is provided for users.
A plurality of service services can be implemented in one service system, and each service can correspond to a plurality of nodes (or referred to as service instances). How to control data requests (or called flow) executed in different nodes in the process of pressure testing and optimize a test result still remains a problem to be solved currently.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, embodiments of the present disclosure provide a pressure testing method, apparatus, electronic device, and storage medium.
In a first aspect, an embodiment of the present disclosure provides a pressure testing method, including:
detecting whether the received data request carries a first preset mark or not; the first preset mark is used for marking a data request participating in a stress test;
acquiring a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes the data request carrying the first preset mark;
and if the received data request carries the first preset mark, performing pressure test processing based on the received data request according to the acquired test state.
In a second aspect, an embodiment of the present disclosure further provides a pressure testing apparatus, including:
the mark detection module is used for detecting whether the received data request carries a first preset mark or not; the first preset mark is used for marking a data request participating in a stress test;
the test state acquisition module is used for acquiring a test state from the test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes the data request carrying the first preset mark;
and the test processing module is used for performing pressure test processing based on the received data request according to the acquired test state if the received data request carries the first preset mark.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, where the electronic device includes: a processing device; a memory for storing the processing device executable instructions or programs; the processing device is used for reading the executable instructions or the program from the memory and executing the executable instructions or the program to realize any pressure testing method provided by the embodiment of the disclosure.
In a fourth aspect, the present disclosure also provides a computer-readable storage medium, where the storage medium stores a computer program or instructions, and the computer program or instructions, when executed by a processing device, implement any one of the pressure testing methods provided by the embodiments of the present disclosure.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages: in the pressure test process, any data request can carry a preset mark (the data request at this time can be called as mark flow), and after a node in a service system receives the data request, whether the data request is executed or not can be determined according to the preset mark carried in the data request and the test state of the node, so that the execution control of the data request is realized, the problem that the data request transmitted in the pressure test process is lack of effective execution control in the existing scheme is solved, and the effective management of the data request is realized; in addition, compared with the situation that the data request in the pressure test process is not marked at all, the technical scheme of the embodiment of the disclosure realizes the effect of optimizing the test result based on different test requirements by managing the data request based on the preset mark, for example, the node can selectively execute the data request carrying the preset request mark according to the test state, thereby improving the pertinence of the pressure test and avoiding influencing the online service which is not expected to participate in the pressure test.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flow chart of a pressure testing method provided by an embodiment of the present disclosure;
FIG. 2 is a flow chart of another pressure testing method provided by the embodiments of the present disclosure;
FIG. 3 is a flow chart of another pressure testing method provided by the embodiments of the present disclosure;
FIG. 4 is a flow chart of another pressure testing method provided by the embodiments of the present disclosure;
fig. 5 is a schematic diagram of an interaction link between nodes according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of an interaction link between nodes according to another embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a pressure testing apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be further described below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
Fig. 1 is a flowchart of a pressure testing method provided in an embodiment of the present disclosure, where the embodiment of the present disclosure may be applied to a deployed service system for performing a pressure test, and the service system may be implemented in a distributed cluster, where the distributed cluster includes a plurality of nodes (or referred to as service instances). Moreover, the nodes in the distributed cluster may classify the nodes according to the service types provided by the nodes, for example, the nodes may provide an account query type service, the nodes may provide a transaction processing type service, or the nodes may provide a data storage type service, and the nodes of different service types support mutual invocation according to a specific service processing logic. According to the node deployment strategy, different nodes may be deployed on different electronic devices with computing capabilities, or may be deployed on the same electronic device. The electronic device includes a terminal or a server, etc.
The pressure testing method provided by the embodiment of the disclosure can be executed by a pressure testing device, and the device can be implemented by software and/or hardware and can be integrated on any node.
As shown in fig. 1, a pressure testing method provided by an embodiment of the present disclosure may include:
s101, detecting whether a received data request carries a first preset mark or not; the first preset mark is used for marking a data request participating in a stress test.
The data request can be triggered by a test user according to a pressure test requirement, for example, according to a service type of a current service requiring pressure test, a related data request is triggered; or automatically triggered in the node as the request initiator according to the service processing logic during the service processing. In the process of generating a data request, a node serving as a request initiator may detect whether a data request is currently generated or not in real time, and if the data request is detected to be generated, add a first preset tag (or referred to as a traffic tag) to the data request belonging to a target service type according to the target service type to which the data request needing to be added with the first preset tag belongs, for example, may call a preset program having a preset tag adding function to add the first preset tag to the data request; in addition, a first preset mark can be added to the generated data request according to a mark adding operation triggered by the test user on the node.
In the embodiment of the present disclosure, the data request may include a data request sent by the user terminal to a node in the service system, and may also include a data request generated between nodes in the service system. The first preset mark is used for marking a data request participating in stress testing, and can be represented in a form of one of Chinese characters, English characters, numbers and other characters, or in a form of a combination of multiple characters. Different first preset marks can be correspondingly set aiming at different business service types, so that the effect of determining the business service type to which the data request belongs according to the first preset marks is achieved. Of course, the same first preset flag may also be correspondingly set for different service types, which is not specifically limited in this embodiment of the disclosure and may be determined according to a flag addition requirement. For the current node as the request receiver, the first preset flag may also be used to distinguish the currently received data request, for example, to distinguish data requests belonging to different service types, and perform differentiated execution on the currently received data request. The data request which needs to be executed by any node in a differentiated mode can be determined by a test user according to test requirements. For example, for some sensitive service types related to user privacy in the online service system, if a test user wishes to perform differentiated execution on a data request in the sensitive service type, it may be determined that the data request belonging to the sensitive service type needs to be added with a first preset tag.
The adding position of the first preset mark in the data request is not particularly limited on the basis of not influencing the identification and the resolution of the data request, for example, the first preset mark may be added in a communication protocol field of the data request (i.e., a field related to a communication protocol in the data request), where the communication protocol field is determined according to the type of the communication protocol supported between the node serving as the request initiator and the node serving as the request receiver. On the basis of not affecting the validity of the communication protocol field, the specific position of the first preset mark in the communication protocol field is also not specifically limited in the embodiments of the present disclosure. For example, the first preset flag may be added in a Header (or called request Header) field of an HTTP Protocol (HyperText Transfer Protocol), or the first preset flag may be added in a Payload (referring to a percentage of a Payload in a Protocol message in a Remote Procedure Call Protocol) field of an RPC Protocol (Remote Procedure Call Protocol).
Specifically, taking the HTTP protocol as an example, one HTTP-type Request may include four parts, a Request Line (Request Line), a Request Header (Header), a null Line, and Request data. The request line consists of a request method field, a URL (Uniform Resource Locator) field and a HTTP protocol version field 3 field, and is separated by a blank space; the request header consists of key/value pairs, one pair for each row, the key and value are separated by English colon ": to"; the last request header is followed by an empty line, sending a carriage return and line feed, informing the server that there is no more request header below. The request line and request header may be referred to as communication protocol fields in embodiments of the present disclosure, without affecting the identification and resolution of the data request.
After receiving the data request, the current node serving as the request receiver may detect each field included in the data request, for example, detect whether a communication protocol field of the data request carries a first preset flag, thereby determining whether the data request carries the first preset flag, and determine how to process the data request according to a detection result of the first preset flag.
S102, acquiring a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes a data request carrying a first preset mark.
The test state database may be implemented by using a distributed database, such as an ETCD database (which refers to a kind of highly available distributed key-value database) and the like. That is, in the embodiment of the present disclosure, the test state database may be used to perform unified maintenance on the test states of the nodes.
Optionally, before obtaining the test status from the test status database, the method further includes: and sending a state updating request to the test state database based on a preset time period so as to request the test state database to modify the test state corresponding to the node identification carried in the state updating request.
The preset time period may be set according to specific requirements. For example, any node may use the setting time of the last test state as a time starting point, and then send a state updating request to the test state database after a preset time; the test state database modifies the test state of the node according to the node identifier carried in the state updating request, for example, the test state is modified from 'executable data request carrying the first preset mark' to 'non-executable test state carrying the data request carrying the first preset mark'. That is, in the embodiment of the present disclosure, the test state of each node has a certain timeliness, and the data request executable by each node can be controlled from the time dimension.
S103, if the received data request carries a first preset mark, performing pressure test processing based on the received data request according to the acquired test state.
After determining that the data request carries a first preset mark, the node further determines how to process the data request according to the test state; after the node determines that the data request does not carry the first preset mark, that is, the data request does not need to be executed in a differentiated manner, the data request can be directly executed according to the service test logic, and the test state of the node does not need to be considered. Finally, the test user can obtain the pressure test result by analyzing the test log generated in the test process. And the test log records first preset mark information carried in each data request.
Optionally, according to the obtained test state, performing a stress test process based on the received data request, including:
if the obtained test state is that the data request carrying the first preset mark can be executed, executing the received data request;
and if the acquired test state is that the data request carrying the first preset mark cannot be executed, refusing to execute the received data request.
According to the first preset mark carried in the data request and the test state of the node, how to process the data request is determined, so that the effective execution control, or called flow control, of the data request is realized, and the effective management of the data request is realized.
On the basis of the above technical solution, optionally, obtaining the test state from the test state database includes: calling a control process which is deployed in advance, and acquiring a test state from the test state database; or calling a pre-deployed control middleware to acquire the test state from the test state database.
The specific application of the control process and the control middleware can be determined according to business requirements. The method for deploying the independent control process is adopted, the code of the business service system is not invaded, and a test user or a developer can use any open source or other existing frameworks to develop the business service system. Since the control process needs to be initiated by the node, the control process deployed in advance needs to be implemented in the production environment of the business service system. Compared with a mode of deploying a single control process, the deployment control middleware can be deployed in any development environment, is less dependent on the type of the development environment, and has higher implementation compatibility. The control middleware can be realized by adopting micro service architecture such as ginex or kite. In addition, a preset mark adding function (or called as a flow mark), a preset mark detection function and a preset mark transmission function between different nodes can be added into the control middleware, namely, the function of the control middleware supports flexible setting and development.
On the basis of the above technical solution, optionally, the method provided by the embodiment of the present disclosure further includes: and receiving a data request which does not carry a third preset mark (which can be the same as or different from the first preset mark). At this time, after the node serving as the request receiver receives the data request, it is determined through detection that the data request does not carry the third preset mark, and the data request may be executed according to the service test logic. The third preset mark can be directly used for distinguishing whether the node as the request receiving party can receive or not can receive the data request, and the data request is specifically initiated under the control of the request initiating party, so that the data request which can be received by the node as the request receiving party can be effectively controlled, and the influence on the type of the online business service which does not want to participate in the stress test is avoided.
For example, for some sensitive business service types related to user privacy in the online business service system, the testing user does not want to stress test the sensitive business service types, that is, the corresponding node is required not to receive the data request belonging to the sensitive service type, a third preset mark can be added to the data request in the generation process of the data request belonging to the sensitive service type, and further, in the process of a node acting as a request initiator sending a data request to a node acting as a request receiver, if the third preset mark is detected to be carried in the currently generated data request belonging to the sensitive service type, the data request can be stopped being sent to the node as the request receiving party, therefore, the node serving as the request receiver cannot receive the data request carrying the third preset mark, and the effect of avoiding influencing the online service which does not want to participate in the pressure test is achieved.
According to the technical scheme of the embodiment of the disclosure, in the process of pressure testing, any data request can carry a preset mark, and after a node in a service system receives the data request, whether the data request is executed or not can be determined according to the preset mark carried in the data request and the testing state of the node, so that the execution control of the data request is realized, the problem that the data request transmitted in the process of pressure testing is lack of effective execution control in the existing scheme is solved, and the effective management of the data request is realized; in addition, compared with the situation that the data request in the pressure test process is not marked at all, the technical scheme of the embodiment of the disclosure realizes the effect of optimizing the test result based on different test requirements by managing the data request based on the preset mark, for example, the node can selectively execute the data request carrying the preset mark according to the test state, thereby improving the pertinence of the pressure test and avoiding influencing the online service which is not expected to participate in the pressure test.
In addition, in the embodiment of the disclosure, the interface test based on the flow mark can avoid the test case from polluting sensitive business services such as storage, transaction and the like by marking the test flow; meanwhile, by combining the test state change of the node, the execution authority and safety problems of the test flow can be solved, namely, the risk control and the current limiting service can be bypassed by setting the flow mark, and the pressure test can be executed.
Fig. 2 is a flowchart of another pressure testing method provided in the embodiment of the present disclosure, which is further optimized and expanded based on the above technical solution, and can be combined with the above optional embodiments. As shown in fig. 2, the method may include:
s201, detecting whether a received data request carries a first preset mark; the first preset mark is used for marking a data request participating in a stress test.
S202, acquiring a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes a data request carrying a first preset mark.
S203, if the received data request carries the first preset mark and the obtained test state is that the data request carrying the first preset mark can be executed, processing the received data request to obtain a processing result.
And S204, if a calling request for calling the downstream node is generated according to the processing result, adding the first preset mark into the calling request.
In a micro-service scenario, a plurality of downstream services with dependency relationships may exist in each type of service, and the call relationship between these services forms a service call chain, or called a service link. The first preset mark is transmitted (or referred to as transparent transmission) in the service link, so that the uniformity mark of the data request with the relevance in the stress test process is realized, and the test user is facilitated to inquire or backtrack the data request with the relevance according to the first preset mark, so that the test result analysis is facilitated.
The generation implementation manner of the invocation request is not specifically limited in the embodiments of the present disclosure, and for example, the invocation request may be generated based on an invocation request generation operation triggered by a test user, or may be generated automatically after determining that a downstream node needs to be invoked according to a processing result. The current node can extract the first preset mark from the received data request and then add the first preset mark to the generated call request, so that the first preset mark can be transmitted to the downstream node. In addition, the first preset flag may also be saved in a service context including information such as various environment information (e.g., test environment information or online execution environment information) and status (e.g., whether the request is successfully transmitted, transmission or reception time, etc.) of a request; after a current node (which may be the first node in a service link belonging to an upstream service) receives a data request carrying a first preset tag, when a downstream node is called, the first preset tag may be transferred to the downstream node according to a service context.
Illustratively, adding the first preset flag to the invocation request includes: and adding the first preset mark into a communication protocol field of the call request, wherein the communication protocol field is determined according to the type of the communication protocol supported between the current node and the downstream node needing to be called.
S205, sending the call request added with the first preset mark to a downstream node.
After receiving the call request, the downstream node may directly execute the call request and return the required data to the initiator of the call request, or determine how to process the call request according to the execution state of the downstream node to the data request carrying the first preset flag. Illustratively, the downstream node may determine the current test state by querying a test state database; if the current test state is that the calling request carrying the first preset mark can be executed, executing the calling request according to the service test logic; and if the current test state is that the call request carrying the first preset mark can not be executed, rejecting to execute the call request.
According to the technical scheme of the embodiment of the disclosure, in the process of pressure testing, the first preset mark carried in the data request supports transmission in the service link, so that the unified mark of the data request with relevance is realized, the effective management and the effective control of the data request transmitted in the service link are realized, and a test user is facilitated to inquire or backtrack the data request with relevance according to the first preset mark.
Fig. 3 is a flowchart of another pressure testing method provided in the embodiments of the present disclosure, which is used to exemplify the embodiments of the present disclosure. As shown in fig. 3, a test user may trigger a data request carrying a first preset flag according to a current test requirement, and send the data request to a node a, and after receiving the data request, the node a determines a current test state by querying a test state database (i.e., the switch state database in fig. 3); in fig. 3, it is determined that the switch is turned on, that is, the node a may currently execute the data request carrying the first preset flag, and if it is determined that the switch is turned off, that is, the node a does not currently execute the data request carrying the first preset flag; in the data request execution process, if a downstream node, namely a node B, needs to be called is determined, the node A acquires a first preset mark carried in a received data request, generates a calling request carrying the first preset mark, and sends the calling request to the node B; after receiving the call request carrying the first preset mark, the node B can also determine the current test state by inquiring the test state database, and if the call request carrying the first preset mark is determined to be executable currently, the call request is executed and an execution result is returned to the node A; after receiving the execution result of the node B, the node a may continue to generate result data required by the test user and feed back the result data to the test user.
Fig. 4 is a flowchart of another pressure testing method provided in the embodiment of the present disclosure, which is further optimized and expanded based on the above technical solution, and can be combined with the above optional embodiments. As shown in fig. 4, the method may include:
s301, detecting whether the received data request carries a first preset mark; the first preset mark is used for marking a data request participating in a stress test.
S302, acquiring a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes a data request carrying a first preset mark.
And S303, if the received data request carries a first preset mark, performing pressure test processing based on the received data request according to the acquired test state.
S304, generating a target request carrying a second preset mark; and the second preset mark is used for marking the request which needs to be sent to the virtual node.
In the embodiment of the present disclosure, each node in the service system has equality, and may be used as a receiver of a data request or an initiator of the data request.
A virtual node is a simulated implementation of a real node for returning preset data, e.g., a specific feedback value, corresponding to a target request according to a preset test logic, and one virtual node may correspond to at least one real node. The specific construction of the virtual node can refer to the implementation principle of the virtual test in the prior art.
The second preset mark can also be represented in the form of one of Chinese characters, English characters, numbers and other characters, or in the form of a combination of multiple characters. As to the manner of adding the second preset mark in the target request, reference may be made to the foregoing description of adding the first preset mark, both belonging to the same inventive concept. For example, the current node may add a second preset flag in the communication protocol field of the target request during the process of generating the target request according to the service processing requirement.
S305, determining the IP address and the port number of the virtual node for receiving the target request based on the business service identification corresponding to the target request.
The business service identification is used for uniquely identifying the business service type corresponding to the target request, has stability in a business service system, and can comprise a business service type name, a business service type label and the like. It should be noted that the service identifier is different from the node IP address in the specific service type, and the node IP address may have a change according to the deployment condition of the node, and the service identifier including the service type name or the service type label has stability relatively, and will not change due to the change of the node deployment.
For example, a test user may preset a corresponding relationship between a service identifier and a virtual node, and store the service identifier and an IP address and a port number of the corresponding virtual node, and after a target request is generated by a current node, the stored data may be called, and the IP address and the port number of the virtual node that are required are determined through service identifier matching.
S306, sending a target request to the virtual node based on the IP address and the port number of the virtual node; and the virtual node is used for returning preset data corresponding to the target request.
After the current node acquires the IP address and the port number of the virtual node, the target request can be directly sent to the virtual node, and the real node originally used for receiving the target request cannot receive the target request.
According to the technical scheme of the embodiment of the disclosure, in the process of pressure testing, aiming at the condition that a real node does not receive a target request, the IP address and the port number of a virtual node for receiving the target request can be determined according to a service identifier corresponding to the target request so as to send the target request to the virtual node, thereby ensuring the determination accuracy of the virtual node and the successful realization of flow diversion, ensuring the normal execution of a pressure testing process and simultaneously realizing the effective control of a data request or the target request transmitted in a service system.
On the basis of the foregoing technical solution, optionally, determining an IP address and a port number of a virtual node for receiving the target request based on a service identifier corresponding to the target request includes:
sending the target request to a service discovery device; the service discovery device is used for determining an IP address and a port number of a virtual node for receiving the target request based on a second preset mark carried in the received target request and a service identifier corresponding to the target request; the service discovery device can determine the service identifier corresponding to the target request through attribute query, and the service identifier can also be carried in the target request and sent to the discovery device;
and receiving the IP address and the port number of the virtual node returned by the service discovery device.
The second preset mark may be used to prompt that a target request currently received by the service discovery apparatus needs to be sent to the virtual node. After receiving the target request, the service discovery device detects the target request, determines whether the second preset mark is carried, determines that the target request needs to be sent to the virtual node if the second preset mark is carried, and returns the IP address and the port number of the virtual node to the current node; if the node does not carry the target request, the target request is determined to be required to be sent to the real node, and preset information can be sent to the current node at the moment and is used for informing the current node to continuously send the target request to the real node for receiving the target request.
The service discovery apparatus may be deployed on the same computing device as the current node, or may be separately deployed on a separate computing device. By calling the service discovery device to determine the IP address and the port number of the virtual node, the determination function of the IP address and the port number of the virtual node can be decoupled from the processing function of the node on the data request or the target request, and the data processing pressure of the node can be relieved. Particularly, for the condition that a large number of target requests exist, the special service discovery device is called, so that the determining efficiency and the determining accuracy of the IP address and the port number of the virtual node can be ensured, and the normal execution of the pressure test process is ensured.
Fig. 5 is a schematic diagram of an interaction link between nodes according to an embodiment of the present disclosure, where arrows indicate a transmission direction of a data request between different nodes. As shown in fig. 5, if during the stress test, it is not desirable for node a to receive the data request (or called label traffic) carrying the first preset label, and it is desirable to use the virtual node aReceiving a data request carrying a first preset mark, after a node serving as a request initiator generates the data request carrying the first preset mark, the node can introduce the data request carrying the first preset mark to the virtual node A by calling the service discovery deviceIs processed. For example, for a strongly dependent service scenario, the data requests are directed to virtual nodes through service discovery, which is essential for the complete execution of stress testing. Continuing with fig. 5, if it is also not desired that the node B receives the data request carrying the first preset flag and the virtual node is not needed to be used, the node serving as the request initiator may terminate sending the data request to the node B after generating the data request, so that the node B does not receive any data request carrying the first preset flag. Eventually, the interaction links between the nodes will be as shown in fig. 6.
Fig. 7 is a schematic structural diagram of a pressure testing apparatus provided in the embodiment of the present disclosure, which may be applied to a situation of performing a pressure test on a deployed service system. The device can be implemented by software and/or hardware and can be integrated on any node in the service system.
As shown in fig. 7, the pressure testing apparatus provided in the embodiment of the present disclosure may include a mark detection module 701, a test state obtaining module 702, and a test processing module 703, where:
a mark detection module 701, configured to detect whether a received data request carries a first preset mark; the first preset mark is used for marking a data request participating in a stress test;
a test state obtaining module 702, configured to obtain a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes a data request carrying a first preset mark;
the test processing module 703 is configured to, if the received data request carries a first preset flag, perform, according to the obtained test state, a pressure test processing based on the received data request.
Optionally, the test processing module 703 includes:
and the request execution unit is used for executing the received data request if the received data request carries the first preset mark and the obtained test state is that the data request carrying the first preset mark can be executed.
Optionally, the request execution unit includes:
the processing result determining subunit is used for processing the received data request to obtain a processing result;
the calling request generating subunit is used for adding the first preset mark to the calling request if the calling request for calling the downstream node is generated according to the processing result;
and the call request sending subunit is used for sending the call request added with the first preset mark to a downstream node.
Optionally, the first preset flag is added in a communication protocol field of the data request;
correspondingly, the mark detection module 701 is specifically configured to:
whether a communication protocol field of the data request carries a first preset mark is detected.
Optionally, the pressure testing apparatus provided in the embodiment of the present disclosure further includes:
and the state updating request sending module is used for sending a state updating request to the test state database based on a preset time period so as to request the test state database to modify the test state corresponding to the node identifier carried in the state updating request.
Optionally, the test status obtaining module 702 includes:
the first acquisition unit is used for calling a control process which is deployed in advance and acquiring a test state from a test state database; alternatively, the first and second electrodes may be,
and the second acquisition unit is used for calling the control middleware which is deployed in advance and acquiring the test state from the test state database.
Optionally, the test processing module 703 includes:
and the request rejection unit is used for rejecting the received data request if the received data request carries the first preset mark and the obtained test state is that the data request carrying the first preset mark cannot be executed.
Optionally, the pressure testing apparatus provided in the embodiment of the present disclosure further includes:
the target request generation module is used for generating a target request carrying a second preset mark; the second preset mark is used for marking a request which needs to be sent to the virtual node;
the IP and port number determining module is used for determining the IP address and the port number of the virtual node for receiving the target request based on the business service identifier corresponding to the target request;
the target request sending module is used for sending a target request to the virtual node based on the IP address and the port number of the virtual node; and the virtual node is used for returning preset data corresponding to the target request.
Optionally, the IP and port number determining module includes:
a request sending subunit, configured to send the target request to the service discovery apparatus; the service discovery device is used for determining an IP address and a port number of a virtual node for receiving the target request based on a second preset mark carried in the received target request and a service identifier corresponding to the target request;
and the IP and port number receiving subunit is used for receiving the IP address and the port number of the virtual node returned by the service discovery device.
The pressure testing device provided by the embodiment of the disclosure can execute any pressure testing method provided by the embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method. Reference may be made to the description of any method embodiment of the disclosure that may not be described in detail in the embodiments of the apparatus of the disclosure.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, which is used to exemplarily illustrate an electronic device for performing a pressure testing method in an example of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, an electronic device 800 may include a processing means (e.g., central processing unit, graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing apparatus 801, the ROM802, and the RAM803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804. The ROM802, RAM803, and storage 808 shown in fig. 8 may be collectively referred to as memory for storing instructions or programs executable by the processing device 801.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the disclosed embodiments, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the disclosed embodiments, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a Local Area Network (LAN), a Wide Area Network (WAN), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: detecting whether the received data request carries a first preset mark or not; the first preset mark is used for marking a data request participating in a stress test; acquiring a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes the data request carrying the first preset mark; and if the received data request carries the first preset mark, performing pressure test processing based on the received data request according to the acquired test state.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may operate over any of a variety of networks: including a Local Area Network (LAN) or a Wide Area Network (WAN), to the user's computer, or may be connected to an external computer (for example, through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. The name of a module or unit does not in some cases form a limitation on the module or unit itself, for example, the tag detection module may also be described as a "module for detecting whether a received data request carries a first preset tag".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A pressure testing method, comprising:
detecting whether the received data request carries a first preset mark or not; the first preset mark is used for marking a data request participating in a stress test;
acquiring a test state from a test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes the data request carrying the first preset mark;
and if the received data request carries the first preset mark, performing pressure test processing based on the received data request according to the acquired test state.
2. The method of claim 1, wherein performing a stress test process based on the received data request according to the obtained test status comprises:
and if the acquired test state is that the data request carrying the first preset mark can be executed, executing the received data request.
3. The method of claim 2, wherein the executing the received data request comprises:
processing the received data request to obtain a processing result;
if a calling request for calling a downstream node is generated according to the processing result, adding the first preset mark to the calling request;
and sending the call request added with the first preset mark to the downstream node.
4. The method of claim 1, wherein the first predetermined flag is added in a communication protocol field of the data request;
correspondingly, the detecting whether the received data request carries a first preset flag includes:
and detecting whether a communication protocol field of the data request carries the first preset mark.
5. The method of claim 1, further comprising, prior to said retrieving test states from a test state database:
and sending a state updating request to the test state database based on a preset time period so as to request the test state database to modify the test state corresponding to the node identification carried in the state updating request.
6. The method of claim 1, wherein obtaining the test state from the test state database comprises:
calling a control process which is deployed in advance, and acquiring a test state from the test state database; alternatively, the first and second electrodes may be,
and calling a pre-deployed control middleware to acquire the test state from the test state database.
7. The method of claim 1, further comprising:
generating a target request carrying a second preset mark; the second preset mark is used for marking a request which needs to be sent to the virtual node;
determining an IP address and a port number of a virtual node for receiving the target request based on a business service identifier corresponding to the target request;
sending the target request to the virtual node based on the IP address and port number of the virtual node; and the virtual node is used for returning preset data corresponding to the target request.
8. A pressure testing device, comprising:
the mark detection module is used for detecting whether the received data request carries a first preset mark or not; the first preset mark is used for marking a data request participating in a stress test;
the test state acquisition module is used for acquiring a test state from the test state database; the test state database is used for recording the test state of each node according to the node identification, and the test state is used for marking whether each node executes the data request carrying the first preset mark;
and the test processing module is used for performing pressure test processing based on the received data request according to the acquired test state if the received data request carries the first preset mark.
9. An electronic device, comprising:
a processing device;
a memory for storing the processing device executable instructions or programs;
the processing device is used for reading the executable instructions or the program from the memory and executing the executable instructions or the program to realize the pressure testing method of any one of the claims 1 to 7.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program or instructions which, when executed by a processing device, implement the stress testing method of any of the preceding claims 1-7.
CN202011529964.7A 2020-12-22 2020-12-22 Pressure testing method and device, electronic equipment and storage medium Active CN112714042B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011529964.7A CN112714042B (en) 2020-12-22 2020-12-22 Pressure testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011529964.7A CN112714042B (en) 2020-12-22 2020-12-22 Pressure testing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112714042A true CN112714042A (en) 2021-04-27
CN112714042B CN112714042B (en) 2022-10-14

Family

ID=75545221

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011529964.7A Active CN112714042B (en) 2020-12-22 2020-12-22 Pressure testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112714042B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113900915A (en) * 2021-09-28 2022-01-07 盐城金堤科技有限公司 Method and device for determining service performance state, storage medium and electronic equipment
CN116506340A (en) * 2023-06-27 2023-07-28 云账户技术(天津)有限公司 Flow link testing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106708715A (en) * 2015-07-13 2017-05-24 阿里巴巴集团控股有限公司 Automatic test method and device
CN108845954A (en) * 2018-08-31 2018-11-20 中国联合网络通信集团有限公司 Method for testing pressure, system and storage medium
CN109871320A (en) * 2019-01-21 2019-06-11 上海德启信息科技有限公司 A kind of data processing method, device, application server and storage medium
CN110532191A (en) * 2019-09-05 2019-12-03 北京博睿宏远数据科技股份有限公司 A kind of method for testing pressure, system and cluster
CN111258917A (en) * 2020-04-08 2020-06-09 北京字节跳动网络技术有限公司 Software testing system, method and device, computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106708715A (en) * 2015-07-13 2017-05-24 阿里巴巴集团控股有限公司 Automatic test method and device
CN108845954A (en) * 2018-08-31 2018-11-20 中国联合网络通信集团有限公司 Method for testing pressure, system and storage medium
CN109871320A (en) * 2019-01-21 2019-06-11 上海德启信息科技有限公司 A kind of data processing method, device, application server and storage medium
CN110532191A (en) * 2019-09-05 2019-12-03 北京博睿宏远数据科技股份有限公司 A kind of method for testing pressure, system and cluster
CN111258917A (en) * 2020-04-08 2020-06-09 北京字节跳动网络技术有限公司 Software testing system, method and device, computer readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113900915A (en) * 2021-09-28 2022-01-07 盐城金堤科技有限公司 Method and device for determining service performance state, storage medium and electronic equipment
CN113900915B (en) * 2021-09-28 2024-03-08 盐城天眼察微科技有限公司 Method and device for determining service performance state, storage medium and electronic equipment
CN116506340A (en) * 2023-06-27 2023-07-28 云账户技术(天津)有限公司 Flow link testing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112714042B (en) 2022-10-14

Similar Documents

Publication Publication Date Title
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
CN110753089B (en) Method, device, medium and electronic equipment for managing client
CN110580305B (en) Method, apparatus, system and medium for generating identifier
CN111800513B (en) Method and device for pushing information and computer readable medium of electronic equipment
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN112714042B (en) Pressure testing method and device, electronic equipment and storage medium
CN112214408A (en) Dependency conflict detection method and device, electronic equipment and computer readable medium
CN111209306A (en) Business logic judgment method and device, electronic equipment and storage medium
CN111432001B (en) Method, apparatus, electronic device and computer readable medium for jumping scenes
CN111596991A (en) Interactive operation execution method and device and electronic equipment
CN111679990A (en) Test data generation method and device, readable medium and electronic equipment
CN114637703B (en) Data access device, method, readable medium and electronic equipment
CN110597602B (en) Transaction processing method and device, computer equipment and storage medium
CN111596992B (en) Navigation bar display method and device and electronic equipment
CN112748962A (en) Application loading method and device, electronic equipment and computer readable medium
CN110489621B (en) Method, device, medium and electronic equipment for dynamically adjusting route
CN115292635A (en) Page floor data display method, device, equipment and computer readable medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN114546370A (en) Data docking method and related device
CN111367590A (en) Interrupt event processing method and device
CN112306858A (en) Test method and device and electronic equipment
CN116319322B (en) Power equipment node communication connection method, device, equipment and computer medium
CN116820354B (en) Data storage method, data storage device and data storage system
CN109005084B (en) Method, electronic device, and computer-readable medium for verifying network connection
CN114444064A (en) Account processing method and device, electronic equipment and computer readable medium

Legal Events

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