A method and device for detecting streaming processing applications
By obtaining and comparing result data in streaming processing applications, the problem of poor versatility caused by the need to design test cases separately in existing technologies is solved, and flexibility and versatility are improved.
Patent Information
- Application Number
- CN202110072358.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-20
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2041-01-20
AI Technical Summary
In the existing technology, a series of test cases need to be designed separately for each streaming processing program, resulting in poor versatility of the detection method and inability to meet the needs of different application scenarios.
By obtaining the first result data from the first storage area at the first trigger moment and obtaining the second result data from the second storage area at the second trigger moment, and using the key-value storage method for comparison, it is confirmed that the update of the second application to the first application meets the functional consistency requirements, avoiding the need to design test cases separately for each streaming processing program.
The flexibility and versatility of detection streaming applications have been improved to meet the needs of different application scenarios and ensure that updates do not affect functional consistency.
Smart Images

Figure CN114860562B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a method and apparatus for detecting a streaming processing application. Background Art
[0002] Streaming data is continuously arriving, unbounded, and therefore requires the stream processing program to run non-stop 24 hours a day. However, stream processing programs may be temporarily suspended due to modifications such as program and platform upgrades, modifications, or architectural adjustments. Therefore, although these modifications do not directly change the business functions of the stream processing program, retesting the stream processing program after making changes is still necessary to ensure that the changes do not affect the business functions of the stream processing program.
[0003] Currently, functional testing of each streaming program is typically performed by developing a series of test cases tailored to its specific business functions. Furthermore, each different streaming program requires a separate test case based on the specific business functions it implements. However, this testing approach, requiring a separate series of test cases for each streaming program, results in limited versatility and limited application scenarios, making it incapable of meeting the needs of diverse application scenarios.
[0004] In summary, there is an urgent need for a method for testing streaming processing applications to solve the problem in the existing technology that a series of test cases need to be designed separately for each streaming processing program, resulting in poor versatility of this testing method. Summary of the Invention
[0005] The embodiments of the present invention provide a method and apparatus for detecting a streaming processing application, so as to solve the problem in the prior art that a series of test cases need to be designed separately for each streaming processing program, resulting in poor versatility of the testing method.
[0006] In a first aspect, an embodiment of the present invention provides a method for detecting a streaming processing application, comprising:
[0007] Retrieving first result data from the first storage area at a first triggering time; the first result data is data obtained by the first application processing business data generated within a set window period; the first result data carries the same generation time as the corresponding business data; the first triggering time is determined based on the business processing capability of the first application;
[0008] Retrieving second result data from the second storage area at a second triggering time; the second result data is data obtained by the second application processing the business data generated within the set window period; the second result data carries the same generation time as the corresponding business data; the second triggering time is determined based on the business processing capability of the second application; the second application is an updated application of the first application;
[0009] The first result data is compared with the second result data. If it is determined that the first result data is consistent with the second result data, it is confirmed that the update of the first application by the second application meets the requirement of functional consistency.
[0010] In the above technical solution, first result data is obtained from the first storage area at a first trigger moment, and second result data is obtained from the second storage area at a second trigger moment. The first result data is then compared with the second result data. If the first result data and the second result data are determined to be consistent, it is confirmed that the update of the first application by the second application meets the functional consistency requirement. The first result data and the second result data are data obtained by the first application and the second application processing business data whose generation time falls within a set window period; the first result data and the second result data both carry the same generation time as the corresponding business data; the first trigger moment and the second trigger moment are determined based on the business processing capabilities of the first application and the second application; and the second application is the application updated with respect to the first application. Because this method can directly detect the function of the application by comparing the result data output by the first application and the second application, without having to design a series of test cases for each application, the flexibility and versatility of application detection can be improved, thereby meeting the needs of different application scenarios. This can also solve the problem in the prior art that a series of test cases need to be designed separately for each streaming processing program, resulting in poor versatility of this testing method.
[0011] Optionally, the window period is determined by:
[0012] Set the window deadline for obtaining result data;
[0013] A set window period required for obtaining result data is determined according to the window deadline and the window length; the window length is determined based on the business processing capabilities of the first application and the second application.
[0014] In the above technical solution, by determining the set window period required for obtaining result data based on the window deadline and the window length, it is possible to obtain the result data of the corresponding window period from the storage area in a timely and accurate manner when the trigger moment arrives, that is, to obtain the bounded result data of the corresponding window period from the unbounded streaming result data, so that the consistency of the bounded result data can be used to represent the consistency of the unbounded result data in the future.
[0015] Optionally, the window length is determined based on service processing capabilities of the first application and the second application, including:
[0016] determining a first delay time according to a first service processing capability of the first application;
[0017] determining a second delay time according to a second service processing capability of the second application;
[0018] The window length is determined according to the first delay time, the second delay time, the first service processing capability, and the second service processing capability.
[0019] In the above technical solution, the window length is determined based on the first delay time, the second delay time, the first service processing capability, and the second service processing capability, so that the selection of the window period can be more reasonable and accurate.
[0020] Optionally, the window length satisfies the following form:
[0021]
[0022] Among them, lt is the window length, tps1 is the first service processing capability, tps2 is the second service processing capability, dt1 is the first delay time, and dt2 is the second delay time.
[0023] Optionally, the first triggering moment and the second triggering moment satisfy the following form:
[0024]
[0025] Among them, wt1 is the first trigger time, wt2 is the second trigger time, et is the end time of the set window period, dt1 is the first delay time, and dt2 is the second delay time.
[0026] In the above technical solution, by using the above equality and inequality rules to select a reasonable window period, the result data used for comparison can be made more reasonable, thereby helping to avoid the amount of comparison result data being too small and affecting the accuracy of the comparison.
[0027] Optionally, before acquiring the first result data from the first storage area at the first triggering moment, the method further includes:
[0028] Inputting each business data into the first application and the second application simultaneously;
[0029] The first result data processed by the first application is stored in the first storage area; and the second result data processed by the second application is stored in the second storage area.
[0030] In the above technical solution, by inputting the same business data into the first application and the second application for processing at the same time, the consistency of processing time can be ensured, and the timeliness and accuracy of the result data obtained based on the trigger time can be ensured, thereby avoiding the problem of comparison deviation due to processing time difference.
[0031] Optionally, comparing the first result data with the second result data, and if it is determined that the first result data is consistent with the second result data, confirming that the update of the first application by the second application meets the requirement of functional consistency includes:
[0032] Based on a key-value storage method, each data in the first result data and the second result data is used as a key;
[0033] For each data in the first result data and the second result data, the number of times the data appears in the first result data is used as the first value of the key corresponding to the data, and the number of times the data appears in the second result data is used as the second value of the key corresponding to the data;
[0034] If the first value and the second value corresponding to any key are the same, it is confirmed that the update of the first application by the second application meets the requirement of functional consistency.
[0035] In the above technical solution, the first result data and the second result data are compared based on the key-value storage method, which can ensure the accuracy of the comparison and improve the efficiency of the comparison. At the same time, it can avoid the problem of reduced comparison efficiency caused by comparing the first result data and the second result data one by one.
[0036] In a second aspect, an embodiment of the present invention further provides a device for detecting a streaming processing application, comprising:
[0037] An acquisition unit is configured to acquire first result data from a first storage area at a first trigger moment; the first result data is data obtained by the first application processing business data whose generation time falls within a set window period; the first result data carries the same generation time as the corresponding business data; the first trigger moment is determined based on the business processing capability of the first application; and acquire second result data from a second storage area at a second trigger moment; the second result data is data obtained by the second application processing business data whose generation time falls within the set window period; the second result data carries the same generation time as the corresponding business data; the second trigger moment is determined based on the business processing capability of the second application; the second application is an application updated with respect to the first application;
[0038] The processing unit is configured to compare the first result data with the second result data, and if it is determined that the first result data is consistent with the second result data, confirm that the update of the first application by the second application meets the requirement of functional consistency.
[0039] Optionally, the acquiring unit is specifically configured to:
[0040] Set the window deadline for obtaining result data;
[0041] A set window period required for obtaining result data is determined according to the window deadline and the window length; the window length is determined based on the business processing capabilities of the first application and the second application.
[0042] Optionally, the acquiring unit is specifically configured to:
[0043] determining a first delay time according to a first service processing capability of the first application;
[0044] determining a second delay time according to a second service processing capability of the second application;
[0045] The window length is determined according to the first delay time, the second delay time, the first service processing capability, and the second service processing capability.
[0046] Optionally, the acquiring unit is specifically configured to:
[0047] The window length satisfies the following form:
[0048]
[0049] Among them, lt is the window length, tps1 is the first service processing capability, tps2 is the second service processing capability, dt1 is the first delay time, and dt2 is the second delay time.
[0050] Optionally, the acquiring unit is specifically configured to:
[0051] The first triggering moment and the second triggering moment satisfy the following form:
[0052]
[0053] Among them, wt1 is the first trigger time, wt2 is the second trigger time, et is the end time of the set window period, dt1 is the first delay time, and dt2 is the second delay time.
[0054] Optionally, the acquiring unit is further configured to:
[0055] Before obtaining the first result data from the first storage area at the first trigger moment, inputting each business data into the first application and the second application simultaneously;
[0056] The first result data processed by the first application is stored in the first storage area; and the second result data processed by the second application is stored in the second storage area.
[0057] Optionally, the processing unit is specifically configured to:
[0058] Based on a key-value storage method, each data in the first result data and the second result data is used as a key;
[0059] For each data in the first result data and the second result data, the number of times the data appears in the first result data is used as the first value of the key corresponding to the data, and the number of times the data appears in the second result data is used as the second value of the key corresponding to the data;
[0060] If the first value and the second value corresponding to any key are the same, it is confirmed that the update of the first application by the second application meets the requirement of functional consistency.
[0061] In a third aspect, an embodiment of the present invention provides a computing device comprising at least one processor and at least one memory, wherein the memory stores a computer program, and when the program is executed by the processor, the processor executes any method for detecting streaming processing applications described in the first aspect.
[0062] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program executable by a computing device. When the program runs on the computing device, the computing device executes any method for detecting streaming processing applications described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0064] Figure 1 Structural schematic diagram of a streaming processing system provided by an embodiment of the present invention;
[0065] Figure 2 Flow schematic diagram of a method for detecting a streaming processing application provided by an embodiment of the present invention;
[0066] Figure 3 Structural schematic diagram of a device for detecting a streaming processing application provided by an embodiment of the present invention;
[0067] Figure 4 Structural schematic diagram of a computing device provided by an embodiment of the present invention. Detailed implementation manners
[0068] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the following will further describe the present invention in detail with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
[0069] The following will first explain some terms involved in the embodiments of the present invention to facilitate understanding by those skilled in the art.
[0070] (1) Event time: The time when an event occurs, that is, the time when data is generated.
[0071] (2) Machine time: The machine time when the program processes data.
[0072] (3) Watermark: At time T, when T arrives, there is no data with event time t < T. That is, when time T arrives, all data with event time t < T has been processed by the program.
[0073] As introduced above are some terms involved in the embodiments of the present invention. The following will introduce the technical features involved in the embodiments of the present invention.
[0074] The following will briefly introduce the design concept of the embodiments of the present invention:
[0075] Streaming data is continuously arriving, unbounded. Therefore, stream processing programs typically run 24 / 7, with only brief pauses for program and platform upgrades, modifications, and architectural adjustments. Stream processing programs may be modified in the following circumstances without changing the business functionality they implement.
[0076] 1. To improve program performance or fix existing bugs, upgrade, optimize, and modify the program itself.
[0077] 2. Adjust the underlying architecture of the program and upgrade its version. For example, if a streaming program is developed based on technologies such as Flink or Spark Streaming, the deployment mode or version of Flink or Spark Streaming needs to be modified or upgraded.
[0078] Although the adjustments and modifications in the above cases do not directly modify the functions of the streaming program, the functions of the streaming program still need to be retested after the modifications to ensure that the above modifications do not affect the functions of the streaming program. At this time, a functional consistency comparison test can be performed before and after the modification. If the functions before and after the modification are consistent, it means that everything is normal. Otherwise, the above modifications have caused the function of the streaming program to change after the modification. For example, a series of test cases can be directly designed for the modified program and platform to perform functional testing. That is, according to the specific business functions of each streaming program, a series of test cases are formulated to perform functional testing specifically for the program. However, since this testing method requires a series of test cases to be designed separately for each streaming program for testing, the versatility of this testing method is poor and the application scenarios are limited, and it cannot meet the needs of different application scenarios.
[0079] In view of this, an embodiment of the present invention proposes a method and device for detecting streaming processing applications. In an embodiment of the present invention, first result data is obtained from a first storage area at a first trigger moment, and second result data is obtained from a second storage area at a second trigger moment. The first result data is then compared with the second result data. If it is determined that the first result data is consistent with the second result data, it is confirmed that the update of the first application by the second application meets the requirements of functional consistency. Among them, the first result data and the second result data are data processed by the first application and the second application for business data whose generation time falls within a set window period; the first result data and the second result data both carry the same generation time as the corresponding business data; the first trigger moment and the second trigger moment are determined based on the business processing capabilities of the first application and the second application; the second application is the application updated for the first application. Since this method can directly detect the functions of the application by comparing the result data output by the first application and the second application, without having to design a series of test cases separately for the first application and the second application, the flexibility and versatility of application detection can be improved, thereby meeting the needs of different application scenarios, and further solving the problem in the prior art that a series of test cases need to be designed separately for each streaming processing program, resulting in poor versatility of this testing method.
[0080] In order to facilitate understanding of the embodiments of the present invention, first Figure 1 The system structure shown in FIG is used as an example to illustrate the structure of the stream processing system applicable to the embodiment of the present invention. Figure 1 As shown, the structure of the stream processing system may include a stream data source x, a pre-modification stream processing program, a post-modification stream processing program, and a comparator.
[0081] When comparing the functions of the streaming programs before and after the change, in order to ensure the timeliness and accuracy of the functional comparison, the same streaming data source x is first simultaneously input into the streaming program before and after the change for processing, obtaining results y1 and y2. It should be noted that since both results y1 and y2 are streaming data, it is necessary to use windowing techniques in streaming processing to obtain bounded result data within the window period of the unbounded results y1 and y2. A bounded result data set can be understood as a set that can contain repeated elements, and the consistency of this bounded result data can represent the consistency of results y1 and y2. Then, based on reasonable window selection rules, a reasonable window period is determined. Based on this window period, data 1 and data 2 corresponding to the window period are selected from results y1 and y2, respectively, and data 1 and data 2 are input into the comparator for comparison processing. If Data 1 and Data 2 are consistent, the streaming program's functionality has not changed before and after the change. This means that the program upgrade, optimization, transformation, and underlying architecture adjustments have not affected the streaming program's functionality. If Data 1 and Data 2 are inconsistent, the streaming program's functionality has changed before and after the change. This means that the program upgrade, optimization, transformation, and underlying architecture adjustments have affected the streaming program's functionality.
[0082] It should be noted that the above Figure 1 The structure shown is only an example and is not limited in the embodiment of the present invention.
[0083] Based on the above description, Figure 2 The flow of a method for detecting a streaming processing application provided by an embodiment of the present invention is exemplarily shown. The flow can be executed by an apparatus for detecting a streaming processing application.
[0084] like Figure 2 As shown in the figure, the process specifically includes:
[0085] Step 201: Obtain first result data from a first storage area at a first triggering moment.
[0086] Step 202: Obtain second result data from the second storage area at a second triggering moment.
[0087] Step 203: Compare the first result data with the second result data. If it is determined that the first result data is consistent with the second result data, it is confirmed that the update of the first application by the second application meets the requirement of functional consistency.
[0088] In steps 201 and 202 above, before obtaining the first result data from the first storage area at the first trigger time, each business data is first simultaneously input into the first application and the second application for processing. The first result data processed by the first application is then stored in the first storage area, and the second result data processed by the second application is stored in the second storage area. By simultaneously inputting the same business data into the first and second applications for processing, consistency in processing time is ensured, as well as the timeliness and accuracy of the result data obtained based on the trigger time, thereby avoiding comparison errors caused by differences in processing time. The first result data is then obtained from the first storage area at the first trigger time, and the second result data is obtained from the second storage area at the second trigger time. That is, when the first trigger time arrives, the first result data within the window period can be obtained from the first storage area; when the second trigger time arrives, the second result data within the window period can be obtained from the second storage area. The first result data is the result of the first application processing business data generated within the set window period; the first result data carries the same generation time as the corresponding business data; and the first trigger time is determined based on the business processing capabilities of the first application. The second result data is the data obtained after the second application processes the business data whose generation time falls within the set window period; the second result data carries the same generation time as the corresponding business data; the second trigger moment is determined based on the business processing capability of the second application; the second application is an application updated for the first application.
[0089] Specifically, the first triggering moment and the second triggering moment may satisfy the following form:
[0090]
[0091] Among them, wt1 is the first trigger time, wt2 is the second trigger time, et is the end time of the set window period, dt1 is the first delay time, and dt2 is the second delay time.
[0092] Furthermore, the set window period can be determined in the following manner: a window deadline required for obtaining the result data is set, and the set window period required for obtaining the result data is determined based on the window deadline and the window length. It should be noted that the set window period can also be determined in the following manner: a window start time required for obtaining the result data is set, and the set window period required for obtaining the result data is determined based on the window start time and the window length. In this way, by determining the set window period required for obtaining the result data based on the window deadline (or window start time) and the window length, it is possible to obtain the result data of the corresponding window period from the storage area in a timely and accurate manner when the trigger moment arrives, that is, to obtain the bounded result data of the corresponding window period from the unbounded streaming result data, so that the consistency of the bounded result data can be used to represent the consistency of the unbounded result data. Among them, the window length is determined based on the business processing capabilities possessed by the first application and the second application; the window deadline or the window start time can be set according to the actual application scenario or according to the experience of the technician or according to the experimental results made by the technician, etc., and the embodiment of the present invention is not limited to this.
[0093] In addition, the window length is determined based on the business processing capabilities of the first application and the second application. The specific process is: the first delay time is determined according to the first business processing capability of the first application, and the second delay time is determined according to the second business processing capability of the second application. Then, based on the first delay time, the second delay time, the first business processing capability and the second business processing capability, the window length is determined. In this way, the selection of the window period can be more reasonable and accurate, so that the result data used for the comparison can be more reasonable, and it helps to avoid the result data of the comparison being too small and affecting the accuracy judgment of the comparison. Among them, the window length can meet the following forms:
[0094]
[0095] Wherein, lt is the window length, tps1 is the first service processing capability, tps2 is the second service processing capability, dt1 is the first delay time, and dt2 is the second delay time.
[0096] In step 203, the first result data is compared with the second result data. If the first result data and the second result data are determined to be consistent, the update of the first application by the second application is confirmed to meet the functional consistency requirements. Specifically, based on a key-value storage method, each data point in the first result data and the second result data is used as a key. For each data point in the first result data and the second result data, the number of times the data point appears in the first result data is used as the first value of the key corresponding to the data point, and the number of times the data point appears in the second result data is used as the second value of the key corresponding to the data point. If the first value and the second value corresponding to any key are the same, the update of the first application by the second application is confirmed to meet the functional consistency requirements. If the first value and the second value corresponding to any key are different when compared, the update of the first application by the second application is confirmed to meet the functional consistency requirements. Based on this, by comparing the first result data and the second result data based on a key-value storage method, the accuracy of the comparison can be ensured, the efficiency of the comparison can be improved, and the problem of reduced comparison efficiency caused by performing a one-to-one comparison between the first result data and the second result data can be avoided.
[0097] It should be noted that after using the number of times the data appears in the second result data as the second value of the key corresponding to the data, the difference between the first value and the second value of the key corresponding to the data can be calculated and used as the third value. If the third value corresponding to each key is zero, the second application's update of the first application meets the functional consistency requirement. If the third value corresponding to each key is non-zero, the second application's update of the first application does not meet the functional consistency requirement.
[0098] To compare the functionality of a streaming program before and after a change, we can compare the program's output results. If the output results are consistent, the functionality is consistent; otherwise, it is inconsistent. Since streaming programs process continuously arriving unbounded data, it is necessary to select reasonable bounded results from the output unbounded data for comparison. This allows for a timely and accurate determination of whether the modified streaming program meets the functional consistency requirements.
[0099] In view of this, the implementation process of detecting a streaming processing application in an embodiment of the present invention is described in detail below.
[0100] Step 1: Set a reasonable window period and obtain bounded result data within the window period before and after the stream processing program is changed.
[0101] The main design parameters for streaming window processing include the window length and the time (watermark) at which window calculation is triggered. Both parameters are related to the acceptable latency of the streaming program itself. The window length is also related to the transactions per second (tps) at which the streaming program generates result data.
[0102] Exemplarily, taking the setting of the window deadline required for obtaining result data as an example, the determination of the watermark and window length in an embodiment of the present invention is described. Assuming that the window deadline is et, the window deadline can be set manually. The tps before and after the streaming program is changed are tps1 and tps2 respectively. Set the delay time generated by processing business data before and after the streaming program is changed to dt1 and dt2 respectively. Among them, tps1, tps2, dt1, and dt2 are all known quantities. Calculate the trigger time (watermark) required for obtaining the result data based on the window deadline and delay time. The calculation method is specifically as follows:
[0103]
[0104] Where wt1 is the watermark before the streaming program is changed, wt2 is the watermark after the streaming program is changed, et is the deadline of the set window period, dt1 is the delay time before the streaming program is changed, and dt2 is the delay time after the streaming program is changed.
[0105] This design ensures that all data with event times between (et-lt) and et in the results y1 and y2 obtained by processing business data before and after the stream processing program changes flows into the window. Of course, to ensure that all data with event times between (et-lt) and et flows into the window, the following options are generally used:
[0106]
[0107] The watermark wt1 before the stream processing program is changed and the watermark wt2 after the stream processing program is changed can be determined through the above conditions.
[0108] The window length lt is selected based on the assumption that the amount of data falling within the window is moderate and that the window length is significantly greater than the latency incurred by the stream processing program when processing business data. Therefore, the number of data falling within the window is generally between 100,000 and 10 million. A window length that is too small will not be able to represent the consistency of unbounded data, while a window length that is too large will reduce the efficiency of the comparator. Specifically, the window length lt must meet the following conditions (i.e., satisfying the following conditions will meet the data requirements for subsequent data comparison):
[0109]
[0110] The window length lt can be determined by the above conditions. After the window length lt is determined, the window period required for obtaining the result data can be determined based on the window deadline et and the window length lt.
[0111] After determining the window period, watermark wt1 and watermark wt2, the same streaming data source x is input into the stream processing program before the change and the stream processing program after the change respectively for processing to obtain the result y1 and the result y2. Then, when the watermark wt1 is reached, the bounded result data y1 within the window period can be obtained from the result y1 ′ , when the waterline wt2 is reached, the bounded result data y2 within the window period is obtained from the result y2 ′ .
[0112] Step 2: Compare bounded result data y1 ′ With bounded result data y2 ′ consistency.
[0113] Through the selection of the window length lt in Step 1, it can be seen that the amount of data in the window period before and after the stream processing program is changed is between 100,000 and 10 million. If a direct one-to-one comparison is performed, the efficiency of the comparison will be very low. Therefore, key-value storage can be selected to assist in data comparison, which helps to greatly improve the efficiency of the comparison. Currently, most computer programming languages (such as Java, C / C++, Python, Scala, etc.) have built-in Map data structures for storing key-value data. Since the Map data structure that comes with the programming language stores data in the program memory, it is suitable for situations where the amount of data is small. For situations where the amount of data is large, technologies such as Redis database can be used for storage. It should be noted that, if the comparison efficiency is not considered, the embodiment of the present invention can also adopt a one-to-one comparison method for direct comparison. Alternatively, when the amount of data set in the embodiment of the present invention is relatively small, a one-to-one comparison method can be adopted for direct comparison, and the embodiment of the present invention is not limited to this.
[0114] Exemplarily, the embodiment of the present invention takes the selection of key-value storage as an example to describe the data comparison of the embodiment of the present invention. Assume that the windows corresponding to the stream processing program before and after the change are "window 1" and "window 2" respectively. When performing data comparison, each piece of data in the bounded result data included in window 1 and window 2 is used as the key. The design of value is divided into 3 columns. That is, the first column is the cumulative value of the number of times the data appears in window 1, and the cumulative value is updated by "+1" every time it appears; the second column is the cumulative value of the number of times the data appears in window 2, and the cumulative value is updated by "+1" every time it appears; the third column is the difference between the first column and the second column, and the column will be updated at the same time every time the cumulative value is updated.
[0115] Insert the data in window 1 and window 2 into the key-value store simultaneously according to the above method until all data has been inserted and calculated. If the values in the third column of value are all 0, it can be determined that the data in window 1 and window 2 are consistent. In this way, it can be promptly and accurately determined that the changed streaming program meets the functional consistency requirements of the streaming program before the change (that is, the function of the changed streaming program has not changed); if the values in the third column of value are not all 0, it can be determined that the data in window 1 and window 2 are inconsistent. In this way, it can be promptly and accurately determined that the changed streaming program does not meet the functional consistency requirements of the streaming program before the change (that is, the function of the changed streaming program has changed).
[0116] Alternatively, when performing data comparison, each piece of data in the bounded result data included in window 1 and window 2 is used as the key. The design of value is divided into two columns. That is, the first column is the cumulative value of the number of times the data appears in window 1, and the cumulative value is updated by "+1" each time it appears; the second column is the cumulative value of the number of times the data appears in window 2, and the cumulative value is updated by "+1" each time it appears. The data in window 1 and window 2 are inserted into the key-value storage at the same time in the above manner until all data are inserted and calculated. If the value in the first column of value is equal to the value in the corresponding second column, it is determined that the data in window 1 and window 2 are consistent. If the value in the first column of value is not equal to the value in the corresponding second column, it can be determined that the data in window 1 and window 2 are inconsistent.
[0117] The above embodiment shows that at a first trigger moment, first result data is obtained from a first storage area, and at a second trigger moment, second result data is obtained from a second storage area. The first result data is then compared with the second result data. If the first result data and the second result data are determined to be consistent, it is confirmed that the update of the first application by the second application meets the functional consistency requirement. The first result data and the second result data are data generated by the first application and the second application after processing business data generated within a set window period; the first result data and the second result data both carry the same generation time as the corresponding business data; the first trigger moment and the second trigger moment are determined based on the business processing capabilities of the first application and the second application; and the second application is the application updated with respect to the first application. Because this method can directly detect the application's functionality by comparing the result data output by the first application and the second application, without having to design a series of test cases for each application, this method can improve the flexibility and versatility of application detection, thereby meeting the needs of different application scenarios. This can also solve the problem in the prior art that a series of test cases must be designed separately for each streaming processing program, resulting in poor versatility of this testing method.
[0118] Based on the same technical concept, Figure 3 An apparatus for detecting a streaming processing application provided by an embodiment of the present invention is exemplarily shown. The apparatus can execute the process of the method for detecting a streaming processing application.
[0119] like Figure 3 As shown, the device includes:
[0120] An acquisition unit 301 is configured to acquire first result data from a first storage area at a first trigger moment; the first result data is data obtained by a first application processing business data whose generation time falls within a set window period; the first result data carries the same generation time as the corresponding business data; the first trigger moment is determined based on the business processing capability of the first application; and acquire second result data from a second storage area at a second trigger moment; the second result data is data obtained by a second application processing business data whose generation time falls within the set window period; the second result data carries the same generation time as the corresponding business data; the second trigger moment is determined based on the business processing capability of the second application; the second application is an application updated with respect to the first application;
[0121] The processing unit 302 is configured to compare the first result data with the second result data, and if it is determined that the first result data is consistent with the second result data, confirm that the update of the first application by the second application meets the requirement of functional consistency.
[0122] Optionally, the acquiring unit 301 is specifically configured to:
[0123] Set the window deadline for obtaining result data;
[0124] A set window period required for obtaining result data is determined according to the window deadline and the window length; the window length is determined based on the business processing capabilities of the first application and the second application.
[0125] Optionally, the acquiring unit 301 is specifically configured to:
[0126] determining a first delay time according to a first service processing capability of the first application;
[0127] determining a second delay time according to a second service processing capability of the second application;
[0128] The window length is determined according to the first delay time, the second delay time, the first service processing capability, and the second service processing capability.
[0129] Optionally, the acquiring unit 301 is specifically configured to:
[0130] The window length satisfies the following form:
[0131]
[0132] Among them, lt is the window length, tps1 is the first service processing capability, tps2 is the second service processing capability, dt1 is the first delay time, and dt2 is the second delay time.
[0133] Optionally, the acquiring unit 301 is specifically configured to:
[0134] The first triggering moment and the second triggering moment satisfy the following form:
[0135]
[0136] Among them, wt1 is the first trigger time, wt2 is the second trigger time, et is the end time of the set window period, dt1 is the first delay time, and dt2 is the second delay time.
[0137] Optionally, the acquiring unit 301 is further configured to:
[0138] Before obtaining the first result data from the first storage area at the first trigger moment, inputting each business data into the first application and the second application simultaneously;
[0139] The first result data processed by the first application is stored in the first storage area; and the second result data processed by the second application is stored in the second storage area.
[0140] Optionally, the processing unit 302 is specifically configured to:
[0141] Based on a key-value storage method, each data in the first result data and the second result data is used as a key;
[0142] For each data in the first result data and the second result data, the number of times the data appears in the first result data is used as the first value of the key corresponding to the data, and the number of times the data appears in the second result data is used as the second value of the key corresponding to the data;
[0143] If the first value and the second value corresponding to any key are the same, it is confirmed that the update of the first application by the second application meets the requirement of functional consistency.
[0144] Based on the same technical concept, an embodiment of the present invention further provides a computing device, such as Figure 4 As shown, it includes at least one processor 401 and a memory 402 connected to the at least one processor. The embodiment of the present invention does not limit the specific connection medium between the processor 401 and the memory 402. Figure 4 For example, the processor 401 and the memory 402 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, and the like.
[0145] In the embodiment of the present invention, the memory 402 stores instructions that can be executed by at least one processor 401. The at least one processor 401 can execute the steps included in the aforementioned method for detecting streaming processing applications by executing the instructions stored in the memory 402.
[0146] Among them, the processor 401 is the control center of the computing device. It can use various interfaces and lines to connect various parts of the computing device, and realize data processing by running or executing instructions stored in the memory 402 and calling data stored in the memory 402. Optionally, the processor 401 may include one or more processing units. The processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes the issuance of instructions. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401. In some embodiments, the processor 401 and the memory 402 may be implemented on the same chip. In some embodiments, they may also be implemented on separate chips.
[0147] The processor 401 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the detection streaming application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
[0148] The memory 402 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 402 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (RAM), a static random access memory (SRAM), a programmable read-only memory (PROM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 402 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 402 in the embodiment of the present invention can also be a circuit or any other device that can implement a storage function, for storing program instructions and / or data.
[0149] Based on the same technical concept, an embodiment of the present invention also provides a computer-readable storage medium storing a computer program executable by a computing device. When the program runs on the computing device, the computing device executes the steps of the above-mentioned method for detecting streaming processing applications.
[0150] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0151] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0152] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0153] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0154] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0155] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications of the present invention fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A method for detecting a streaming application, characterized in that: include: Acquire first result data from the first storage area at a first triggering moment; The first result data is data obtained after the first application processes the business data generated within the set window period; The first result data carries the same generation time as the corresponding business data; The result data stored in the first storage area is unbounded result data obtained by the first application processing the first business data, and the first result data is bounded result data; The first service data is streaming data; acquiring second result data from the second storage area at a second triggering moment; The second result data is data obtained after the second application processes the business data generated within the set window period; The second result data carries the same generation time as the corresponding business data; The result data stored in the second storage area is unbounded result data obtained by the second application processing the first business data, and the second result data is bounded result data; The second application is an updated application for the first application; Comparing the first result data with the second result data, and if it is determined that the first result data is consistent with the second result data, confirming that the update of the first application by the second application meets the requirement of functional consistency; The first triggering moment and the second triggering moment satisfy the following form: Among them, wt1 is the first trigger moment, wt2 is the second trigger moment, et is the deadline of the set window period, dt1 is the first delay time, dt2 is the second delay time, the first delay time is related to the business processing capability of the first application, and the second delay time is related to the business processing capability of the second application; the set window period is determined based on the window deadline time and the window length, or the set window period is determined based on the window start time and the window length, and the window length is determined based on the business processing capabilities of the first application and the second application.
2. The method according to claim 1, wherein The method further comprises: In the case where the set window period is determined according to the window deadline and window length, setting the window deadline required for obtaining the result data; or, In a case where the set window period is determined according to the window start time and the window length, the window start time required for obtaining result data is set.
3. The method according to claim 2, wherein The window length is determined based on service processing capabilities of the first application and the second application, including: determining a first delay time according to a first service processing capability of the first application; determining a second delay time according to a second service processing capability of the second application; The window length is determined according to the first delay time, the second delay time, the first service processing capability, and the second service processing capability.
4. The method according to claim 3, wherein The window length satisfies the following form: Among them, lt is the window length, tps1 is the first service processing capability, tps2 is the second service processing capability, dt1 is the first delay time, and dt2 is the second delay time.
5. The method according to claim 1, wherein Before acquiring the first result data from the first storage area at the first triggering moment, the method further includes: Inputting each business data into the first application and the second application simultaneously; The first result data processed by the first application is stored in the first storage area; and the second result data processed by the second application is stored in the second storage area.
6. The method according to any one of claims 1 to 5, characterized in that Comparing the first result data with the second result data, and if it is determined that the first result data is consistent with the second result data, confirming that the update of the first application by the second application meets the requirement of functional consistency, includes: Based on a key-value storage method, each data in the first result data and the second result data is used as a key; For each data in the first result data and the second result data, the number of times the data appears in the first result data is used as the first value of the key corresponding to the data, and the number of times the data appears in the second result data is used as the second value of the key corresponding to the data; If the first value and the second value corresponding to any key are the same, it is confirmed that the update of the first application by the second application meets the requirement of functional consistency.
7. A device for detecting streaming applications, characterized in that: include: An acquiring unit, configured to acquire first result data from the first storage area at a first triggering moment; The first result data is data obtained after the first application processes the business data generated within the set window period; The result data stored in the first storage area is unbounded result data obtained by the first application processing the first business data, and the first result data is bounded result data; The first result data carries the same generation time as the corresponding business data; The first business data is streaming data; second result data is obtained from the second storage area at the second trigger time; the second result data is data obtained after the second application processes the business data generated within the set window period; The second result data carries the same generation time as the corresponding business data; The result data stored in the second storage area is unbounded result data obtained by the second application processing the first business data, and the second result data is bounded result data; The second application is an updated application for the first application; a processing unit, configured to compare the first result data with the second result data, and if it is determined that the first result data is consistent with the second result data, confirm that the update of the first application by the second application meets the requirement of functional consistency; The first triggering moment and the second triggering moment satisfy the following form: Among them, wt1 is the first trigger moment, wt2 is the second trigger moment, et is the deadline of the set window period, dt1 is the first delay time, dt2 is the second delay time, the first delay time is related to the business processing capability of the first application, and the second delay time is related to the business processing capability of the second application; the set window period is determined based on the window deadline time and the window length, or the set window period is determined based on the window start time and the window length, and the window length is determined based on the business processing capabilities of the first application and the second application.
8. A computing device, characterized in that The system comprises at least one processor and at least one memory, wherein the memory stores a computer program, and when the program is executed by the processor, the processor executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The device stores a computer program executable by a computing device, and when the program is run on the computing device, the computing device is caused to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Test method and device
CN110263551A
Business log processing method and system
CN111526060A