Disclosure of Invention
In order to solve the defects of the prior art, the main objective of the present invention is to provide a method, an apparatus and a computer system for pressure testing, so as to solve the problem of high adjustment cost of the system at the later stage caused by the performance testing method in the prior art.
In order to achieve the above object, the present application provides in a first aspect a method of pressure testing, the method comprising:
starting a real-time stream processing system to be tested so that the real-time stream processing system to be tested reads test stream data for processing;
reading a pre-configured task parameter, and automatically collecting a performance parameter generated in the process of processing the test stream data by the real-time stream processing system to be tested according to the task parameter;
and analyzing and processing the performance parameters to obtain a performance analysis result of the real-time stream processing system to be tested and carrying out visual display.
In some embodiments, the test flow data is real-time flow data configured in real-time during the test.
In some embodiments, the starting the real-time streaming system to be tested so that the real-time streaming system to be tested reads test streaming data for processing includes:
and starting the Storm real-time streaming system so that the Storm real-time streaming system reads the test streaming data from the Kafka message queue for distributed real-time streaming processing.
In some embodiments, the real-time stream processing system under test is a distributed real-time stream processing system.
In some embodiments, the real-time streaming data comprises at least two data streams.
In some embodiments, the reading of the pre-configured task parameters and the automatically collecting, according to the task parameters, the performance parameters generated in the process of processing the test stream data by the real-time stream processing system to be tested includes:
reading a pre-configured task parameter to obtain a preset dotting period and dotting times;
performing dotting collection on the processed data volume of the real-time stream processing system to be tested at each dotting time according to the dotting period and the dotting times;
the collecting the performance parameters generated in the process of processing the test flow data by the real-time flow processing system to be tested, and the analyzing and processing the performance parameters comprises the following steps:
calculating and obtaining the data processing amount of the real-time stream processing system to be tested in each dotting period according to the collected processed data amount;
and calculating to obtain the data processing speed of each dotting period of the real-time flow processing system to be tested according to the data processing amount in each dotting period of the real-time flow processing system to be tested and the preset dotting period duration.
In some embodiments, the analyzing the performance parameter to obtain the performance analysis result of the real-time streaming processing system to be tested further includes:
and calculating the average value of the data processing speeds of all the dotting periods to obtain the average data processing speed of the real-time stream processing system to be tested.
In some embodiments, after obtaining the average data processing speed of the real-time streaming processing system under test, the method further comprises:
calculating an absolute value of a difference between the data processing speed for each dotting cycle and the average data processing speed,
when the absolute value of the difference value between the data processing speed of any dotting period and the average data processing speed exceeds a preset threshold value,
and sending an abnormal indication signal and carrying out visual display on the abnormal indication signal.
In a second aspect, the present application provides a pressure testing device, the device comprising:
the computing module is used for starting the real-time stream processing system to be tested so that the real-time stream processing system to be tested can read the test stream data for processing;
the execution module is used for reading a pre-configured task parameter and automatically collecting a performance parameter generated in the process of processing the test stream data by the real-time stream processing system to be tested according to the task parameter;
and the processing module is used for analyzing and processing the performance parameters, obtaining the performance analysis result of the real-time stream processing system to be tested and carrying out visual display.
In some embodiments, the apparatus further comprises:
and the alarm module is used for sending an abnormal indication signal and carrying out visual display on the abnormal indication signal when the absolute value of the difference value between the data processing speed of any dotting period and the average data processing speed exceeds a preset threshold value.
In a third aspect, the present application provides a computer system comprising:
one or more processors;
and memory associated with the one or more processors for storing program instructions that, when read and executed by the one or more processors, perform operations comprising:
starting a real-time stream processing system to be tested so that the real-time stream processing system to be tested reads test stream data for processing;
reading a pre-configured task parameter, and automatically collecting a performance parameter generated in the process of processing the test stream data by the real-time stream processing system to be tested according to the task parameter;
and analyzing and processing the performance parameters to obtain a performance analysis result of the real-time stream processing system to be tested and carrying out visual display.
The invention has the following beneficial effects:
before the real-time streaming processing system is put into an actual environment to run, the simulation streaming data carries out pressure test on the real-time streaming processing system in advance, and performance parameters obtained by the pressure test are analyzed and processed so as to be displayed visually, so that testers can conveniently evaluate test results of a tested calculation project;
a method for analyzing and processing the performance parameters obtained by the test to obtain a visual result for evaluation of a tester is provided;
the method for detecting and processing the performance parameter change obtained by the test exceeds the threshold value is provided, the automatic alarm prompt of the abnormal result is realized, and the test efficiency is improved.
Of course, it is not necessary for any product to achieve all of the above-described advantages at the same time for the practice of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As described in the background, streaming data is a new data intensive application where data arrives continuously in large, fast, time-varying streams, potentially of endless size, numerous sources of data, complex formats, and once processed, is either discarded or archived for storage. Therefore, the streaming data requires strong timeliness, and the processing of the streaming data needs to be completed quickly to ensure that the value of the data is not lost.
When the traditional batch calculation is used for processing data, a processing result is sent to a subsequent task after a complete data block is processed, so that the delay of data processing is large, a batch calculation method cannot be used for processing the stream data, and the processing requirement of the stream data can be met only by using a stream calculation mode of real-time calculation. Storm, for example, is one type of real-time stream processing system.
The process flow of flow computation generally comprises three phases: data real-time acquisition, data real-time calculation and real-time query service.
Because a real-time streaming system needs to rapidly process a large amount of streaming data, the requirements on the performances of the real-time streaming system, such as real-time performance, stability and the like, are high, and once a fault occurs, a large amount of data which is flooded in real time is accumulated. However, as described in the background, the prior art only knows how to perform when the system is in use, and once tuning is required, it is costly. Therefore, the method for testing the pressure is provided, the test stream data is processed by using the real-time stream processing system to be tested in advance, the performance parameters in the process of processing the test stream data by the real-time stream processing system are automatically collected according to the pre-configured task parameters and are analyzed, the performance analysis result is obtained to be visually displayed, the test flow of testers is facilitated, and the test efficiency is improved.
To achieve the above object, taking the pressure test of the real-time flow processing system Storm as an example, as shown in fig. 2, the above scheme can be implemented by the following steps:
step one, test data is led into a message queue;
test flow data prepared in advance is led into a message queue of Kafka.
Kafka is a streaming data processing platform supporting distribution, and has the characteristic of high throughput. The test data is led into the message queue of Kafka and can be used for simulating the process that real-time stream data concurrently arrives at the stream computing project to wait for processing.
The test data may be simulated as one data stream or more than two data streams to simulate the situation of multiple data sources in an actual situation.
Step two, starting Storm engineering
Storm is a distributed real-time stream processing system that supports the creation of topologies to convert data streams without endpoints. Storm is applicable to stream data processing, and can be used for processing messages continuously flowing in from a source, and writing the processed results into a predefined storage.
Storm adopts a master-slave device system structure, and distributed computation is realized by two types of service processes, namely Nimbus and Supervisor. The Nimbus process runs on a master node of the cluster and is responsible for assignment and distribution of tasks, and the Supervisor runs on a slave node of the cluster and is responsible for executing specific parts of the tasks. FIG. 1 shows the architectural diagram of Storm, where:
the Nimbus is responsible for resource allocation and task scheduling;
the ZooKeeper is responsible for coordinating the Nimbus and the Supervisors, if the Supervisors cannot run Topology due to faults, the Nimbus can sense the faults at the first time, and redistribute tasks to other available Supervisors to run;
the Supervisor is responsible for receiving tasks distributed by nimbus and starting and stopping worker processes managed by the Supervisor;
the Worker is responsible for running the process of the specific processing assembly logic;
task Each of the spit/bolt threads in worker is called a Task. The same task of spout/bolt may share a physical thread, called executor.
The Storm/Bolt programming model is used in the Storm framework to stream messages. Message flow is the basic abstraction of incoming data in Storm, one message flow is the encapsulation of one piece of incoming data, and message flows that are continuously incoming from source to source are processed in a distributed manner. The Spout component is a message producer, is a data input source in the Storm architecture, can read data from various heterogeneous data sources and transmit message streams, and the Bolt component is responsible for receiving the information streams transmitted by the Spout component and completing specific processing logic. In complex business logic, a plurality of Bolt components can be connected in series, and different functions are programmed in each Bolt component, so that the whole processing logic is realized.
Reading preset task parameters;
the task parameters are preconfigured files that indicate how to collect data for the real-time streaming system and how to process the collected data. Such as specifying the number of dotting times and the dotting period of the collected data processing amount.
Specifically, the task parameters can be set to be dotting times of 3, the dotting period is 120 seconds, and the data volume processed at each dotting time of the Strom project is dotted and collected; wherein recording the data throughput at each dotting time can be achieved by means of a kafkaaffsetmonitor tool.
KafkaOffsetmonitor is an open source monitoring tool that can obtain the consumption condition of the kafka consumer Storm, i.e. monitor the basic condition of Storm stream processing, such as the amount of data processed.
For example, the data processing amount at each dotting time is obtained as follows:
at 120 th second, the data volume of the recording process is 5000;
at 240 th second, the amount of data of the recording process was 12000;
at 360 th second, the amount of data of the recording process is 20000.
And step four, calculating the data processing amount of the Strom project in each dotting period according to the collected data amount processed at each dotting time of the Strom project.
Specifically, the process may include:
in the first dotting period, the data processing capacity is 5000;
in the second dotting period, the data processing capacity is 12000-5000-7000;
in the third dotting period, the data processing amount is 20000-.
Step five, calculating the data processing speed of the Storm project in each dotting period according to the data processing amount in each dotting period of the Strom project obtained through calculation and the length of the dotting period;
specifically, the process may include:
the data processing speed of the first dotting period is as follows: TPS1=5000/120=41.67;
The data processing speed of the second dotting period is as follows: TPS2=7000/120=58.33;
The data processing speed of the third dotting period is as follows: TPS3=8000/120=66.67。
TPS represents the Transaction throughput Per Second (Transaction Per Second), i.e., the number of messages processed Per Second, which is an important unit of measure for the system throughput.
Step six, calculating the average speed of data processing of Storm engineering in all dotting periods;
specifically, the process may include:
the average speed of data processing of Storm engineering in all dotting periods is as follows:
TPSAVG=(TPS1+TPS3+TPS3)/3=(41.67+58.33+66.67)/3=55.56。
step seven, calculating the absolute value TPS of the difference value between the average speed of data processing of the Storm project and the data processing speed of the Storm project in each dotting periodD;
In particular, the method comprises the following steps of,
the absolute value of the difference between the data processing speed and the average speed for the first dotting cycle is:
TPSD1=|TPS1-TPSAVG|=|41.67-55.56|=15
the absolute value of the difference between the data processing speed and the average speed for the second dotting cycle is:
TPSD2=|TPS2-TPSAVG|=|58.33-55.56|=5
the absolute value of the difference between the data processing speed and the average speed in the third dotting period is:
TPSD3=|TPS3-TPSAVG|=|66.67-55.56|=10.01
step eight, comparing the absolute value of the difference between the data processing speed and the average speed of each dotting period with a threshold value C which is 10;
when any TPSD > C, the current period is abnormal;
in particular, the method comprises the following steps of,
TPSD1=15>10, then TPS1An exception is generated, namely the exception exists in the data processing of the first cycle;
TPSD2=5<10, the TPS2 is normal, and no exception exists in the data processing of the second period;
TPSD3=10.01>10, the TPS3 is abnormal and there is an abnormality in the first cycle of data processing.
And step nine, generating a data processing condition table according to the data processing speed of the Storm engineering in each dotting period obtained through calculation, drawing a change trend line graph of the TPS, and marking the period with the abnormality.
Index \ dotting time
| 120s |
|
240s |
|
360s
|
TPS
|
111.66
|
131.66
|
136.67
|
TPSAVG |
126.66
|
126.66
|
126.66
|
TPSD=|TPS-TPSAVG|
|
15
|
5
|
10.01 |
TABLE 1
Table 1 shows a data processing situation table in which values corresponding to periods in which an abnormality occurs are bolded and displayed obliquely;
fig. 3 shows a trend graph of the change of TPS in which points representing periods in which abnormality occurs and points in periods in which abnormality does not occur are displayed in different dot patterns.
When a plurality of data streams are processed simultaneously, the method provided by the application can also be used for respectively generating graphs corresponding to the plurality of data streams according to the respective performance parameters of the plurality of data streams or simultaneously displaying the plurality of data streams in one graph, so that the test work of a tester is facilitated.
The tester can evaluate the data processing capacity of the Storm project to be tested according to the chart generated by the method, and analyze the existing problems and the like; the automatic statistics of the data processing capacity of the test engineering is realized, and the test efficiency is improved.
Example two
Corresponding to the first embodiment, as shown in fig. 4, the present embodiment provides a method for pressure testing, where the method includes:
410. starting a real-time stream processing system to be tested so that the real-time stream processing system to be tested reads test stream data for processing;
the test flow data can be simulated real-time flow data and is configured in real time during testing; the data may be non-real-time data prepared in advance, and this embodiment does not limit this.
Preferably, the real-time stream processing system to be tested may be a distributed real-time stream computing project.
Preferably, the test stream data comprises at least two data streams for simulating the process of processing the stream data generated by the plurality of data sources by the real-time stream processing system to be tested.
The real-time stream processing system to be tested may be a Storm project, or may also be a flash, spark streaming, or other real-time stream computing project or a non-stream data computing project, which is not limited in this embodiment.
The preconfigured test stream data may be preconfigured through the Kafka message queue to simulate a real situation, and other data tools may also be used, which is not limited in this embodiment.
Preferably, when the test stream data is pre-prepared non-real-time data, before the real-time stream processing system to be tested is started to process the pre-configured test stream data, the method further includes:
test flow data is configured in advance;
preferably, the configuration process may include importing pre-prepared test flow data into a message queue of Kaflka.
The configuration process may also use other data tools to achieve the purpose of data transmission to the real-time streaming processing system to be tested, which is not limited in this application.
Preferably, the starting the real-time streaming system to be tested so that the real-time streaming system to be tested reads the test streaming data for processing includes:
and starting the Storm real-time streaming system so that the Storm real-time streaming system reads the test streaming data from the Kafka message queue for distributed real-time streaming processing.
420. Reading a pre-configured task parameter, and automatically collecting a performance parameter generated in the process of processing the test stream data by the real-time stream processing system to be tested according to the task parameter;
the task parameters are preconfigured files that indicate how to collect data for the real-time streaming system and how to process the collected data. For example, the number of dotting times and the dotting period of the collected data processing amount are specified, and the total time length of data processing after collection can be included.
Preferably, the reading of the pre-configured task parameters and the automatic collection of the performance parameters generated in the process of processing the test stream data by the real-time stream processing system to be tested according to the task parameters includes:
reading a pre-configured task parameter to obtain a preset dotting period and dotting times;
and dotting and collecting the processed data volume of the real-time stream processing system to be tested at each dotting moment according to the dotting period and the dotting times.
430. And analyzing and processing the performance parameters to obtain a performance analysis result of the real-time stream processing system to be tested and carrying out visual display.
Preferably, the analyzing the performance parameter includes:
and step one, subtracting the processed data volumes of the real-time stream processing system to be tested in all dotting periods and the previous dotting period to obtain the data processing volume of each dotting period.
Preferably, the analyzing the performance parameters to obtain the performance analysis result of the real-time streaming processing system to be tested further includes:
and secondly, calculating and obtaining the data processing speed of each dotting period of the real-time flow processing system to be tested according to the data processing amount of each dotting period of the real-time flow processing system to be tested and the preset time length of the dotting period.
The data processing speed of each dotting period can be obtained by dividing the data processing amount in each dotting period by the duration of a preset dotting period.
Preferably, the analyzing the performance parameters to obtain the performance analysis result of the real-time streaming processing system to be tested further includes:
and thirdly, calculating the average value of the data processing speeds of all the dotting periods to obtain the average data processing speed of the real-time stream processing system to be tested.
The average data processing speed may be obtained by dividing the sum of the data processing speeds of all the dotting periods by the dotting times, or by dividing the data processing amount at the last dotting time by the product of the dotting periods and the dotting times, which is not limited in this embodiment.
Preferably, after obtaining the average data processing speed of the real-time streaming processing system to be tested, the method further comprises:
step four, calculating the absolute value of the difference value between the data processing speed of each dotting period and the average data processing speed,
when the absolute value of the difference value between the data processing speed of any dotting period and the average data processing speed exceeds a preset threshold value,
and sending an abnormal indication signal and carrying out visual display on the abnormal indication signal.
The preset threshold may be predefined, and the visually presenting the abnormal indication signal may be to label an abnormal numerical value in a generated image or table, or may be to pop up a warning identifier or other manners that can be recognized by a tester, which is not limited in the present application.
EXAMPLE III
Corresponding to the second embodiment, as shown in fig. 5, the present application further provides a pressure testing apparatus, which specifically includes:
a calculating module 510, configured to start a real-time streaming processing system to be tested, so that the real-time streaming processing system to be tested reads test streaming data for processing;
the execution module 520 is configured to read a pre-configured task parameter, and automatically collect a performance parameter generated in the process of processing the test stream data by the real-time stream processing system to be tested according to the task parameter;
the processing module 530 is configured to analyze the performance parameters, obtain a performance analysis result of the real-time streaming processing system to be tested, and perform visual display.
Preferably, the real-time stream processing system to be tested started by the computing module 510 may be a distributed real-time stream processing system, and the test stream data may be real-time stream data including at least one data stream.
Preferably, the executing module 520 is configured to:
reading a pre-configured task parameter to obtain a preset dotting period and dotting times;
and dotting and collecting the processed data volume of the real-time stream processing system to be tested at each dotting moment according to the dotting period and the dotting times.
Preferably, the execution module 520 reads the pre-configured task parameters to obtain a preset dotting period and dotting times; after dotting and collecting the data volume processed by the real-time streaming processing system to be tested at each dotting time according to the dotting cycle and the dotting times, the processing module 530 may be configured to:
calculating and obtaining the data processing amount of the real-time stream processing system to be tested in each dotting period according to the obtained processed data amount;
and calculating to obtain the data processing speed of each dotting period of the real-time flow processing system to be tested according to the data processing amount in each dotting period of the real-time flow processing system to be tested and the preset dotting period duration.
Preferably, the processing module 530 is configured to:
and calculating the average value of the data processing speeds of all the dotting periods to obtain the average data processing speed of the real-time stream processing system to be tested.
Preferably, after obtaining the average data processing speed of the real-time streaming processing system to be tested, the processing module 530 is further configured to:
calculating an absolute value of a difference between the data processing speed for each dotting cycle and the average data processing speed,
when the absolute value of the difference value between the data processing speed of any dotting period and the average data processing speed exceeds a preset threshold value,
and sending an abnormal indication signal and carrying out visual display on the abnormal indication signal.
Preferably, the pressure testing apparatus may further include:
and the alarm module 540 is configured to send an abnormal indication signal and perform visual presentation when the absolute value of the difference between the data processing speed of any dotting cycle and the average data processing speed exceeds a preset threshold.
In accordance with the above embodiments, the present application also provides a computer system comprising one or more processors; and memory associated with the one or more processors for storing program instructions that, when read and executed by the one or more processors, perform operations comprising:
starting a real-time stream processing system to be tested so that the real-time stream processing system to be tested reads test stream data for processing;
reading a pre-configured task parameter, and automatically collecting a performance parameter generated in the process of processing the test stream data by the real-time stream processing system to be tested according to the task parameter;
and analyzing and processing the performance parameters to obtain a performance analysis result of the real-time stream processing system to be tested and carrying out visual display.
Fig. 6 illustrates an architecture of a computer system, which may include, in particular, a processor 1510, a video display adapter 1511, a disk drive 1512, an input/output interface 1513, a network interface 1514, and a memory 1520. The processor 1510, video display adapter 1511, disk drive 1512, input/output interface 1513, network interface 1514, and memory 1520 may be communicatively coupled via a communication bus 1530.
The processor 1510 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solution provided by the present Application.
The Memory 1520 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1520 may store an operating system 1521 for controlling the operation of the computer system 1500, a Basic Input Output System (BIOS) for controlling low-level operations of the computer system 1500. In addition, a web browser 1523, a data storage management system 1524, an icon font processing system 1525, and the like can also be stored. The icon font processing system 1525 may be an application program that implements the operations of the foregoing steps in this embodiment of the application. In summary, when the technical solution provided by the present application is implemented by software or firmware, the relevant program codes are stored in the memory 1520 and called for execution by the processor 1510.
The input/output interface 1513 is used for connecting an input/output module to realize information input and output. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The network interface 1514 is used to connect a communication module (not shown) to enable the device to communicatively interact with other devices. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
The bus 1530 includes a path to transfer information between the various components of the device, such as the processor 1510, the video display adapter 1511, the disk drive 1512, the input/output interface 1513, the network interface 1514, and the memory 1520.
In addition, the computer system 1500 may also obtain information of specific extraction conditions from the virtual resource object extraction condition information database 1541 for performing condition judgment, and the like.
It should be noted that although the above devices only show the processor 1510, the video display adapter 1511, the disk drive 1512, the input/output interface 1513, the network interface 1514, the memory 1520, the bus 1530, etc., in a specific implementation, the devices may also include other components necessary for proper operation. Furthermore, it will be understood by those skilled in the art that the apparatus described above may also include only the components necessary to implement the solution of the present application, and not necessarily all of the components shown in the figures.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, or the like, and includes several instructions for enabling a computer device (which may be a personal computer, a cloud server, or a network device) to execute the method according to the embodiments or some parts of the embodiments of the present application.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.