CN107229564A - A kind of pressure simulation method and device - Google Patents
A kind of pressure simulation method and device Download PDFInfo
- Publication number
- CN107229564A CN107229564A CN201610178441.XA CN201610178441A CN107229564A CN 107229564 A CN107229564 A CN 107229564A CN 201610178441 A CN201610178441 A CN 201610178441A CN 107229564 A CN107229564 A CN 107229564A
- Authority
- CN
- China
- Prior art keywords
- atomic operation
- configuration file
- type
- pressure
- thread
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
Abstract
This application discloses a kind of pressure simulation method and device.Pressure simulation type is obtained, and reads the corresponding configuration file of the analog type;Parse the configuration file and a number of thread is created according to the analysis result of the configuration file;The thread dispatching execute methods, the default atomic operation corresponding with the pressure model is performed according to the analysis result of the configuration file.Realize the simulation of pressure under arbitrarily complicated test scene.
Description
Technical field
The application belongs to computer software testing field, specifically, be related to a kind of pressure simulation method and
Device.
Background technology
In recent years, developing rapidly with Internet technology, unstructured data, big data, cloud storage
Become Information Technology Development trend and focus free from controvery, distributed file system is used as core
Basis has been pulled to the mountain peak of tide, is picked extensively by industrial quarters and academia.
Distributed system is generally made up of network, database, application server some.It is modern
Distributed file system generally has high-performance, high extension, High Availabitity, high-effect, easy use, Yi Guan
The features such as reason.However, it is determined that a distributed system there is above-mentioned advantage before, it is necessary to being
System carries out the test of each side, so as to ensure that system is sufficient for the demand of user.
For distributed system, pressure test is extremely important.One distributed system can be held
It is one of the key factor for weighing this distributed system by great pressure.Therefore, in order to test
It is true, each test pressure device can as far as possible simulation distribution formula cluster produce pressure.
In existing technical scheme, generally file operation is made using the method for testing of limiting pressure
Simulated with mode.Its problem is, with pressure test scene conversion and increase, it is necessary to
Constantly increase pressing creation mode is tested, and is so needed to be continuously increased new exploitation, is caused
The waste of technical resource;At the same time, prior art can not be configured by way of configuring and simulated
Arbitrarily complicated pressure test scene, analog form is more single.
Therefore, a kind of new distributed pressure analogy method and device are urgently proposed.
The content of the invention
In view of this, technical problems to be solved in this application there is provided a kind of pressure simulation method and dress
Put.
In order to solve the above-mentioned technical problem, this application discloses a kind of pressure simulation method, including following step
Suddenly:
Pressure simulation type is obtained, and reads the corresponding configuration file of the analog type;Parsing is described
Configuration file simultaneously creates a number of thread according to the analysis result of the configuration file;The thread is adjusted
Execute methods are used, are performed according to the analysis result of the configuration file corresponding with the pressure model
Default atomic operation.
Wherein, the pressure simulation type includes file type and the action type of file.
Wherein, perform before the default atomic operation corresponding with the pressure model, methods described is also
Including:A kind of a kind of action type of file type is packaged into an atomic operation.
Wherein, a number of thread is created according to configuration file, in addition to:In each thread
Create the object of the class of an atomic operation.
Wherein, parsing the configuration file includes:By execution Analysis on Framework first kind parameter, wherein described
The execution time of first kind parameter including the corresponding current atomic operation of the pressure simulation type, described work as
The execution frequency of preceding atomic operation and the Thread Count created for the current atomic operation.
Wherein, parsing the configuration file includes:Equations of The Second Kind parameter is transferred to described by the execution framework
The object of the class of atomic operation, and the Equations of The Second Kind parameter as described in the analysis of object of the class of the atomic operation.
Wherein, methods described also includes:In the Equations of The Second Kind parameter, institute is described using the mode of distribution
State the parameter of atomic operation.
This application discloses a kind of pressure simulation device, including:
Parameter acquisition module, for obtaining pressure simulation type, and it is corresponding to read the analog type
Configuration file;
Parsing and creation module, for parsing the configuration file and according to the parsing knot of the configuration file
Fruit creates a number of thread;
Pressure generating module, the thread dispatching execute methods, for according to the configuration file
Analysis result performs the default atomic operation corresponding with the pressure model.
Wherein, the pressure simulation type includes file type and the action type of file.
Described device also includes atomic operation package module:The atomic operation package module, for performing
Before the default atomic operation corresponding with the pressure model, a kind of one kind of file type is operated
Type package is into an atomic operation.
The parsing is additionally operable to creation module:The class of an atomic operation is created in each thread
Object.
It is described parsing with creation module specifically for:By execution Analysis on Framework first kind parameter, wherein described
The execution time of first kind parameter including the corresponding current atomic operation of the pressure simulation type, described work as
The execution frequency of preceding atomic operation and the Thread Count created for the current atomic operation.
It is described parsing with creation module specifically for:Equations of The Second Kind parameter is transferred to described by the execution framework
The object of the class of atomic operation, and the Equations of The Second Kind parameter as described in the analysis of object of the class of the atomic operation.
Described device also includes:In the Equations of The Second Kind parameter, the atom is described using the mode of distribution
The parameter of operation.
Compared with prior art, the application can be obtained including following technique effect:
1) use the mode of configuration file for pressure test programming carry out configuration description, can by
The modification for putting file simulates arbitrarily complicated pressure test scene;
2) complicated pressing creation mode is split into different types of atomic operation, and grasped by atom
Any combination of work realizes the pressure test under different scenes, reduces iterative development cost;
3) parameter of atomic operation is described by the way of distribution so that parameter can with dynamic change from
And the pressure that dynamic analog distributed type assemblies are produced, more truly.
Certainly, implementing any product of the application must be not necessarily required to while reaching all the above skill
Art effect.
Brief description of the drawings
Accompanying drawing described herein is used for providing further understanding of the present application, constitutes one of the application
Point, the schematic description and description of the application is used to explain the application, does not constitute to the application's
It is improper to limit.In the accompanying drawings:
Fig. 1 is the techniqueflow chart of the embodiment of the present application one;
Fig. 2 is the techniqueflow chart of the embodiment of the present application two;
Fig. 3 is the techniqueflow chart of the embodiment of the present application three;
Fig. 4 is the apparatus structure schematic diagram of the embodiment of the present application four.
Embodiment
Presently filed embodiment is described in detail below in conjunction with drawings and Examples, thereby to the application
How application technology means can fully understand to solve technical problem and reach the implementation process of technology effect
And implement according to this.
In a typical configuration, computing device include one or more processors (CPU), input/
Output interface, network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory
And/or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory (RAM).
Internal memory is the example of computer-readable medium.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by
Any method or technique come realize information store.Information can be computer-readable instruction, data structure,
The module of program or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory
(PRAM), static RAM (SRAM), dynamic random access memory (DRAM),
Other kinds of random access memory (RAM), read-only storage (ROM), electrically erasable
Read-only storage (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage
(CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape
Magnetic rigid disk is stored or other magnetic storage apparatus or any other non-transmission medium, can be by available for storage
The information that computing device is accessed.Defined according to herein, computer-readable medium does not include non-temporary electricity
The data-signal and carrier wave of brain readable media (transitory media), such as modulation.
Some vocabulary have such as been used to censure specific components among specification and claim.This area skill
Art personnel are, it is to be appreciated that hardware manufacturer may call same component with different nouns.This explanation
Book and claim be not in the way of the difference of title is used as differentiation component, but with component in function
On difference be used as the criterion of differentiation.Such as " the bag in specification in the whole text and claim mentioned in
Containing " it is an open language, therefore " include but be not limited to " should be construed to." substantially " refer to receivable
In error range, those skilled in the art can solve the technical problem, base in the range of certain error
Originally the technique effect is reached.In addition, " coupling " one word is herein comprising any direct and indirect electrically coupling
Take over section.Therefore, if a first device is coupled to a second device described in text, described first is represented
Device can directly be electrically coupled to the second device, or indirectly electric by other devices or coupling means
Property is coupled to the second device.Specification subsequent descriptions is implement the better embodiment of the application, so
The description is for the purpose of the rule for illustrating the application, to be not limited to scope of the present application.
The protection domain of the application is worked as to be defined depending on the appended claims person of defining.
It should also be noted that, term " comprising ", "comprising" or its any other variant be intended to it is non-
It is exclusive to include, so that commodity or system including a series of key elements not only will including those
Element, but also other key elements including being not expressly set out, or also include for this commodity or be
The intrinsic key element of system.In the absence of more restrictions, limited by sentence "including a ..."
Key element, it is not excluded that also there is other identical element in the commodity or system including the key element.
Fig. 1 is the techniqueflow chart of the embodiment of the present application one, with reference to Fig. 1, the embodiment of the present application one kind pressure
Power analogy method, can be realized by the steps:
Step S110:Pressure simulation type is obtained, and reads the corresponding configuration file of the analog type;
Step S120:Parse the configuration file and create certain according to the analysis result of the configuration file
The thread of quantity;
Step S130:The thread dispatching execute methods, according to the analysis result of the configuration file
Perform the default atomic operation corresponding with the pressure model.
It should be noted that in the embodiment of the present application, in advance by each file type once write or read or
Delete or create and be packaged into an atomic operation, for example, existing pressure test file has A, B, C
Three kinds of file types, then for reading and writing, delete, create these four action types, it will obtain 3*4=12
The writing of kind of atomic type, i.e. A files, the writing of B files, the writing of C files, the reading of A files, B texts
The reading of part, the reading of C files, the deletion of A files, the deletion of B files, the deletion of C files, A texts
The establishment of part, the establishment of B files, the establishment of C files etc., totally 12 kinds of pressure test types.
Specifically, in step s 110, pressure simulation type is obtained, the pressure simulation type can be with
It is tester's selection or the configuration of pressure simulation device.Mainly include in pressure simulation type
Which kind of file type the action type of file type and file, i.e., current pressure test is wanted using
Those operations carry out pressure test to current system.Wherein, the action type of file mainly include read,
Write, delete, create, call.Different file types is applied to different read-writes and deletes establishment etc.,
Its performance is different, and the natural pressure produced to system is also different, the writing of the reading, DOC such as TXT
Deng.
It is that it is configured in a corresponding configuration file, configuration file for each pressure simulation type
The pressing creation mode during pressure simulation is described, for example, the corresponding atom behaviour of pressure simulation type
Make type, execution time, perform frequency etc..
Such as:One pressure scene can be expressed as the reading write with 1 B file of 1 A file.
The describing mode of one typical configuration file is exemplified below:
[A_Write]
Class=AWrite
Time=100
Thread=10
Qps=G1 (1,2)
Arg1=G4 (111)
It is configured as above shown in file, the pressure simulation type of two configuration file descriptions is A files respectively
Write.In the configuration file for writing this pressure simulation type of A files, Class=AWrite represents A texts
The object for writing corresponding atomic operation type and the corresponding class of atomic operation of part;Time=100 represents A
The execution time for writing corresponding atomic operation of file;What thread=10 was expressed as A files writes this pressure
The Thread Count that power analog type is created;Qps=G1 (1,2) represents the corresponding atomic operation of writing of A files
Frequency is performed, Arg1=G4 (111) represents the file of the write-in of the corresponding atomic operation of A files upon execution
Length, wherein, one kind distribution of G () function representation would generally return to one after being parsed by distributional class
Numerical value or character string.
Specifically, in the step s 120, being parsed first to the configuration file.In configuration file
Two class parameters are mainly included, when specifically parsing, first first kind parameter is solved by execution framework Frame
Analysis, wherein, the first kind parameter specifically includes the corresponding current atomic operation of the pressure simulation type
Perform time, the executions frequency of the current atomic operation and be the current atomic operation establishment
Thread Count etc..
In this step, when the execution framework Frame results parsed to first kind parameter are included currently
It is the line that the current pressure simulation type creates respective numbers during the Thread Count that atomic operation is created
Journey.
Specifically, after thread is created, the class of an atomic operation is created in each thread
Object, the object of the class of the atomic operation is created according to the pressure simulation type.For example,
When pressure simulation type is " reading of A files ", the object of the class of the atomic operation of establishment is " A
The reading of file ", is designated as classA.The classA can parse the parameter relevant with atomic operation.Cause
This, for the Equations of The Second Kind parameter in configuration file, the execution framework Frame is passed to classA
Parsed.
It should be noted that the Equations of The Second Kind parameter is mainly the demand parameter of atomic operation, including it is current
Length, file size of the file of atomic operation etc..These ginsengs of Dynamic profiling generally by the way of distribution
Number, such as cauchy (Cauchy's distribution), constant (constant distribution), empirical (experiences point
Cloth), exponent (exponential distribution), extreme (the extreme value distribution), geometric (geometry distribution), lognormal
(logarithm normal distribution), normal (normal distribution), poisson (Poisson distribution), uniform is (uniform
Distribution) etc..The parameter of atomic operation is described using these different distributions so that these parameters can
Continuous dynamic change, can simulate different pressing creation modes in the case where once setting,
Test to system is truer, while the time also can be saved, it is to avoid the continuous modification to configuration file.
Specifically, in step 130, each thread of foundation calls current thread when performing
The execute methods of the object of the class of the atomic operation of middle establishment, often call the execute method to be exactly
An atomic operation is performed, that is, completes the pressure simulation of a preset kind.
In the present embodiment, by by the different operating of files in different types be packaged into atomic operation and by with
The mode for putting file carries out configuration description to atomic operation, can be combined into arbitrarily complicated pressure test
Scape;At the same time, the parameter of atomic operation is described by the way of distribution so that the ginseng of atomic operation
Number can dynamic change it is achieved thereby that to the dynamic analog of pressure, realize more real pressure and survey
Examination.
Fig. 2 is the techniqueflow chart of the embodiment of the present application two, with reference to Fig. 2, a kind of pressure simulation of the application
Method can also have following feasible embodiment:
Step S210:The once execution operation of different file types is packaged into an atomic operation.
Wherein, the different file types include that certain pressure can be produced in system operatio and to system
The type of All Files;It is described to perform operation including writing or reading or delete or create or call, certainly,
It should be appreciated that it is all can to file perform operation all should be within protection scope of the present invention.
Step S220:For pressure mould formulation configuration file.
The pressure mode of production for the pressure device for producing simulated pressure is described in the configuration file, institute is parsed
State configuration file can obtain the pressure device carry out pressure simulation when using which kind of pressure simulation type,
The corresponding atomic operation of pressure simulation type, the execution time of atomic operation, execution frequency and the second ginseng
Several transmission object etc..
In the present embodiment, it is assumed that existing file1 the two distinct types of files of file2, its applicable two kinds
Operation be respectively read write.Assuming that file1 read write, file2 reading write the corresponding configuration file difference
Shown as follows:
[file1_write]
Class=A
Qps=G1 (N1)
Thread=20
Time=100
Arg1=G1 (N2)
[file1_read]
Class=B
Qps=G4 (N3)
Thread=10
Time=120
Arg2=G2 (N4)
[file2_read]
Class=C
Qps=G4 (N5)
Thread=20
Time=100
Arg3=G3 (N6)
[file2_write]
Class=D
Qps=G1 (N7)
Thread=20
Time=150
Arg4=G4 (N8)
In file1_write configuration file, to the corresponding atom of write operation of this file type of file1
Operation is A, and after thread is created for file1 write operation, A class is created in each thread
The second parameter in object classA, and the configuration file for parsing file1_write by A;Qps=G1 (N1)
Represent, be distributed to describe the execution frequency of the corresponding atomic operations of file1_write with N1 G1 ();thread
=20, it is expressed as file1_write this pressure simulation 20 processes of establishment;Time=100 is represented
The execution time of the corresponding atomic operations of ile1_write is 100;Arg1=G1 (N2) is represented with N2 G2 () f
It is distributed to describe the file size of the corresponding atomic operations of ile1_write.Wherein, a subatom is often performed
It is straight for pressure device that operation, qps=G1 (N1) and arg1=G1 (N2) can return to a value or character string
Connect and use.
File1_read, file2_read and file2_write configuration file understood with reference to above description,
Do not repeat herein.
It should be noted that in the embodiment of the present application, step S210 and step S220 have no fixed elder generation
Order or first write the encapsulation that configuration file carries out atomic operation again afterwards, above-mentioned substep description is only supplied
Illustrate that explanation is used, the embodiment of the present application is not construed as limiting.
Step S230:Obtain pressure simulation type and read the corresponding configuration text of the pressure simulation type
Part.
In the present embodiment, pressure simulation type can be customized, can be selected by tester.
Assuming that in the present embodiment, test-types are the reading of file1 files and writing for file2 files.When getting
After pressure simulation type, it can be read according to the pressure simulation type in the configuration file finished writing, undertaking
In one step in institute's illustrated example, the present embodiment, reading is file1_read and file2_write.
Step S240:Framework Frame is performed to parse the configuration file and create corresponding line
Journey.
In configuration file, all parameters can not be parsed completely by performing framework, and it is merely able to parsing
Class, qps, thread, tim in part special parameter, i.e. first kind parameter, such as step S220
Deng.In addition to these parameters, also another kind of parameter performs framework Frame and can not directly parsed, i.e.,
Equations of The Second Kind parameter.Frame passes to the Equations of The Second Kind parameter that oneself can not be parsed can be to Equations of The Second Kind parameter
The class parsed, specific transmission object is exactly the class that Frame is parsed.For example, accepting step
S230, performs framework in the analysis result of configuration file, class=A, then Equations of The Second Kind parameter will be by holding
Row framework passes to classA and parsed, such as the arg1=G1 (N2) in file1_write configuration files.
The execution framework Frame is also needed according to parsing in addition to parsing configuration file and Transfer Parameters
The Thread Count that the pressure simulation type arrived is created simulates the thread for creating respective numbers for current pressure.Accept
The read operation that example in step S220 and S230 is file1 creates 20 threads, is file2's
Write operation creates 20 threads.
Step S250:The object of the class of an atomic operation is created in each thread and passes the second parameter
It is handed to the object in each thread;
It is that atomic operation is created in each thread during each atomic operation is a class, the present embodiment
The object of class.The example of previous step is accepted, the read operation for being file1 is created after 20 threads,
ClassA object is created in each thread, and by the second parameter, i.e. arg1=G1 (N2) passes to classA
In object.
Step S260:Each thread, which is performed, calls execute methods to perform corresponding atomic operation.
In this step, the parameter configuration of each thread well after, you can call execute methods, perform
The atomic operation corresponding with the pressure simulation type.For example, the thread of the read operation establishment in file1
In when calling execute methods, execution is the corresponding atomic operation of read operation with file1;Similarly,
If call execute methods in the thread that file2 write operation is created, execution is and file2
The corresponding atomic operation of write operation.
In each thread, it is all to perform an atomic operation often to call an execute method, is repeated
Step S270 is performed until arriving timeout or any exception occur.
It is preferred that, after step S260, the embodiment of the present application may also include step S270 and step
S280。
Step S270:Change pressure simulation type.
Test of the pressure test scene closer to real pressure scene to system anti-pressure ability is more effective, so
And be changeable and ambiguity during real system generation pressure, therefore, the list as shown in above-mentioned step
One pressure test mode can not fully meet testing requirement.In the embodiment of the present application, work as pressure test
When required pressure simulation type modification or increase, and the volume for carrying out test code need not be re-started
Write, it is only necessary to inform that the pressure device for carrying out pressure simulation needs the pressure type simulated that what is.
For example, in the embodiment of the present application, test-types are changed to writing and file1 files for file1 files
Reading and file2 files deletion.
Step S280:Corresponding configuration file is read according to the pressure simulation type.
The configuration file of different pressures analog type has been finished writing, when the pressure mould for knowing pressure test
When intending type, existing configuration file is directly read needed for and is parsed.
The example of previous step is accepted, the configuration file write of file1 files is read according to pressure simulation type
The configuration of the deletion of configuration file file1_read and the file2 file of the reading of file1_write, file1 file
File f ile2_delete.
The step of after step S280 as described in step S240~step S260, do not repeat herein.
Particularly, will be respectively that different types of pressure simulation creates pre- when pressure simulation type increase
If the thread of quantity, and call execute methods to perform corresponding different type in different types of thread
Atomic operation.Accept in above-mentioned example, the present embodiment, by the thread for writing establishment for file1 files
In, call execute methods to perform the atomic operation for writing file1 files, in the reading establishment for file1 files
Thread in, call execute methods perform read file1 files atomic operation, be deleting for file2 files
Except the atomic operation in the thread of establishment, calling execute methods to perform deletion file2 files.
When pressure simulation type changes or be more complicated again, target simulation type only need to be obtained, just may be used
Read corresponding configuration file and perform corresponding atomic operation, so as to pass through different type atomic operation
Any type of pressure simulation is realized in combination.
In the present embodiment, by the way that pressure test to be split into different atomic operations, and by different
The mode that atomic operation is combined realizes the pressure test of different scenes, reduces the exploitation of pressure test
Cost, it is simple and efficient.
Fig. 3 is the techniqueflow chart of the embodiment of the present application three, with reference to Fig. 2, a kind of pressure simulation of the application
Method also has following another feasible embodiment:
Step S310:The once execution operation of different file types is packaged into an atomic operation.
Wherein, the different file types include that certain pressure can be produced in system operatio and to system
The type of All Files;It is described to perform operation including writing or reading or delete or create or call, certainly,
It should be appreciated that it is all can to file perform operation all should be within protection scope of the present invention.
Step S320:For pressure mould formulation configuration file.
The pressure mode of production for the pressure device for producing simulated pressure is described in the configuration file, institute is parsed
State configuration file can obtain the pressure device carry out pressure simulation when using which kind of pressure simulation type,
The corresponding atomic operation of pressure simulation type, the execution time of atomic operation, execution frequency and the second ginseng
Several transmission object etc..
In the present embodiment, it is assumed that existing file1 the two distinct types of files of file2, its applicable two kinds
Operation be respectively read write.Assuming that file1 read write, file2 reading write the corresponding configuration file difference
Shown as follows:
[file1_write]
Class=A
Qps=G1 (N1)
Thread=20
Time=100
Arg1=G1 (N2)
[file1_read]
Class=B
Qps=G4 (N3)
Thread=10
Time=120
Arg2=G2 (N4)
[file2_read]
Class=C
Qps=G4 (N5)
Thread=20
Time=100
Arg3=G3 (N6)
[file2_write]
Class=D
Qps=G1 (N7)
Thread=20
Time=150
Arg4=G4 (N8)
In file1_write configuration file, to the corresponding atom of write operation of this file type of file1
Operation is A, and after thread is created for file1 write operation, A class is created in each thread
The second parameter in object classA, and the configuration file for parsing file1_write by A;Qps=G1 (N1)
Represent, be distributed to describe the execution frequency of the corresponding atomic operations of file1_write with N1 G1 ();thread
=20, it is expressed as file1_write this pressure simulation 20 processes of establishment;Time=100 is represented
The execution time of the corresponding atomic operations of ile1_write is 100;Arg1=G1 (N2) is represented with N2 G2 () f
It is distributed to describe the file size of the corresponding atomic operations of ile1_write.Wherein, a subatom is often performed
It is straight for pressure device that operation, qps=G1 (N1) and arg1=G1 (N2) can return to a value or character string
Connect and use.
File1_read, file2_read and file2_write configuration file understood with reference to above description,
Do not repeat herein.
It should be noted that in the embodiment of the present application, step S310 and step S320 have no fixed elder generation
Order or first write the encapsulation that configuration file carries out atomic operation again afterwards, above-mentioned substep description is only supplied
Illustrate that explanation is used, the embodiment of the present application is not construed as limiting.
Step S330:Obtain pressure simulation type and read the corresponding configuration text of the pressure simulation type
Part.
In the present embodiment, pressure simulation type can be customized, can be selected by tester.
Assuming that in the present embodiment, test-types are the reading of file1 files and writing for file2 files.When getting
After pressure simulation type, it can be read according to the pressure simulation type in the configuration file finished writing, undertaking
In one step in institute's illustrated example, the present embodiment, reading is file1_read and file2_write.
Step S340:Framework Frame is performed to parse the configuration file and create corresponding line
Journey.
In configuration file, all parameters can not be parsed completely by performing framework, and it is merely able to parsing
Class, qps, thread, time in part special parameter, i.e. first kind parameter, such as step S320
Deng.In addition to these parameters, also another kind of parameter performs framework Frame and can not directly parsed, i.e.,
Equations of The Second Kind parameter.Frame passes to the Equations of The Second Kind parameter that oneself can not be parsed can be to Equations of The Second Kind parameter
The class parsed, specific transmission object is exactly the class that Frame is parsed.For example, accepting step
S230, performs framework in the analysis result of configuration file, class=A, then Equations of The Second Kind parameter will be by holding
Row framework passes to classA and parsed, such as the arg1=G1 (N2) in file1_write configuration files.
The execution framework Frame is also needed according to parsing in addition to parsing configuration file and Transfer Parameters
The Thread Count that the pressure simulation type arrived is created simulates the thread for creating respective numbers for current pressure.Accept
The read operation that example in step S320 and S330 is file1 creates 20 threads, is file2's
Write operation creates 20 threads.
Step S350:The object of the class of an atomic operation is created in each thread and passes the second parameter
It is handed to the object in each thread;
It is that atomic operation is created in each thread during each atomic operation is a class, the present embodiment
The object of class.The example of previous step is accepted, the read operation for being file1 is created after 20 threads,
ClassA object is created in each thread, and by the second parameter, i.e. arg1=G1 (N2) passes to classA
In object.
Step S360:Each thread, which is performed, calls execute methods to perform corresponding atomic operation.
In this step, the parameter configuration of each thread well after, you can call execute methods, perform
The atomic operation corresponding with the pressure simulation type.For example, the thread of the read operation establishment in file1
In when calling execute methods, execution is the corresponding atomic operation of read operation with file1;Similarly,
If call execute methods in the thread that file2 write operation is created, execution is and file2
The corresponding atomic operation of write operation.
In each thread, it is all to perform an atomic operation often to call an execute method, is repeated
Step S370 is performed until arriving timeout or any exception occur.
It is preferred that, after step S360, the embodiment of the present application may also include step S370 and step
S380。
Step S370:Change the corresponding configuration file of pressure simulation type.
In this example, it is assumed that such a pressure test scene, during to the test of file1 write operation
Between need lengthen, and test frequency need faster, according to the technical scheme of the embodiment of the present application, it is not necessary to
Again test program is write, need to only be changed in the configuration file of file1 write operation, configuration file
First kind parameter and Equations of The Second Kind parameter can all modify according to the need for test.
The example in step S320 is accepted, the configuration file of file1 write operation can change as follows:
[file1_write]
Class=A
Qps=G1 (N7)
Thread=20
Time=200
Arg1=G1 (N8)
The above-mentioned modification to configuration file, have updated and write the corresponding execution frequency of file1 atomic operations, create
Thread Count, the length etc. that performs time and written document.Of course it is to be understood that above-mentioned modification is only supplied
Citing is used, and the embodiment of the present application is not limited in any way.
In the embodiment of the present application, when the pressing creation mode of the pressure simulation type needed for pressure test is produced
During changing, and writing for progress test code need not be re-started, need to only change corresponding configuration literary
Part is that different scenes, the pressure test of different pressures size can be achieved.
Step S380:Framework Frame is performed to parse the configuration file and create corresponding line
Journey.
In previous step, configuration file is modified to be updated, and in this step, need to be re-read after renewal
Configuration file, and the configuration file after renewal is parsed, so as to produce target according to configuration file
Pressure is tested system.
The step of after step S380 as described in step S350~step S360, do not repeat herein.
In the present embodiment, by changing the corresponding configuration file of different pressures test-types, change pressure mould
The pressure producing method of plan, even if the requirement of pressure test has been changed, without increase new test generation
Code, modification configuration file can simulate the pressure test of any scene.
Fig. 4 is the apparatus structure schematic diagram of the embodiment of the present application four, with reference to Fig. 4, a kind of pressure of the application
Analogue means, including:
Parameter acquisition module 410, for obtaining pressure simulation type, and it is relative to read the analog type
The configuration file answered;
Parsing and creation module 420, for parsing the configuration file and according to the solution of the configuration file
Analyse result and create a number of thread;
Pressure generating module 430, the thread dispatching execute methods, for according to the configuration file
Analysis result perform the default atomic operation corresponding with the pressure model.
Wherein, the pressure simulation type includes file type and the action type of file.
Described device also includes atomic operation package module 440:The atomic operation package module, is used for
Before the execution default atomic operation corresponding with the pressure model, by a kind of one kind of file type
Action type is packaged into an atomic operation.
The parsing is additionally operable to creation module 420:An atomic operation is created in each thread
Class object.
It is described parsing with creation module 420 specifically for:By execution Analysis on Framework first kind parameter, wherein
The first kind parameter includes the execution time of the corresponding current atomic operation of the pressure simulation type, institute
The Thread Count stated the execution frequency of current atomic operation and created for the current atomic operation.
It is described parsing with creation module 420 specifically for:Equations of The Second Kind parameter is transferred to by the execution framework
The object of the class of the atomic operation, and Equations of The Second Kind is joined as described in the analysis of object of the class of the atomic operation
Number.
Described device also includes:In the Equations of The Second Kind parameter, the atom is described using the mode of distribution
The parameter of operation.
Embodiment illustrated in fig. 4 can perform Fig. 1, Fig. 2 and embodiment illustrated in fig. 3 methods described, in fact
Existing principle and technique effect are not repeated.
Some preferred embodiments of the present invention have shown and described in described above, but as it was previously stated, should manage
The solution present invention is not limited to form disclosed herein, is not to be taken as the exclusion to other embodiment,
And available for it is various other combination, modification and environment, and can in invention contemplated scope described herein,
It is modified by the technology or knowledge of above-mentioned teaching or association area.And those skilled in the art are carried out changes
Dynamic and change does not depart from the spirit and scope of the present invention, then all should appended claims of the present invention protection
In the range of.
Claims (14)
1. a kind of pressure simulation method, it is characterised in that including:
Pressure simulation type is obtained, and reads the corresponding configuration file of the analog type;
Parse the configuration file and a number of line is created according to the analysis result of the configuration file
Journey;
The thread dispatching execute methods, according to the analysis result of the configuration file perform with it is described
The corresponding default atomic operation of pressure model.
2. the method as described in claim 1, it is characterised in that
The pressure simulation type includes file type and the action type of file.
3. the method as described in claim 1, it is characterised in that perform relative with the pressure model
Before the default atomic operation answered, methods described also includes:
A kind of a kind of action type of file type is packaged into an atomic operation.
4. the method as described in claim 1 a, it is characterised in that fixed number is created according to configuration file
The thread of amount, in addition to:
The object of the class of an atomic operation is created in each thread.
5. the method as described in claim 1, it is characterised in that the parsing configuration file includes:
By execution Analysis on Framework first kind parameter, wherein the first kind parameter includes the pressure simulation class
Execution time of the corresponding current atomic operation of type, the execution frequency of the current atomic operation and be institute
State the Thread Count that current atomic operation is created.
6. the method as described in claim 4 or 5, it is characterised in that the parsing configuration file bag
Include:
It is described to perform the object that Equations of The Second Kind parameter is transferred to the class of the atomic operation by framework, and by described
Equations of The Second Kind parameter described in the analysis of object of the class of atomic operation.
7. method as claimed in claim 6, it is characterised in that methods described also includes:
In the Equations of The Second Kind parameter, the parameter of the atomic operation is described using the mode of distribution.
8. a kind of pressure simulation device, it is characterised in that including:
Parameter acquisition module, for obtaining pressure simulation type, and it is corresponding to read the analog type
Configuration file;
Parsing and creation module, for parsing the configuration file and according to the parsing knot of the configuration file
Fruit creates a number of thread;
Pressure generating module, the thread dispatching execute methods, for according to the configuration file
Analysis result performs the default atomic operation corresponding with the pressure model.
9. device as claimed in claim 8, it is characterised in that
The pressure simulation type includes file type and the action type of file.
10. device as claimed in claim 8, it is characterised in that described device also includes atomic operation
Package module:
The atomic operation package module, for performing the default atom corresponding with the pressure model
Before operation, a kind of a kind of action type of file type is packaged into an atomic operation.
11. device as claimed in claim 8, it is characterised in that the parsing is also used with creation module
In:
The object of the class of an atomic operation is created in each thread.
12. device as claimed in claim 8, it is characterised in that the parsing and creation module are specific
For:
By execution Analysis on Framework first kind parameter, wherein the first kind parameter includes the pressure simulation class
Execution time of the corresponding current atomic operation of type, the execution frequency of the current atomic operation and be institute
State the Thread Count that current atomic operation is created.
13. the device as described in claim 11 or 12, it is characterised in that the parsing is with creating mould
Block specifically for:It is described to perform the object that Equations of The Second Kind parameter is transferred to the class of the atomic operation by framework,
And as described in the analysis of object of the class of the atomic operation Equations of The Second Kind parameter.
14. device as claimed in claim 13, it is characterised in that:
In the Equations of The Second Kind parameter, the parameter of the atomic operation is described using the mode of distribution.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610178441.XA CN107229564B (en) | 2016-03-25 | 2016-03-25 | Pressure simulation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610178441.XA CN107229564B (en) | 2016-03-25 | 2016-03-25 | Pressure simulation method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107229564A true CN107229564A (en) | 2017-10-03 |
CN107229564B CN107229564B (en) | 2020-12-11 |
Family
ID=59933032
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610178441.XA Active CN107229564B (en) | 2016-03-25 | 2016-03-25 | Pressure simulation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107229564B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888865A (en) * | 2019-12-04 | 2020-03-17 | 北京明略软件系统有限公司 | Data processing method and device based on one-way linked list |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101727394A (en) * | 2009-12-28 | 2010-06-09 | 成都市华为赛门铁克科技有限公司 | Method and device for testing performance of memory device |
CN102567203A (en) * | 2011-12-28 | 2012-07-11 | 创新科软件技术(深圳)有限公司 | Method and system for testing performance of distributed file system (DFS) |
US20130091094A1 (en) * | 2011-10-06 | 2013-04-11 | International Business Machines Corporation | Accelerating data profiling process |
CN103617004A (en) * | 2013-11-20 | 2014-03-05 | 浪潮电子信息产业股份有限公司 | Tool and method for performing read-write tests on distributed file system |
CN104794007A (en) * | 2015-04-29 | 2015-07-22 | 中国电力科学研究院 | Mass data parallel processing testing method based on electric large data platform |
-
2016
- 2016-03-25 CN CN201610178441.XA patent/CN107229564B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101727394A (en) * | 2009-12-28 | 2010-06-09 | 成都市华为赛门铁克科技有限公司 | Method and device for testing performance of memory device |
US20130091094A1 (en) * | 2011-10-06 | 2013-04-11 | International Business Machines Corporation | Accelerating data profiling process |
CN102567203A (en) * | 2011-12-28 | 2012-07-11 | 创新科软件技术(深圳)有限公司 | Method and system for testing performance of distributed file system (DFS) |
CN103617004A (en) * | 2013-11-20 | 2014-03-05 | 浪潮电子信息产业股份有限公司 | Tool and method for performing read-write tests on distributed file system |
CN104794007A (en) * | 2015-04-29 | 2015-07-22 | 中国电力科学研究院 | Mass data parallel processing testing method based on electric large data platform |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888865A (en) * | 2019-12-04 | 2020-03-17 | 北京明略软件系统有限公司 | Data processing method and device based on one-way linked list |
Also Published As
Publication number | Publication date |
---|---|
CN107229564B (en) | 2020-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9703921B1 (en) | Naturally connecting mixed-signal power networks in mixed-signal simulations | |
CN110058856A (en) | Page configuration method and device | |
CN109448100A (en) | Threedimensional model format conversion method, system, computer equipment and storage medium | |
CN112036736A (en) | Workflow creating method and device | |
CN103186457A (en) | Method and device for automatically generating test case | |
CN107292326A (en) | The training method and device of a kind of model | |
CN104484419A (en) | Test case document conversion system and test case document conversion method | |
CN111679979B (en) | Destructive testing method and device | |
CN106886535A (en) | A kind of data pick-up method and apparatus for being adapted to multiple data sources | |
CN108459951A (en) | test method and device | |
CN108170602B (en) | Test case generation method and device, terminal and computer readable medium | |
CN109902318B (en) | Method and device for generating standard time delay format file | |
CN113268227A (en) | Zero-code visualization software development platform and development method | |
Sarjoughian et al. | Superdense time trajectories for DEVS simulation models. | |
CN109408322B (en) | A kind of automatic business process implementation method of cloud platform | |
CN114398217A (en) | Massive simulation waveform data slicing method for FPGA parallel simulation | |
CN106294530B (en) | The method and system of rule match | |
CN114185874A (en) | Big data based modeling method and device, development framework and equipment | |
CN107229564A (en) | A kind of pressure simulation method and device | |
CN116822462A (en) | Method and device for generating simulation report of power system | |
CN104598554B (en) | Webpage loading method and device | |
CN116483707A (en) | Test method, test device, test apparatus, test program, and test program | |
CN107562703A (en) | Dictionary tree reconstructing method and system | |
CN104765616B (en) | A kind of method and system for automatically generating I/O model | |
CN112306622B (en) | Construction method and device of VNF template |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |