CN115687283A - Log-based playback method and device, electronic equipment and medium - Google Patents
Log-based playback method and device, electronic equipment and medium Download PDFInfo
- Publication number
- CN115687283A CN115687283A CN202211370555.6A CN202211370555A CN115687283A CN 115687283 A CN115687283 A CN 115687283A CN 202211370555 A CN202211370555 A CN 202211370555A CN 115687283 A CN115687283 A CN 115687283A
- Authority
- CN
- China
- Prior art keywords
- playback
- log data
- played back
- preset
- log
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 71
- 238000007619 statistical method Methods 0.000 claims abstract description 21
- 238000012545 processing Methods 0.000 claims description 53
- 238000004590 computer program Methods 0.000 claims description 16
- 238000003860 storage Methods 0.000 claims description 15
- 238000007781 pre-processing Methods 0.000 claims description 8
- 238000012163 sequencing technique Methods 0.000 claims description 6
- 238000009826 distribution Methods 0.000 claims description 3
- 238000012360 testing method Methods 0.000 description 15
- 230000008569 process Effects 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000001174 ascending effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000002950 deficient Effects 0.000 description 1
- 238000000586 desensitisation Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a playback method, a playback device, electronic equipment and a medium based on logs, wherein the method comprises the following steps: obtaining log data to be played back, wherein the log data to be played back are arranged based on service types; according to the arrangement sequence of the log data to be played back, sequentially playing back the log data to be played back of the corresponding service type based on the preset playback parameters of each service type to obtain a playback result; and carrying out statistical analysis on the playback result according to a statistical configuration table to obtain a playback statistical result. By utilizing the method, the log data to be played back of the corresponding service types are played back sequentially based on the preset playback parameters of the service types, so that the playback sequence of the log data to be played back is ensured, and the playback coverage rate is improved while different systems are connected.
Description
Technical Field
The present invention relates to the field of test technologies, and in particular, to a method and an apparatus for log-based playback, an electronic device, and a medium.
Background
With the rapid development of services and the upgrading of technologies, some systems often need to be reconfigured or substantially modified. It is therefore a major challenge for the tester how to guarantee the quality of the new system.
Some existing technical schemes ensure the system quality by carrying out regression testing of total transaction, but the scheme has large requirement on human input, and covered test data and scenes are limited, so that the consistency of new and old systems under the same data cannot be completely ensured, and the test is insufficient. In addition, some existing solutions construct a set of log playback solutions for a specific system or a specific test scenario, and the popularization and portability are not strong.
Disclosure of Invention
The invention provides a playback method, a playback device, electronic equipment and a playback medium based on logs, which are used for improving the playback coverage rate while different systems are docked.
According to an aspect of the present invention, there is provided a log-based playback method including:
obtaining log data to be played back, wherein the log data to be played back are arranged based on the service type;
according to the arrangement sequence of the log data to be played back, sequentially playing back the log data to be played back of the corresponding service type based on the preset playback parameters of each service type to obtain a playback result;
and carrying out statistical analysis on the playback result according to a statistical configuration table to obtain a playback statistical result.
According to another aspect of the present invention, there is provided a log-based playback apparatus including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring log data to be played back, and the log data to be played back are arranged based on the service type;
the playback module is used for sequentially playing back the log data to be played back of the corresponding service types based on the preset playback parameters of the service types according to the arrangement sequence of the log data to be played back to obtain a playback result;
and the statistical analysis module is used for performing statistical analysis on the playback result according to the statistical configuration table to obtain a playback statistical result.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the log-based playback method of any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the log-based playback method according to any one of the embodiments of the present invention when the computer instructions are executed.
The embodiment of the invention provides a playback method, a playback device, electronic equipment and a medium based on logs, wherein the method comprises the following steps: obtaining log data to be played back, wherein the log data to be played back are arranged based on the service type; according to the arrangement sequence of the log data to be played back, sequentially playing back the log data to be played back of the corresponding service type based on the preset playback parameters of each service type to obtain a playback result; and carrying out statistical analysis on the playback result according to a statistical configuration table to obtain a playback statistical result. By utilizing the technical scheme, the log data to be played back of the corresponding service types are played back sequentially based on the preset playback parameters of each service type, so that the playback sequence of the log data to be played back is ensured, and the playback coverage rate is improved while different systems are connected.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a log-based playback method according to an embodiment of the present invention;
fig. 2 is a flowchart of a log-based playback method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a log-based playback method according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram of a scenario for converting original log data according to a second embodiment of the present invention;
fig. 5 is a schematic view of a scenario where log data to be currently played back is played back according to a second embodiment of the present invention;
fig. 6 is a schematic structural diagram of a log-based playback apparatus according to a third embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the 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 obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of a log-based playback method according to an embodiment of the present invention, where the embodiment is applicable to a case where a log is played back, and the method may be executed by a log-based playback apparatus, which may be implemented in hardware and/or software, and may be configured in an electronic device.
With the rapid development of banking business and the updating of technology, some systems often encounter bottlenecks, so that the systems need to be reconstructed or greatly modified. Generally, the reconstructed system is important and sensitive in service, because the peak value of daily average transaction can reach millions of users facing to tens of millions of users, the requirement on performance is high, meanwhile, a plurality of third-party systems and different channels are involved, and the service scene is complex, so that it is a great challenge for testers to ensure the quality of a new system.
The quality of the system can be guaranteed through the regression testing of the total transaction in the existing technical scheme, but the scheme is large in manpower input requirement, and the covered testing data and scenes are limited, so that the consistency of the new system and the old system under the same data cannot be completely guaranteed, and the testing is insufficient.
In addition, due to the diversity of system service execution in a bank, the format of a transaction log, the playback execution mode and the execution result verification method are not uniform, the existing playback tool can only be applied to one specific system, and the compatibility and portability are not high.
Based on this, the embodiment of the present invention provides a log-based playback method, which can perform unified data processing, service processing, playback execution and result statistics on diverse log data through configuration rules, so that different systems can be directly applied, and meanwhile, the test time is greatly shortened, and the test efficiency is improved. As shown in fig. 1, the method includes:
s110, obtaining log data to be played back, wherein the log data to be played back are arranged based on the service type.
The log data to be played back can be regarded as log data needing to be played back, and the number of the log data to be played back is not limited, and can be one or more; the log data to be played back may be log data of different service types, and when the number of the log data to be played back is multiple, the log data to be played back may be arranged based on the service types.
In this embodiment, log data to be played back may be first obtained to perform subsequent playback, where the method for obtaining the log data to be played back is not limited, for example, the log data to be played back may be directly obtained from other electronic devices, or the log data to be played back obtained after the electronic device processes the original log data may also be obtained, and this embodiment is not limited thereto.
And S120, according to the arrangement sequence of the log data to be played back, sequentially playing back the log data to be played back of the corresponding service type based on the preset playback parameters of each service type to obtain a playback result.
The preset playback parameters may refer to preset playback parameters, which are used for playing back log data to be played back, for example, the preset playback parameters may include preset playback environment parameters and/or preset thread number; the preset playback parameters corresponding to different service types may be the same or different, and the specific content may be set by related personnel. The playback result can be regarded as a result of playing back the log data to be played back.
In one embodiment, the preset playback parameters include preset playback environment parameters corresponding to each service type, and the preset playback environment parameters include playback address parameters and/or playback port parameters.
The preset playback environment parameter may be understood as a parameter characterized by a preset playback environment, for example, the preset playback environment parameter may include a playback address parameter and/or a playback port parameter, where the playback address parameter is used to characterize an IP address for playing back log data to be played back, and the playback port parameter is used to characterize a port for playing back the log data to be played back.
Specifically, after the log data to be played back is obtained, the log data to be played back of the same service type can be played back in sequence based on the preset playback parameters of each service type according to the arrangement sequence of the log data to be played back, so as to obtain a playback result, the specific playback process is not limited, and the specific playback process can be determined according to actual conditions.
S130, performing statistical analysis on the playback result according to the statistical configuration table to obtain a playback statistical result.
The statistical configuration table may be considered as a preset table, and is used for performing statistical analysis on the playback result to obtain a playback statistical result. The playback statistical result may refer to a result obtained by performing statistical analysis on the playback result, and if the statistical configuration table may include correctness of playback results corresponding to parameters in different playback results, the playback statistical result may include correctness of the playback results, and the like.
In this step, the obtained playback result may be statistically analyzed according to the statistical configuration table, so as to obtain the playback statistical result, where a specific process of obtaining the playback statistical result is not limited, for example, different playback results may correspond to different statistical analysis processes.
The log-based playback method provided by the embodiment of the invention is used for acquiring log data to be played back, wherein the log data to be played back are arranged based on service types; according to the arrangement sequence of the log data to be played back, sequentially playing back the log data to be played back of the corresponding service type based on the preset playback parameters of each service type to obtain a playback result; and carrying out statistical analysis on the playback result according to a statistical configuration table to obtain a playback statistical result. By utilizing the method, the log data to be played back of the corresponding service types are played back sequentially based on the preset playback parameters of the service types, so that the playback sequence of the log data to be played back is ensured, and the playback coverage rate is improved while different systems are connected.
In one embodiment, before the obtaining of the log data to be played back, the method further includes:
and preprocessing the original log data based on a preset service processing table to obtain the log data to be played back.
The service processing table may be understood as a pre-configured table, and is used to pre-process the original log data to obtain the log data to be played back. The raw log data may refer to raw unprocessed log data, e.g., the raw log data may be log data generated in a production or testing environment.
Specifically, in this step, the original log data may be preprocessed based on a preset service processing table to obtain the log data to be played back, and the specific means of the preprocessing is not limited as long as the log data to be played back can be obtained.
In one embodiment, the service processing table includes a data processing table and a service configuration table, and the pre-processing the original log data based on the preset service processing table to obtain the log data to be played back includes:
converting the original log data into log data to be sorted in a preset format based on the data processing table;
and sequencing the log data to be sequenced according to the sequencing rule in the service configuration table to obtain the log data to be played back.
It can be considered that different systems have different ways of storing log data, for example, the sent and returned messages and information can be stored in one log file, or in different database log tables; the modes of sending interface messages by different systems are also different, for example, the protocol of the sending interface can be HTTP or TCP; in addition, the message types are also different, such as JSON or XML.
In this embodiment, the data processing table may be configured to convert the format of the original log data into a preset format, where the preset format may be a format preset by a relevant person, for example, the preset format is a log table structure for subsequent processing. The log data to be sorted is the log data obtained by converting the original log data into a preset format.
The service configuration table may include a sorting rule for sorting log data of different service types. The sorting rule may refer to an execution sequence of log data of different service types, which is preset according to the service dependency relationship.
In one embodiment, the original log data may be first converted into log data to be sorted in a preset format based on the data processing table, and then the log data to be sorted is sorted according to a sorting rule in the service configuration table to obtain the log data to be played back, so as to play back the subsequent log data to be played back.
In an embodiment, the performing a statistical analysis on the playback result according to a statistical configuration table to obtain a playback statistical result includes:
determining a return code parameter in the playback result;
and determining whether the playback result is correct and description information when the playback result is incorrect as the playback statistical result based on the statistical configuration table and the return code parameter.
The return code parameter may refer to a parameter returned after the log data to be played back is played back, and is used to represent a result of playing back the log data to be played back, for example, the return code parameter may include a return code and a return code description corresponding to the return code, the return code may be understood as a code returned after the playback, and the return code description is used to describe and describe the return code.
In this embodiment, after the playback result is obtained, the return code parameter in the playback result may be determined first, and then whether the playback result is correct and the description information when the playback result is incorrect may be determined based on the statistics configuration table and the return code parameter, so as to serve as the playback statistics result.
Example two
Fig. 2 is a flowchart of a log-based playback method according to a second embodiment of the present invention, and the second embodiment is optimized based on the foregoing embodiments. In this embodiment, the preset playback parameter includes a preset thread number; when the number of the preset threads is greater than or equal to 2, the log data to be played back of the corresponding service type are played back in sequence based on the preset playback parameters of each service type according to the arrangement sequence of the log data to be played back, and the playback result is further embodied as follows: for each service type, based on the current log number and preset playback parameters of the current service type, playing back the current log data to be played back by using threads with the preset thread number to obtain a playback result, wherein the current log data to be played back is the log data to be played back of the current service type, and the current log number is the number of the current log data to be played back.
Please refer to the first embodiment for a detailed description of the present embodiment.
As shown in fig. 2, the method includes:
s210, obtaining log data to be played back, wherein the log data to be played back are arranged based on the service type.
S220, for each service type, based on the current log number and preset playback parameters of the current service type, playing back the current log data to be played back by using threads with preset thread number to obtain a playback result, wherein the current log data to be played back is the log data to be played back of the current service type, and the current log number is the number of the current log data to be played back.
The current log data to be played back can refer to the log data to be played back of the service type corresponding to the current period, and the current service type is the service type corresponding to the current period; the current log number may be regarded as the number of log data to be currently played back.
In this embodiment, the preset playback parameter may include a preset number of threads, and the preset number of threads may be a preset number of threads, which is used to play back the current log data to be played back. The predetermined number of threads may be determined based on empirical values, and is not further limited herein.
Specifically, for each service type, based on the current log number and preset playback parameters of the current service type, the current log data to be played back can be played back by using threads with the preset thread number to obtain a playback result, for example, corresponding number of current log data to be played back can be allocated to each thread according to the current log number and the preset thread number, and then multithread playback is performed to obtain a playback result; after distributing the corresponding amount of current log data to be played back for each thread, each thread plays back the respective current log data to be played back in batches until each thread finishes playing back the respective current log data to be played back.
In an embodiment, the playing back the current log data to be played back by using threads with a preset thread number based on the current log number and the preset playback parameter of the current service type to obtain a playback result includes:
determining an allocation transaction number based on the current log number and the preset thread number, wherein the allocation transaction number is the number of current log data to be played back allocated to each thread;
and distributing the current log data to be played back to each thread for playback according to the distribution transaction number to obtain a playback result.
The allocation transaction amount may refer to the amount of log data to be played back currently allocated to each thread.
In this embodiment, the number of current log data to be played back, which is allocated to each thread, may be determined based on the current log number and the preset thread number; and then distributing the current log data to be played back to each thread for playback according to the distributed transaction number to obtain a playback result, wherein the step of determining the distributed transaction number is not limited, and the distributed transaction number can be determined by calculating the current log number and the preset thread number.
In one embodiment, the preset playback parameter may further include a preset log block size, and the preset log block size may be understood as a size of the log data to be played back, which is read each time by each thread.
Specifically, each thread may read and play back in batch during the process of playing back the log data to be played back of the allocated transaction amount, for example, the thread 1 may read and play back the first batch of log data to be played back of the preset log block size, and then read and play back the next batch of log data to be played back of the preset log block size until the thread 1 finishes playing back all the current log data to be played back of the allocated transaction amount.
And S230, carrying out statistical analysis on the playback result according to the statistical configuration table to obtain a playback statistical result.
According to the log-based playback method provided by the embodiment of the invention, the current log data to be played back is subjected to multi-thread playback by adopting threads with the preset thread number according to each service type, so that the playback efficiency is further improved.
The following describes an exemplary log-based playback method provided by this embodiment:
fig. 3 is a schematic structural diagram of a log-based playback method according to a second embodiment of the present invention, and as shown in fig. 3, historical log data of an old system can be obtained from a production environment or a test environment, and after data processing and service processing are performed in sequence according to a configuration rule defined by each module, transaction playback is performed in a multi-thread manner in the test environment of a new system, and a playback result is displayed to verify that the function of the new system is not defective.
The playback master control table is used as an entrance to control the processing rules of each module in the playback process of each batch of each system, and is connected with the data processing table, the service configuration table, the playback environment table, the playback parameter table and the statistical configuration table through template numbers, the processing rules of each module can define a template through a corresponding configuration table, for example, a set of rules for data processing can be defined through an interface, corresponding data can be stored in the data processing table in the form of the template, and when a playback request of a certain batch of the system is initiated, the template can be selected to define the rules for data processing. (primary keys of each table are marked by).
The following table is a total playback control table provided in this embodiment, and for different batches of playback of different systems, different templates may be configured to perform data processing, service processing, playback execution (environment and parameter setting), and playback result statistics, for example, a data processing number in this table corresponds to a template number in a data processing table, and so on.
Specifically, the specific implementation of each module is described as follows:
(1) A data processing module: firstly, sensitive field desensitization treatment can be carried out on a log data source (namely original log data) generated in a production or test environment, the log data source is extracted and preprocessed according to configuration rules in a data processing table, invalid data is removed, and a log table structure which is unified for service processing is stored in a log playback database (namely the original log data is converted into log data to be sequenced in a preset format based on the data processing table).
It is believed that, the bank system generally sends a packaged interface message when executing a transaction, then checks the execution result through a return message, and stores the sent and returned messages and other information in the form of logs, and different systems store logs in different ways. The present embodiment can uniformly normalize various differences of data processing into a template, and a user can define different processing rules through the template, such as sending a data source name representation: sending an original log file name or a database table name stored in the interface message; sending interface log ID element name representation: and the element names represent the log numbers stored after the interface messages are sent every time in the data sending source.
The following table is a data processing table provided in this embodiment, and it can be seen that different template names represent different log data sources.
Specifically, fig. 4 is a schematic view of a scenario for converting original log data according to the second embodiment of the present invention, and as shown in fig. 4, in this step, log data in a single log file or a dual-log database table can be unified into a log table structure for service processing and stored in a log playback database.
(2) A service processing module: according to the service execution sequence in the service configuration table, the log data (namely the log data to be sorted) in the transaction log table after data processing is screened and sorted according to the service sequence, and is stored in a new database table to be replayed and executed again, and the starting and ending row positions of all transactions of different services are marked, so that all transactions of one service can be conveniently replayed by a multithreading scheduling algorithm submodule each time in the replay process (namely, the log data to be sorted is sorted according to the sorting rule in the service configuration table, and the log data to be replayed is obtained).
It can be understood that each service is distinguished by a transaction code, a user can extract the sequence of service execution according to the service dependency relationship, and the sequence of the simultaneously executed services is randomly arranged, for example, the execution sequence with strong dependency relationship: the service 1- > service 2- > service 5, and the service 3 and the service 4 can be executed simultaneously with the service 1, the service 2 and the service 3, so that the execution sequence of the service 1- > service 2- > service 3- > service 4- > service 5 can be defined, and the execution sequence of the service 1- > service 3- > service 2- > service 4- > service 5 can also be defined. The following table is a service configuration table provided in this embodiment, and the execution sequence of different services is configured in the service configuration table.
Number (x) | Template number | Order of execution of services | Business transaction code name | Name of |
1 | 1 | 1 | 00012 | Sign-on |
2 | 1 | 2 | 02307 | Transfer of |
3 | 1 | 3 | 03456 | Query |
4 | 1 | 4 | 33332 | Reduction of |
(3) A playback module: aiming at a log table with a transaction sequence arranged after service processing (namely log data to be replayed, wherein the log data to be replayed are arranged based on service types), multithreading concurrent replay is performed on all transactions of one service each time according to the service sequence, and multithreading replay is performed on all transactions of the next service when all the transactions of the service are completely replayed until all the transactions of all the services are completely executed (namely, according to the arrangement sequence of the log data to be replayed, the log data to be replayed of the corresponding service types are replayed sequentially based on preset replay parameters of the service types to obtain replay results). For example, the multithread playback can be performed through a preset playback environment table (that is, the preset playback parameters include preset playback environment parameters corresponding to each service type) and a playback parameter table (that is, the preset playback parameters include a preset thread number).
Wherein, each service can be distinguished by transaction code, and the user can set the execution environment of different services. The following table is a playback environment table provided in this embodiment, and may set execution environments corresponding to different service types, such as a playback IP address (i.e., a playback address parameter) and a playback port (i.e., a playback port parameter).
Number of | Template number | Business transaction code name | Playback of IP | Playback port | |
1 | 1 | 00012 | 1.22.333.444 | 19800 | |
2 | 1 | 02307 | 1.22.333.444 | 19888 | |
3 | 1 | 03456 | 1.22.333.445 | 19999 | |
4 | 1 | 33332 | 1.22.333.445 | 19999 |
In one embodiment, different playback parameters may also be defined, such as the number of threads played back (i.e. the preset number of threads), the log file block size (i.e. the preset log size), the traffic transaction code TOP N of the playback error, the return code TOP N of the playback error, and so on. The following table is a playback parameter table provided in this embodiment, so that different playback parameters can be set.
Specifically, the multithread playback method for a service may be as follows: assuming that the current service has N transactions (i.e., the current log number), M threads (i.e., the preset thread number) are configured, the available remainded = mod (N, M), avg = (N-remainded)/M, if remainded =0, avg transactions (i.e., the transaction number) are allocated to each thread, and the allocation is performed in an ascending order according to the transaction IDs, i.e., thread 1 is responsible for transaction 1 to transaction avg, and thread 2 is responsible for transaction avg +1 to transaction 2 avg. If the remaining is not equal to 0, avg +1 transactions are distributed to each thread from the thread 1, the remaining is reduced by 1 until the remaining is reduced to 0, and then avg transactions are distributed to the remaining threads until the thread M (namely, the transaction quantity is determined to be distributed based on the current log quantity and the preset thread quantity, and the current log data to be replayed is distributed to each thread for replaying according to the distributed transaction quantity to obtain a replay result).
The transaction data distributed to the threads can also be cut into blocks with similar sizes (the block sizes can be configured by the log file block parameters of the playback parameter table), so that the transaction data can be read into the memory in batches each time and added into the corresponding thread queue for playback.
Fig. 5 is a schematic view of a scenario that plays back log data to be played back currently according to a second embodiment of the present invention, as shown in fig. 5, when the total number of transactions is 1003 (i.e., the current log number), the thread number is 4 (i.e., the preset thread number), and the block size is 100 (i.e., the preset log size), the main thread allocates 1003 transactions to 4 threads according to a scheduling algorithm, each thread can read 100 transaction information (i.e., the preset log size) to a memory and load the transaction information into a thread queue for playback at a time, and 100 transactions are loaded after playback is completed until all transactions allocated to the thread are completed, and the thread is stopped.
(4) A playback statistics module: and judging whether the playback result is correct or not according to the configuration information of the return code, and displaying and analyzing the playback result in multiple dimensions (namely determining the return code parameter in the playback result; and determining whether the playback result is correct or not and description information when the playback result is incorrect as the playback statistical result based on the statistical configuration table and the return code parameter). For example, the playback statistics at the thread level may be shown, and the playback indexes in each thread and the total threads, such as the total number of executed transactions, the total number of successful transactions, the execution start-stop time, the success rate, and the throughput, may be shown in the form of a table.
In one embodiment, a failure transaction list played back in each batch can be displayed, and the failure transaction list comprises information such as a log number, a service transaction code, a historical return code, a current return code, a sending message, a historical return message, a current return message and a common reason of the return code, wherein the common reason of the return code can display the description information of the return code in a statistical configuration table, help a user to analyze and playback error reasons, support classification and display of error codes, and help the user to quickly locate problems. As the test experience accumulates, the user can configure the return code description in the configuration table according to the error code description document or historical experience, so that the usability of the playback method is improved.
It can be seen that the log-based playback method provided by this embodiment provides a standardized configuration template for each module, that is, by customizing a configuration rule, it can support processing different log data sources of different banking systems into a unified playback format; the method supports multithread playback execution and still maintains the dependency order of the services; different systems are supported to play back simultaneously; different services of the same system are supported to be played back in different environments; the method supports intelligent classification and processing of the playback result, and helps a user to quickly locate the problem. Therefore, the method has strong practicability, usability, flexibility and popularization.
EXAMPLE III
Fig. 6 is a schematic structural diagram of a playback apparatus based on a log according to a third embodiment of the present invention. As shown in fig. 6, the apparatus includes:
an obtaining module 310, configured to obtain log data to be played back, where the log data to be played back are arranged based on a service type;
the playback module 320 is configured to play back the log data to be played back of the corresponding service types based on the preset playback parameters of each service type in sequence according to the arrangement sequence of the log data to be played back, so as to obtain a playback result;
and the statistical analysis module 330 is configured to perform statistical analysis on the playback result according to the statistical configuration table to obtain a playback statistical result.
In the playback device based on the log provided by the third embodiment of the present invention, log data to be played back is obtained through the obtaining module 310, and the log data to be played back is arranged based on the service type; the log data to be played back of the corresponding service types are played back sequentially based on preset playback parameters of the service types according to the arrangement sequence of the log data to be played back through the playback module 320, and a playback result is obtained; and performing statistical analysis on the playback result through a statistical analysis module 330 according to a statistical configuration table to obtain a playback statistical result. By utilizing the device, the log data to be played back of the corresponding service types are played back sequentially based on the preset playback parameters of each service type, so that the playback sequence of the log data to be played back is ensured, and the playback coverage rate is improved while different systems are connected.
Optionally, a log-based playback apparatus provided in the third embodiment of the present invention further includes:
and the preprocessing module is used for preprocessing the original log data based on a preset service processing table before the log data to be played back is obtained, so as to obtain the log data to be played back.
Optionally, the service processing table includes a data processing table and a service configuration table, and the preprocessing module is specifically configured to:
converting the original log data into log data to be sorted in a preset format based on the data processing table;
and sequencing the log data to be sequenced according to the sequencing rule in the service configuration table to obtain the log data to be played back.
Optionally, the preset playback parameters include preset playback environment parameters corresponding to each service type, and the preset playback environment parameters include playback address parameters and/or playback port parameters.
Optionally, the preset playback parameter includes a preset thread number;
when the preset number of threads is greater than or equal to 2, the playback module 320 includes:
and the playback unit is used for playing back the current log data to be played back by adopting threads with the preset thread number according to each service type based on the current log number and the preset playback parameters of the current service type to obtain a playback result, wherein the current log data to be played back is the log data to be played back of the current service type, and the current log number is the number of the current log data to be played back.
Optionally, the playback unit is specifically configured to:
determining an allocation transaction number based on the current log number and the preset thread number, wherein the allocation transaction number is the number of current log data to be played back allocated to each thread;
and distributing the current log data to be played back to each thread for playback according to the distribution transaction number to obtain a playback result.
Optionally, the statistical analysis module 330 is specifically configured to:
determining a return code parameter in the playback result;
and determining whether the playback result is correct and description information when the playback result is incorrect as the playback statistical result based on the statistical configuration table and the return code parameter.
The log-based playback device provided by the embodiment of the invention can execute the log-based playback method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
FIG. 7 illustrates a block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 7, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to the bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The processor 11 performs the various methods and processes described above, such as method log-based playback.
In some embodiments, the method log-based playback may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the log-based playback of the above-described method may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the method log-based playback by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the Internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A method for log-based playback, comprising:
obtaining log data to be played back, wherein the log data to be played back are arranged based on the service type;
according to the arrangement sequence of the log data to be played back, sequentially playing back the log data to be played back of the corresponding service type based on the preset playback parameters of each service type to obtain a playback result;
and carrying out statistical analysis on the playback result according to a statistical configuration table to obtain a playback statistical result.
2. The method according to claim 1, wherein before the obtaining the log data to be played back, the method further comprises:
and preprocessing the original log data based on a preset service processing table to obtain the log data to be played back.
3. The method according to claim 2, wherein the service processing table includes a data processing table and a service configuration table, and the pre-processing the original log data based on the preset service processing table to obtain the log data to be played back includes:
converting the original log data into log data to be sorted in a preset format based on the data processing table;
and sequencing the log data to be sequenced according to the sequencing rule in the service configuration table to obtain the log data to be played back.
4. The method according to claim 1, wherein the preset playback parameters include preset playback environment parameters corresponding to each service type, and the preset playback environment parameters include playback address parameters and/or playback port parameters.
5. The method of claim 1, wherein the preset playback parameters comprise a preset number of threads;
when the number of the preset threads is greater than or equal to 2, the log data to be played back of the corresponding service type are played back in sequence based on the preset playback parameters of each service type according to the arrangement sequence of the log data to be played back, and a playback result is obtained, including:
for each service type, based on the current log number and preset playback parameters of the current service type, playing back the current log data to be played back by using threads with the preset thread number to obtain a playback result, wherein the current log data to be played back is the log data to be played back of the current service type, and the current log number is the number of the current log data to be played back.
6. The method according to claim 5, wherein the playing back the log data to be played back by using threads with a preset thread number based on the preset playback parameters of the current log number and the current service type to obtain a playback result comprises:
determining an allocation transaction number based on the current log number and the preset thread number, wherein the allocation transaction number is the number of current log data to be played back allocated to each thread;
and distributing the current log data to be played back to each thread for playback according to the distribution transaction number to obtain a playback result.
7. The method of claim 1, wherein the performing a statistical analysis on the playback result according to a statistical configuration table to obtain a playback statistical result comprises:
determining a return code parameter in the playback result;
and determining whether the playback result is correct and description information when the playback result is incorrect as the playback statistical result based on the statistical configuration table and the return code parameter.
8. A log-based playback apparatus, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring log data to be played back, and the log data to be played back are arranged based on the service type;
the playback module is used for sequentially playing back the log data to be played back of the corresponding service types based on the preset playback parameters of the service types according to the arrangement sequence of the log data to be played back to obtain a playback result;
and the statistical analysis module is used for performing statistical analysis on the playback result according to the statistical configuration table to obtain a playback statistical result.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the log-based playback method of any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to perform the log-based playback method of any one of claims 1-7 when executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211370555.6A CN115687283A (en) | 2022-11-03 | 2022-11-03 | Log-based playback method and device, electronic equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211370555.6A CN115687283A (en) | 2022-11-03 | 2022-11-03 | Log-based playback method and device, electronic equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115687283A true CN115687283A (en) | 2023-02-03 |
Family
ID=85047992
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211370555.6A Pending CN115687283A (en) | 2022-11-03 | 2022-11-03 | Log-based playback method and device, electronic equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115687283A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117992240A (en) * | 2024-04-03 | 2024-05-07 | 本原数据(北京)信息技术有限公司 | Data processing method, device, computer equipment and storage medium |
-
2022
- 2022-11-03 CN CN202211370555.6A patent/CN115687283A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117992240A (en) * | 2024-04-03 | 2024-05-07 | 本原数据(北京)信息技术有限公司 | Data processing method, device, computer equipment and storage medium |
CN117992240B (en) * | 2024-04-03 | 2024-07-09 | 本原数据(北京)信息技术有限公司 | Data processing method, device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8606905B1 (en) | Automated determination of system scalability and scalability constraint factors | |
CN110933147B (en) | Information technology analysis system based on cloud computing | |
CN109408361A (en) | Monkey tests restored method, device, electronic equipment and computer readable storage medium | |
CN112130781A (en) | Log printing method and device, electronic equipment and storage medium | |
CN115757150A (en) | Production environment testing method, device, equipment and storage medium | |
CN115687283A (en) | Log-based playback method and device, electronic equipment and medium | |
CN111782502A (en) | Automatic testing method and device | |
CN113010310B (en) | Method, device and server for processing job data | |
CN116204428A (en) | Test case generation method and device | |
CN110795308A (en) | Server inspection method, device, equipment and storage medium | |
CN115794744A (en) | Log display method, device, equipment and storage medium | |
CN111752677A (en) | Cloud resource configuration method, system, terminal and storage medium | |
CN113282471B (en) | Equipment performance testing method and device and terminal equipment | |
CN109471764B (en) | Method, device, terminal and storage medium for quickly reading system information | |
CN115525521A (en) | Log data verification method and device, electronic equipment, storage medium and product | |
CN115454800A (en) | Log data verification method and device, electronic equipment, storage medium and product | |
CN116319331A (en) | Method, device, medium and equipment for issuing DNS (Domain name System) resolution configuration information in batches | |
CN114357783A (en) | Simulation method, device, equipment and medium for semiconductor production | |
CN116414714A (en) | Interface test parameter optimization method, equipment and medium | |
CN112463076A (en) | Data export method, computer equipment and storage medium | |
CN117349266A (en) | Data migration and verification method, device, computer equipment and storage medium | |
CN117632138A (en) | Attendance application form analysis method and device, electronic equipment and storage medium | |
CN117112439A (en) | Script testing method, device, equipment and medium based on resource application | |
CN115237561A (en) | Job obtaining method, device, equipment and medium | |
CN115859300A (en) | Vulnerability detection method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |