CN112181748A - Concurrent test method, device, equipment and storage medium based on ring queue - Google Patents

Concurrent test method, device, equipment and storage medium based on ring queue Download PDF

Info

Publication number
CN112181748A
CN112181748A CN202011098400.2A CN202011098400A CN112181748A CN 112181748 A CN112181748 A CN 112181748A CN 202011098400 A CN202011098400 A CN 202011098400A CN 112181748 A CN112181748 A CN 112181748A
Authority
CN
China
Prior art keywords
thread
queue
ring
ring queue
abnormal
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
Application number
CN202011098400.2A
Other languages
Chinese (zh)
Inventor
郑如刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202011098400.2A priority Critical patent/CN112181748A/en
Publication of CN112181748A publication Critical patent/CN112181748A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a concurrent test method, a concurrent test device, concurrent test equipment and a concurrent test storage medium based on a ring queue, wherein the method comprises the following steps: acquiring a ring queue set; reading thread ids from each circular queue in parallel, and judging whether the thread corresponding to each read thread id is abnormal or not; if the thread corresponding to a certain thread id is abnormal, closing the annular queue storing the thread id, creating an annular queue based on the number of the remaining thread ids in the annular queue, and transferring the remaining thread ids to the newly created annular queue; and after the thread with the normal judgment result is subjected to pressure test, continuously executing the step of reading the thread id from each ring queue in parallel. The ring queue has dynamic distribution characteristic, so the ring queue can be directly closed, the testing efficiency is improved, the pressure testing process can be restarted after the residual thread id is transferred to the newly-built ring queue, and the testing efficiency can be further improved because the size of the newly-built ring queue is smaller than that of the original ring queue.

Description

Concurrent test method, device, equipment and storage medium based on ring queue
Technical Field
The invention relates to the technical field of computer testing, in particular to a concurrent testing method, a concurrent testing device, concurrent testing equipment and a concurrent testing storage medium based on a ring queue.
Background
Generally, the dependency between server cluster systems to be tested is relatively large, for example, three systems a-B-C correspond to 100 threads, the start-up test of the threads is in an unordered state, the dependency of the three systems is completely disturbed, and when the system a starts up to the 5 th thread, the next thread may be 9 or 10, and the precedence cannot be guaranteed.
Therefore, when concurrent testing of the systems is performed, the dependency relationship of multiple systems needs to be removed, the dependency relationship is separated into single systems for pressure testing, and then the single systems are integrated into a testing set for comprehensive evaluation. Because each split system corresponds to a plurality of threads, the thread id corresponding to each system is stored in the linear table according to a certain sequential logic sequence by using the linear table, and further, when the concurrent testing is performed on each system, the thread id is taken from each linear table according to the first-in first-out sequence for testing.
However, in the process of implementing system concurrent testing by using the linear table, when a thread corresponding to a certain thread id extracted from the head of the linear table is abnormal, a pressure test needs to be performed on the abnormal thread, and the abnormal thread not only occupies a storage space, but also affects the testing efficiency.
Disclosure of Invention
The present invention provides a concurrent testing method, apparatus, device and storage medium based on ring queue, which is directed to the above-mentioned deficiencies of the prior art, and the object is achieved by the following technical solutions.
The invention provides a concurrent test method based on a ring queue in a first aspect, which comprises the following steps:
acquiring a ring queue set, wherein each ring queue in the ring queue set stores a thread id sequence of one system in a cluster system to be tested, and different ring queues store thread id sequences of different systems;
reading thread ids from each circular queue in the circular queue set in parallel, and judging whether the thread corresponding to each read thread id is abnormal or not;
if the thread corresponding to a certain thread id is abnormal, closing the ring queue storing the thread id, building a ring queue based on the number of the remaining thread ids in the ring queue, transferring the remaining thread ids to the newly built ring queue, and adding the newly built ring queue to the ring queue set;
and after the thread with the normal judgment result is subjected to pressure testing, continuing to execute the step of reading the thread id from each ring queue in the ring queue set in parallel until each ring queue is empty and stopping testing.
Optionally, the circular queue includes a queue head and a queue tail; the reading thread-ids in parallel from each ring queue in the set of ring queues may comprise:
thread ids are read in parallel from the queue head of each circular queue in the set of circular queues.
Optionally, the method may further include:
in the concurrent test process, whether the thread corresponding to each system in the cluster system to be tested is abnormal or not can be monitored in real time; when monitoring that a certain thread is abnormal, setting an abnormal mark for the thread;
the determining whether the thread corresponding to each read thread id is abnormal may include:
aiming at each thread id, searching whether a thread corresponding to the thread id is provided with an abnormal mark or not; if yes, determining that the thread is abnormal; if not, determining that the thread is normal.
Optionally, the closing the ring queue storing the thread id may include:
and directly closing the ring queue by using a closing instruction so as to stop the pressure test process of the thread corresponding to the thread id taken out from the ring queue.
Optionally, after transferring the remaining thread ids to the newly created ring queue, the method may further include:
and destroying the closed circular queue to release the storage space occupied by the circular queue.
Optionally, the performing a stress test on the thread with the normal determination result may include:
sending a preset number of requests to the thread concurrently; and determining a test result according to the number of the responses returned by the thread, and recording the test result of the thread.
Optionally, the determining the test result according to the number of responses returned by the thread may include:
if the difference value between the number of the responses returned by the thread and the preset number is smaller than a threshold value, determining that the test result is passed; and if the difference value between the number of the responses returned by the thread and the preset number is larger than a threshold value, determining that the test result is not passed.
A second aspect of the present invention provides a concurrent testing apparatus based on a ring queue, the apparatus including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a ring queue set, each ring queue in the ring queue set stores a thread id sequence of one system in a cluster system to be tested, and different ring queues store thread id sequences of different systems;
a reading module, configured to read a thread id from each circular queue in the circular queue set in parallel;
the judging module is used for judging whether the thread corresponding to each read thread id is abnormal or not;
the exception handling module is used for closing the annular queue storing the thread id when the thread corresponding to the thread id is judged to be abnormal, establishing an annular queue based on the number of the residual thread ids in the annular queue, transferring the residual thread ids to the newly established annular queue, and adding the newly established annular queue to the annular queue set;
and the pressure testing module is used for continuously executing the step of reading the thread id from each annular queue in the annular queue set in parallel after the thread with the normal judgment result is subjected to pressure testing until each annular queue is empty and stops testing.
A third aspect of the present invention provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the steps of the ring queue based concurrency test method according to the first aspect.
A fourth aspect of the present invention proposes a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the circular queue based concurrency testing method according to the first aspect.
The concurrent testing method and device based on the annular queue, the computer equipment and the storage medium have the following beneficial effects:
through the thread id sequence of every system is stored in the ring queue, because the ring queue has the dynamic distribution characteristic, consequently can directly close the ring queue when unusual thread appears for can't carry out the pressure test to unusual thread, thereby can avoid occupying unnecessary storage space, promote efficiency of software testing, and can restart the pressure test flow after shifting remaining thread id to newly-built ring queue, because the size of newly-built ring queue is less than former ring queue, consequently can further promote efficiency of software testing.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flowchart illustrating an embodiment of a method for concurrent testing based on a circular queue according to an exemplary embodiment of the present invention;
FIG. 2 is a schematic diagram of a circular queue structure according to the present invention;
FIG. 3 is a diagram illustrating a hardware configuration of a computer device in accordance with an illustrative embodiment of the present invention;
fig. 4 is a flowchart illustrating an embodiment of a concurrent testing apparatus based on a ring queue according to an exemplary embodiment of the present invention.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present invention. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In the research and development test field, multiple concurrent tasks are more intuitive data embodiment in enterprise application, after the enterprise application is online, when a large number of users access, the opening speed of a page directly influences the user experience, and further influences the retention of the users. Therefore, it is very important to accurately grasp the bearable capability of the server system of the application, so that the server system needs to test the load capability before being online to grasp the bearable capability of the server system, and the situation that a user runs off because the server system cannot be accessed is avoided.
In the prior art, during testing, a linear table is used to store the thread id of each system in a server cluster system into the linear table according to a certain sequential logic order, and the thread id is read from each linear table according to a first-in first-out order for testing.
The inventor finds that in the process of implementing system concurrent testing by using a linear table, after a thread id is taken out from the head of the linear table, even if the thread corresponding to the thread id is abnormal, the abnormal thread still needs to be subjected to stress testing, and actually, the abnormal thread loses the testing significance, so that not only the storage space is occupied, but also the testing efficiency is influenced.
In order to solve the above technical problems, the present invention provides a concurrent testing scheme based on a circular queue, by storing the thread id sequence of each system in the cluster system to be tested into the ring queue, a ring queue set is formed, in the process of concurrent testing, reading thread id from each circular queue in the circular queue set in parallel, judging whether the thread corresponding to each read thread id is abnormal or not, if the thread corresponding to a certain thread id is abnormal, closing the ring queue storing the thread id, transferring the residual thread id to a newly-built ring queue, adding the newly-built ring queue to the ring queue set, and after the thread with the normal judgment result is subjected to pressure test, continuing to execute the step of reading the thread id from each ring queue in the ring queue set in parallel until each ring queue is empty and stopping the test.
Based on the above description, it can be known that, by storing the thread id sequence of each system in the ring queue, because the ring queue has a dynamic allocation characteristic, the ring queue can be directly closed when an abnormal thread occurs, so that the pressure test cannot be performed on the abnormal thread, thereby avoiding occupying redundant storage space, improving the test efficiency, and restarting the pressure test flow after transferring the remaining thread id to the newly-built ring queue, and further improving the test efficiency because the size of the newly-built ring queue is smaller than that of the original ring queue.
The concurrent testing scheme based on the ring queue proposed by the present invention is explained in detail in the following by specific embodiments.
Fig. 1 is a flowchart illustrating an embodiment of a circular queue based concurrent testing method according to an exemplary embodiment of the present invention, where the circular queue based concurrent testing method can be applied to a computer device (e.g., a terminal, a server, and other devices), as shown in fig. 1, and the circular queue based concurrent testing method includes the following steps:
step 101: and acquiring a ring queue set, wherein each ring queue in the ring queue set stores a thread id sequence of one system in the cluster system to be tested, and different ring queues store thread id sequences of different systems.
The system with dependency relationship in the cluster system to be tested is corresponding to a plurality of threads, and each thread has a certain sequential logic relationship, so that each system corresponds to a thread id sequence arranged according to a certain sequential logic sequence. And the number of threads in the thread id sequence corresponding to each system can be the same or different.
For example, the thread id sequence corresponding to the system A is 001-020, the thread id sequence corresponding to the system B is 021-053, and the thread id sequence corresponding to the system B is 054-079.
It should be noted that the cluster system to be tested may be a block chain system, and the block chain referred to in the present invention is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It should be further noted that, in order to further save the occupation of the storage space, the size of each circular queue in the circular queue set is adapted to the length of the thread id sequence to be stored correspondingly.
Since the storage characteristic of the ring queue is that one storage space is always wasted, assuming that the length of the thread id sequence to be stored is n, the size of the ring queue used correspondingly is at least n + 1.
In addition, compared with the prior art that the thread id is stored by using a linear table, the thread id is stored by using a circular queue in the embodiment, because the linear table belongs to a linked list sequential storage structure, that is, only elements are allowed to be inserted at the tail of the queue, and elements are deleted at the head of the queue, when some elements are deleted at the head of the queue and the elements inserted at the tail of the queue are full, since a space at the tail of the queue is already occupied and a pointer at the tail of the queue is increased backwards, an error prompt that the queue is out of bounds is generated, and actually, a space at the head of the queue is free, so that the thread id sequence stored by using the linear table in the prior art also has a false overflow phenomenon.
The circular queue used in the embodiment is a circular structure queue formed by connecting the heads and the tails of the sequential queues, and belongs to a circular storage structure, because the head pointer and the tail pointer of the circular queue are increased by 1 in a redundancy mode, when a space at the tail of the queue is occupied, the tail pointer points to the head of the queue, and the queue out-of-bounds error is not generated, so that the problem of false overflow can be solved, and because the head of the queue is also free, the storage elements can be continuously entered.
Step 102: and reading the thread id from each ring queue in the ring queue set in parallel, and judging whether the thread corresponding to each read thread id is abnormal.
In step 102, for the process of reading thread ids from each ring queue in the ring queue set in parallel, the ring queue storing the thread id sequence includes a queue head and a queue tail, and data is read from the queue head and written from the queue tail, so the embodiment may read thread ids from the queue head of each ring queue in the ring queue set in parallel.
That is to say, the head pointer corresponding to the head of the queue in the circular queue points to the position of the head of the circular queue where data is to be taken out, when data is read, the head pointer is used for operation, the tail pointer corresponding to the tail of the queue in the circular queue points to the position of the tail of the circular queue where data is to be added, and when data is stored, the tail pointer is used for operation.
Assuming that the head of line pointer of the ring queue is front, when a thread id is taken out from the position pointed by the head of line pointer front, the head of line pointer front updates the formula as front ═ 1)% MaxSize, where MaxSize is the total storage capacity size of the ring queue.
In some embodiments, in the process of performing concurrent testing, the abnormal condition of the thread corresponding to each system in the cluster system to be tested can be monitored in real time, and when it is monitored that a certain thread is abnormal, an abnormal flag is set for the thread, so that whether the read thread corresponding to each thread id is abnormal is determined, for each thread id, whether the thread corresponding to the thread id is abnormal is determined by searching whether the thread corresponding to the thread id is provided with the abnormal flag, that is, if the thread id is found, the thread is abnormal, and if the thread id is not found, the thread is normal.
It will be understood by those skilled in the art that the exception flag set for a thread may be in the form of any one or a combination of letters and numbers, and the present invention is not particularly limited thereto.
In another embodiment, in the process of performing the concurrent test, after reading the thread id from the queue head of each ring queue, for each thread id, whether the thread corresponding to the thread id is abnormal or not may be detected in real time.
It will be understood by those skilled in the art that the thread exception detection mode may be implemented by using related technologies, and the present invention is not limited in this regard.
Step 103: if the thread corresponding to a certain thread id is abnormal, the ring queue storing the thread id is closed, a ring queue is newly built based on the number of the remaining thread ids in the ring queue, the remaining thread ids are transferred to the newly built ring queue, and the newly built ring queue is added into a ring queue set.
In an embodiment, for the process of closing the ring queue storing the thread id, since the ring queue has a dynamic allocation characteristic, the ring queue can be directly closed by using a close instruction to stop the stress test process of the thread corresponding to the thread id fetched from the ring queue.
Illustratively, the close instruction may be a break () instruction in a c language or a java language.
Compared with a linear table adopted in the traditional technology, the linear table belongs to a table structure, needs static allocation, needs four instruction steps of deleting, destroying, emptying and exiting if forced closing is needed, is complex in process, and usually allows the linear table to be continuously executed even if a thread is abnormal, so that the linear table not only occupies a storage space, but also influences the testing efficiency.
The annular queue adopted by the invention has the dynamic distribution characteristic, can be directly closed without the four instruction steps, so that the residual thread id in the closed annular queue can be transferred to a newly-built annular queue which is relatively small and continuously participates in the pressure test process, the occupation of the storage space can be saved, and the test efficiency can be improved.
In one embodiment, for the process of creating a ring queue based on the number of remaining thread ids in the ring queue, the size of the created ring queue is (the number of remaining thread ids +1) because the storage characteristic of the ring queue is that a storage space is always wasted.
Therefore, under the condition that a thread corresponding to a certain thread id is abnormal, the size of the newly-built annular queue is inevitably smaller than that of the original annular queue, so that the occupied storage space is reduced, and the testing efficiency can be further improved.
It should be noted that, in the process of transferring the remaining thread ids to the newly-built ring queue, that is, in the process of storing data to the tail of the queue of the newly-built ring queue, assuming that a queue tail pointer of the newly-built ring queue is real, the queue tail pointer points to a position at the tail of the ring queue to which data is to be added, so that storage can be directly added, and when adding one thread id to the position at which the queue tail pointer points, an update formula of the queue tail pointer is (real + 1)% MaxSize, where MaxSize is the total storage capacity size of the newly-built ring queue.
It should be further described that after the remaining thread ids are transferred to the newly-built ring queue, the closed ring queue can be completely destroyed to release the storage space occupied by the ring queue, thereby further improving the testing efficiency.
Illustratively, the destruction of the circular queue can be realized by directly using a destruction instruction, which is simple and fast, such as DestroyQueue () in c language.
Step 104: after the stress test is performed on the thread whose determination result is normal, the process of step 102 is continued until each ring queue is empty and the test is stopped.
In some embodiments, the stress test procedure for a thread may be performed by issuing a preset number of requests to the thread concurrently, determining a test result according to the number of responses returned by the thread, and recording the test result of the thread.
The preset number refers to the maximum number of requests that can be processed by the threads at the same time, and may be set according to actual requirements. After a preset number of requests are sent to the thread concurrently, a timeout device can be started to start timing, and the number of responses returned by the thread is counted after the timeout device times out.
For example, the test result may include a pass type and a fail type, that is, if a difference between the number of responses returned by the thread and the preset number is smaller than a threshold, the test result is determined to be a pass type, and if the difference between the number of responses returned by the thread and the preset number is larger than the threshold, the test result is determined to be a fail type, so that after the test is completed, a user may know the situation of each thread by looking up and looking up the test result of the thread of each system.
The following illustrates the process from step 101 to step 104 in an exemplary scenario:
in the circular queue a shown in fig. 2, the storage capacity MaxSize1 of the circular queue a is 6, that is, the circular queue a can actually store 5 thread ids at most, such as thread a, thread b, thread c, thread d, and thread e in fig. 2. front1 is the head of the ring queue A queue pointer that points to the head of the ring queue A data location, i.e., the location of the data to be fetched, and front1 is the tail of the ring queue A queue pointer that points to the tail of the ring queue A data location, i.e., the location of the data to be added.
Initially, when the front1 is 0, the real 1 is 5, that is, the head pointer front1 points to the thread a, after the thread a is taken out from the head of the circular queue a by the head pointer front1, the formula front1 is updated by the head pointer front1, (front1+ 1)% MaxSize1, after the front1 is updated, the front1 is 1, the front1 points to the thread b, after the thread a corresponding to the pressure test is performed, after the thread b is taken out from the head of the circular queue a by the head pointer front1, the formula front1 is updated by the head pointer front1, (front 9 + 1)% MaxSize1, after the front1 is updated by the head pointer front1, after the front1 is 2, the front1 c, after the thread b corresponding to the pressure test is performed, after the thread a corresponding to the head pointer front 8672 is updated by the head pointer 1, after the thread a corresponding to the pressure test is taken out from the head 1, the front 8672 is updated by the head pointer front1 b by the thread b corresponding to the group pointer front 8672, at this time, the ring queue a is closed, and since the thread d and the thread e remain in the ring queue a, it is necessary to newly create a ring queue B with a storage capacity MaxSize2 of 3, and take out the remaining thread d and thread e from the ring queue a and store them in the newly created ring queue B.
Initially, the head pointer front2 and the tail pointer rear2 of the circular queue B both point to the same position, that is, front2 is equal to rear2 is equal to 0, after adding thread d to the tail of the circular queue B by using the tail pointer rear2 in the process of adding data to the circular queue B, the formula rear2 is updated by using the tail pointer rear2 (rear2+ 1)% MaxSize2 is updated, rear2 is equal to 1, rear2 points to the next free position of the circular queue, after adding thread e to the tail of the circular queue B by using the tail pointer rear2, the formula rear2 is equal to (rear2+ 1)% MaxSize2 is updated by using the tail pointer rear2, rear2 is equal to 2, rear wheel 53 is equal to the next free position of the circular queue B, when the next free position is equal to front 848, the next free position is equal to front 860, when the ring queue B is in the state of adding thread d, rear 847 is equal to the next free position of the circular queue B, and when the ring queue B is full state, the next free position is equal to 8686863, and when the next free position is equal to the ring queue B, the next free position is equal to 86863, then the 3 rd spatial non-queue element in the circular queue is empty.
After the threads d and e remaining in the ring queue A are transferred to the newly-built ring queue B, the newly-built ring queue B is added into the ring queue set, and then the newly-built ring queue B is started to be executed.
So far, accomplish the test flow that above-mentioned fig. 1 shows, through in storing the thread id sequence of every system to the circular queue, because the circular queue has dynamic allocation characteristic, consequently can directly close the circular queue when the unusual thread appears, make can't carry out the pressure test to the unusual thread, thereby can avoid occupying unnecessary storage space, promote efficiency of software testing, and can restart the pressure test flow after shifting remaining thread id to newly-built circular queue, because the size of newly-built circular queue is less than former circular queue, consequently can further promote efficiency of software testing.
Fig. 3 is a schematic diagram illustrating a hardware structure of a computer device according to an exemplary embodiment of the present invention. As shown in fig. 3, the computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected through a system bus. Wherein the non-volatile storage medium of the computer device stores an operating system, a database, and computer readable instructions, the database may store control information sequences, and the computer readable instructions, when executed by the processor, may cause the processor to implement the above-described circular queue-based concurrency testing method. The processor of the computer device is used for providing calculation and control capability and supporting the operation of the whole computer device. The memory of the computer device may have stored therein computer readable instructions that, when executed by the processor, may cause the processor to perform a method of concurrent testing based on a circular queue. The network interface of the computer device is used for connecting and communicating with the terminal.
Those skilled in the art will appreciate that the configuration shown in fig. 3 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing devices to which aspects of the present invention may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Corresponding to the embodiment of the concurrent testing method based on the annular queue, the invention also provides an embodiment of a concurrent testing device based on the annular queue.
Fig. 4 is a flowchart illustrating an embodiment of a circular queue based concurrency test device according to an exemplary embodiment of the present invention, where the circular queue based concurrency test device can be applied to a computer device. As shown in fig. 4, the apparatus for concurrent testing based on a ring queue includes:
an obtaining module 410, configured to obtain a ring queue set, where each ring queue in the ring queue set stores a thread id sequence of one system in a cluster system to be tested, and different ring queues store thread id sequences of different systems;
a reading module 420 for reading thread ids from each circular queue in the circular queue set in parallel;
a determining module 430, configured to determine whether a thread corresponding to each read thread id is abnormal;
the exception handling module 440 is configured to, when it is determined that a thread corresponding to a certain thread id is abnormal, close the ring queue storing the thread id, create a new ring queue based on the number of remaining thread ids in the ring queue, transfer the remaining thread ids to the new ring queue, and add the new ring queue to the ring queue set;
and the pressure test module 450 is configured to continue to perform the step of reading the thread id from each circular queue in the circular queue set in parallel after performing the pressure test on the thread whose determination result is normal until each circular queue is empty and stops the test.
In an optional implementation, the circular queue includes a queue head and a queue tail; the reading module 420 is specifically configured to read a thread id from a queue head of each ring queue in the ring queue set in parallel.
In an optional implementation, the apparatus further comprises: (not shown in FIG. 4)
In the concurrent test process, whether the thread corresponding to each system in the cluster system to be tested is abnormal or not can be monitored in real time;
when monitoring that a certain thread is abnormal, setting an abnormal mark for the thread;
the determining module 430 is specifically configured to, for each thread id, find whether a thread corresponding to the thread id is provided with an exception flag; if yes, determining that the thread is abnormal; if not, determining that the thread is normal.
In an optional implementation manner, the exception handling module 440 is configured to, during the process of closing the ring queue storing the thread id, directly close the ring queue using a close instruction, so as to stop the stress test process of the thread corresponding to the thread id fetched from the ring queue.
In an alternative implementation, the apparatus further comprises (not shown in fig. 4):
after the exception handling module 440 transfers the remaining thread ids to the newly created ring queue, the closed ring queue is destroyed to free up the storage space occupied by the ring queue.
In an optional implementation manner, the pressure testing module 450 is specifically configured to concurrently send a preset number of requests to the thread during a process of performing a pressure test on the thread whose determination result is normal; and determining a test result according to the number of the responses returned by the thread, and recording the test result of the thread.
In an optional implementation manner, the pressure measurement module 450 is specifically configured to, in the process of determining a test result according to the number of responses returned by the thread, determine that the test result is a pass if a difference between the number of responses returned by the thread and the preset number is smaller than a threshold; and if the difference value between the number of the responses returned by the thread and the preset number is larger than a threshold value, determining that the test result is not passed.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement it without inventive effort.
The present invention also provides in another embodiment a computer-readable storage medium having stored thereon a computer program executable by at least one processor to cause the at least one processor to perform a method for ring queue based concurrency testing, the method comprising: acquiring a ring queue set, wherein each ring queue in the ring queue set stores a thread id sequence of one system in a cluster system to be tested, and different ring queues store thread id sequences of different systems; reading thread ids from each circular queue in the circular queue set in parallel, and judging whether the thread corresponding to each read thread id is abnormal or not; if the thread corresponding to a certain thread id is abnormal, closing the ring queue storing the thread id, building a ring queue based on the number of the remaining thread ids in the ring queue, transferring the remaining thread ids to the newly built ring queue, and adding the newly built ring queue to the ring queue set; and after the thread with the normal judgment result is subjected to pressure testing, continuing to execute the step of reading the thread id from each ring queue in the ring queue set in parallel until each ring queue is empty and stopping testing.
In this embodiment, the thread id sequence of each system is stored in the ring queue, and because the ring queue has a dynamic allocation characteristic, the ring queue can be directly closed when an abnormal thread occurs, so that a pressure test cannot be performed on the abnormal thread, and therefore, the occupation of redundant storage space can be avoided, the test efficiency can be improved, and the pressure test flow can be restarted after the remaining thread ids are transferred to the newly-built ring queue, and because the size of the newly-built ring queue is smaller than that of the original ring queue, the test efficiency can be further improved.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A concurrent test method based on a ring queue is characterized by comprising the following steps:
acquiring a ring queue set, wherein each ring queue in the ring queue set stores a thread id sequence of one system in a cluster system to be tested, and different ring queues store thread id sequences of different systems;
reading thread ids from each circular queue in the circular queue set in parallel, and judging whether the thread corresponding to each read thread id is abnormal or not;
if the thread corresponding to a certain thread id is abnormal, closing the ring queue storing the thread id, building a ring queue based on the number of the remaining thread ids in the ring queue, transferring the remaining thread ids to the newly built ring queue, and adding the newly built ring queue to the ring queue set;
and after the thread with the normal judgment result is subjected to pressure testing, continuing to execute the step of reading the thread id from each ring queue in the ring queue set in parallel until each ring queue is empty and stopping testing.
2. The method of claim 1, wherein the circular queue comprises a head of queue and a tail of queue;
the reading thread id from each ring queue in the ring queue set in parallel comprises:
thread ids are read in parallel from the queue head of each circular queue in the set of circular queues.
3. The method of claim 1, further comprising:
in the concurrent test process, whether the thread corresponding to each system in the cluster system to be tested is abnormal or not can be monitored in real time;
when monitoring that a certain thread is abnormal, setting an abnormal mark for the thread;
the determining whether the thread corresponding to each read thread id is abnormal includes:
aiming at each thread id, searching whether a thread corresponding to the thread id is provided with an abnormal mark or not;
if yes, determining that the thread is abnormal;
if not, determining that the thread is normal.
4. The method of claim 1, wherein closing the ring queue storing the thread id comprises:
and directly closing the ring queue by using a closing instruction so as to stop the pressure test process of the thread corresponding to the thread id taken out from the ring queue.
5. The method of claim 1, wherein after transferring the remaining thread-ids to the newly created ring queue, the method further comprises:
and destroying the closed circular queue to release the storage space occupied by the circular queue.
6. The method according to claim 1, wherein the stress testing the thread whose determination result is normal includes:
sending a preset number of requests to the thread concurrently;
and determining a test result according to the number of the responses returned by the thread, and recording the test result of the thread.
7. The method of claim 6, wherein determining test results based on the number of responses returned by the thread comprises:
if the difference value between the number of the responses returned by the thread and the preset number is smaller than a threshold value, determining that the test result is passed;
and if the difference value between the number of the responses returned by the thread and the preset number is larger than a threshold value, determining that the test result is not passed.
8. A concurrency testing apparatus based on a ring queue, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a ring queue set, each ring queue in the ring queue set stores a thread id sequence of one system in a cluster system to be tested, and different ring queues store thread id sequences of different systems;
a reading module, configured to read a thread id from each circular queue in the circular queue set in parallel;
the judging module is used for judging whether the thread corresponding to each read thread id is abnormal or not;
the exception handling module is used for closing the annular queue storing the thread id when the thread corresponding to the thread id is judged to be abnormal, establishing an annular queue based on the number of the residual thread ids in the annular queue, transferring the residual thread ids to the newly established annular queue, and adding the newly established annular queue to the annular queue set;
and the pressure testing module is used for continuously executing the step of reading the thread id from each annular queue in the annular queue set in parallel after the thread with the normal judgment result is subjected to pressure testing until each annular queue is empty and stops testing.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of the method according to any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the ring queue based concurrency testing method according to any one of claims 1 to 7.
CN202011098400.2A 2020-10-14 2020-10-14 Concurrent test method, device, equipment and storage medium based on ring queue Pending CN112181748A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011098400.2A CN112181748A (en) 2020-10-14 2020-10-14 Concurrent test method, device, equipment and storage medium based on ring queue

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011098400.2A CN112181748A (en) 2020-10-14 2020-10-14 Concurrent test method, device, equipment and storage medium based on ring queue

Publications (1)

Publication Number Publication Date
CN112181748A true CN112181748A (en) 2021-01-05

Family

ID=73950135

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011098400.2A Pending CN112181748A (en) 2020-10-14 2020-10-14 Concurrent test method, device, equipment and storage medium based on ring queue

Country Status (1)

Country Link
CN (1) CN112181748A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608974A (en) * 2021-06-29 2021-11-05 济南浪潮数据技术有限公司 Performance pressure measurement method and system of distributed storage system and related components
CN113609026A (en) * 2021-08-20 2021-11-05 盐城金堤科技有限公司 Method and device for pressure testing of server
US11288072B2 (en) * 2019-09-11 2022-03-29 Ceremorphic, Inc. Multi-threaded processor with thread granularity

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11288072B2 (en) * 2019-09-11 2022-03-29 Ceremorphic, Inc. Multi-threaded processor with thread granularity
CN113608974A (en) * 2021-06-29 2021-11-05 济南浪潮数据技术有限公司 Performance pressure measurement method and system of distributed storage system and related components
CN113608974B (en) * 2021-06-29 2023-12-22 济南浪潮数据技术有限公司 Performance pressure measurement method and system of distributed storage system and related components
CN113609026A (en) * 2021-08-20 2021-11-05 盐城金堤科技有限公司 Method and device for pressure testing of server
CN113609026B (en) * 2021-08-20 2022-09-16 盐城金堤科技有限公司 Method and device for pressure testing of server

Similar Documents

Publication Publication Date Title
CN112181748A (en) Concurrent test method, device, equipment and storage medium based on ring queue
TWI267782B (en) Deallocation of computer data in a multithreaded computer
US9513959B2 (en) Contention management for a hardware transactional memory
US8990510B2 (en) Read-copy update system and method
CN110888727B (en) Method, device and storage medium for realizing concurrent lock-free queue
US20070028240A1 (en) Information processing method and information processing apparatus for processing a plurality of threads
US20090138890A1 (en) Contention management for a hardware transactional memory
US20130160028A1 (en) Method and apparatus for low latency communication and synchronization for multi-thread applications
US9678806B2 (en) Method and apparatus for distributing processing core workloads among processing cores
US7698690B2 (en) Identifying code that wastes time performing redundant computation
JP2005235228A5 (en)
JPH0552968B2 (en)
US5412802A (en) Reasoning method and fault diagnosis method and system implementing the same
CN105074656B (en) The method and apparatus for managing concurrent predicate expressions
CN108319711A (en) Transaction consistency test method, device, storage medium and the equipment of database
US20060156306A1 (en) Thread scheduling method, and device to be used with a thread scheduling method
EP0540383B1 (en) Multiprocessor system with microprogrammed means for partitioning the processes between the processors
CN111078480B (en) Exception recovery method and server
US5905904A (en) Parallel data processing system and method of controlling such a system
CN103593606B (en) Context information management method and system
US20100064280A1 (en) Systems and methods for implementing test applications for systems using locks
WO2017222689A1 (en) Method, apparatus and system for performing matching operations in a computing system
CN110968595A (en) Single-thread sql statement execution method, equipment and storage medium
KR20190096837A (en) Method and apparatus for parallel journaling using conflict page list
US20090241111A1 (en) Recording medium having instruction log acquiring program recorded therein and virtual computer system

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