Method, device, equipment and storage medium for locating the cause of slow software system query

By obtaining code statements and command programs when a query task times out, classifying and analyzing event parameters and calculating integral values, and using an integral mapping table to display the target cause, the problem of locating slow software system queries is solved, and fast and accurate cause analysis is achieved.

CN117216097BActive Publication Date: 2025-09-12WUHAN FIBERHOME DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311131299.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-04
Publication Date
2025-09-12
Estimated Expiration
2043-09-04

AI Technical Summary

Technical Problem

Existing technologies make it difficult to quickly and accurately determine the root cause of slow or even abnormal software system queries, especially in software systems deployed within a local area network. As the amount of data and users grows, query tasks are prone to timeouts and difficult to locate the cause.

Method used

When a query task triggers a timeout condition, it is marked as a timed-out query task. The preset tools are used to obtain code statements and command programs, classify and analyze event parameters, determine weight values ​​based on analysis and judgment rules, perform point summing, and combine the preset point mapping table to display the reasons for the slow target query.

Benefits of technology

The root cause of slow system query is quickly and accurately located, which solves the difficulty of location in existing technologies and improves the efficiency and accuracy of query tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216097B_ABST
    Figure CN117216097B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of software testing technology, and discloses a method, device, equipment, and storage medium for locating the cause of slow query in a software system. The method includes marking the query task as a timed-out query task when the query task triggers a preset timeout condition; obtaining the code statement and command program of the timed-out query task based on a preset tool; analyzing the code statement and command program according to the preset classification of the slow query cause to obtain the occurrence parameters of different classification events; determining the weight values ​​of different classification events according to the preset classification rules of the slow query cause; integrating and summing the occurrence parameters and weight values ​​to obtain the integral value; determining the target slow query cause corresponding to the integral value based on the preset integral mapping table and displaying it. In the present invention, the causes of slow system query are classified, the causes of slow query are weighted and the integral value is calculated respectively, and the integral value is judged to quickly and accurately locate the cause of slow system query.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and in particular to a method, device, equipment and storage medium for locating the cause of slow query of a software system. Background Art

[0002] For software systems deployed in a local area network, as the data and user volume grow every day, when the data and user volume reach a certain amount, the query process is prone to slow queries and query task timeouts due to the large amount of system nodes and data involved, which causes the software system to query slowly. The large amount of data and users may even cause the software system to malfunction.

[0003] Due to various factors involving servers, networks, operating systems, databases, application software codes, etc., it is difficult to quickly and accurately determine the root cause of slow software system queries or even software system anomalies. In other words, it is very difficult to locate the root cause of slow software system queries or even software system anomalies.

[0004] The above content is only used to assist in understanding the technical solution of the present invention and does not constitute an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of the present invention is to provide a method, device, equipment and storage medium for locating the cause of slow software system query, aiming to solve the technical problem that it is difficult to quickly and accurately determine the root cause of slow software system query or even software system abnormality.

[0006] To achieve the above object, the present invention provides a method for locating the cause of slow software system query, comprising:

[0007] When a query task triggers a preset timeout condition, marking the query task as a timed-out query task;

[0008] Acquire the code statement and command program of the timeout query task based on a preset tool;

[0009] Analyze the code statements and command programs according to the preset query slowness reasons to obtain occurrence parameters of different classification events;

[0010] Determine the weight values ​​of the different classification events according to the preset rules for classifying the causes of slow query;

[0011] Integrating and summing the occurrence parameters and weight values ​​of the different classification events to obtain an integral value of the timeout query task;

[0012] The target query slowness reason corresponding to the integral value is determined based on a preset integral mapping table, and the target query slowness reason is displayed.

[0013] In some embodiments, the query task triggers a preset timeout condition, including:

[0014] Upon receiving a query task, searching for query results based on the query task;

[0015] Determining a query feedback time for the query result;

[0016] When the query feedback time exceeds a preset time threshold, it is determined that the query task triggers a preset timeout condition.

[0017] In some embodiments, the obtaining of the code statement and command program of the timeout query task based on a preset tool includes:

[0018] Obtaining the slow query statement of the timed-out query task from the preset database based on a preset tool, and using the slow query statement as a code statement;

[0019] Obtaining a database access program for the timeout query task based on a preset tool;

[0020] Calling the Linux command of the timeout query task to obtain the operating system access program and server memory resource program of the timeout query task;

[0021] A command program is constructed according to the database access program, the operating system access program and the server memory resource program.

[0022] In some embodiments, the code statements and command programs are analyzed according to preset query slowness classification to obtain occurrence parameters of different classification events, including:

[0023] According to the preset query slowness reasons, the software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events are determined;

[0024] Determining occurrence parameters of the software code abnormal event according to the slow query statement;

[0025] determining occurrence parameters of the database access abnormal event according to the database access program;

[0026] Determining occurrence parameters of the operating system access abnormal event according to the operating system access program;

[0027] The occurrence parameters of the server memory resource abnormal event are determined according to the server memory resource program.

[0028] In some embodiments, determining the weight values ​​of the different classification events according to the preset rules for classifying the causes of slow query includes:

[0029] According to the preset query slowness reasons, the software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events are determined;

[0030] Determine a software code anomaly weight value according to the software code anomaly event analysis and judgment rules;

[0031] Determine a database access anomaly weight value according to the analysis and judgment rules of the database access anomaly event;

[0032] Determine an operating system access anomaly weight value according to the operating system access anomaly event analysis and judgment rules;

[0033] The server memory resource abnormality weight value is determined according to the analysis and judgment rules of the server memory resource abnormality event.

[0034] In some embodiments, integrating and summing the occurrence parameters and weight values ​​of the different classification events to obtain the integral value of the timeout query task includes:

[0035] Multiplying the occurrence parameter of the software code abnormal event and the software code abnormality weight value to obtain a first score;

[0036] Multiplying the occurrence parameter of the database access abnormal event and the database access abnormality weight value to obtain a second integral;

[0037] multiplying the occurrence parameter of the operating system access abnormality event and the operating system access abnormality weight value to obtain a third integral;

[0038] Multiplying the occurrence parameter of the server memory resource abnormality event and the server memory resource abnormality weight value to obtain a fourth point;

[0039] The first integral, the second integral, the third integral, and the fourth integral are summed to obtain an integral value of the timed query task.

[0040] In some embodiments, determining the target query slowness reason corresponding to the score value based on a preset score mapping table and displaying the target query slowness reason includes:

[0041] Determining whether the integral value is zero;

[0042] When the integral value is zero, a stress test is performed using a preset performance testing tool;

[0043] The stress test is looped until the integral value is not zero, and the stress test is terminated to obtain a stress test query result;

[0044] Obtaining a test score value of the stress test query result;

[0045] The target query slowness reason corresponding to the test score value is determined based on a preset score mapping table, and the target query slowness reason is displayed.

[0046] In addition, to achieve the above-mentioned purpose, the present invention further proposes a device for locating the cause of slow query in a software system, comprising:

[0047] A trigger module, configured to mark a query task as a timed-out query task when the query task triggers a preset timeout condition;

[0048] An acquisition module, configured to acquire the code statement and command program of the timeout query task based on a preset tool;

[0049] An event judgment module is used to classify and analyze the code statements and command programs according to preset query slowness reasons to obtain occurrence parameters of different classification events;

[0050] A weight setting module, configured to determine the weight values ​​of the different classification events according to the preset classification rules for the reasons for slow query;

[0051] A scoring module, configured to integrate and sum the occurrence parameters and weight values ​​of the different classification events to obtain an integral value of the timeout query task;

[0052] The cause determination module is used to determine the target query slowness cause corresponding to the integral value based on a preset integral mapping table, and display the target query slowness cause.

[0053] In addition, to achieve the above-mentioned purpose, the present invention also proposes a device for locating the cause of slow software system query, and the device for locating the cause of slow software system query includes: a memory, a processor, and a program for locating the cause of slow software system query stored on the memory and runnable on the processor, and the program for locating the cause of slow software system query is configured to implement the method for locating the cause of slow software system query as described above.

[0054] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, which stores a program for locating the cause of slow software system query. The program for locating the cause of slow software system query is used to enable the processor to implement the method for locating the cause of slow software system query as described above when executing.

[0055] The present invention marks the query task as a timeout query task when the query task triggers a preset timeout condition; obtains the code statement and command program of the timeout query task based on a preset tool; analyzes the code statement and command program according to the preset query slow cause classification to obtain the occurrence parameters of different classification events; determines the weight values ​​of the different classification events according to the preset query slow cause classification analysis rules; integrates and sums the occurrence parameters and weight values ​​of the different classification events to obtain the integral value of the timeout query task; determines the target query slow cause corresponding to the integral value based on a preset integral mapping table, and displays the target query slow cause. In the present invention, the causes of slow system query are classified, and the causes of slow query are weighted and the integral value is calculated respectively. Through multiple tests, the integral value is judged to locate the cause of slow system query, thereby quickly and accurately locating the cause of slow system query, solving the existing technical problem of difficulty in quickly and accurately determining the root cause of slow software system query or even software system abnormality. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 A schematic diagram of the structure of a device for locating the cause of slow software system query in a hardware operating environment according to an embodiment of the present invention;

[0057] Figure 2 This is a flow chart of a first embodiment of a method for locating the cause of slow software system querying according to the present invention;

[0058] Figure 3 This is a first flow chart of the method for locating the cause of slow query of a software system according to the present invention;

[0059] Figure 4 This is a flow chart of a second embodiment of a method for locating the cause of slow software system querying according to the present invention;

[0060] Figure 5 This is a second flow chart of the method for locating the cause of slow query of a software system according to the present invention;

[0061] Figure 6 This is a structural block diagram of the first embodiment of the device for locating the cause of slow software system query in the present invention.

[0062] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0063] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0064] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the various components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0065] In addition, the descriptions of "first", "second", etc. in the present invention are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention. It should be understood that the specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.

[0066] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a device for locating the cause of slow software system query in a hardware operating environment according to an embodiment of the present invention.

[0067] like Figure 1As shown, the device for locating the cause of the slow query of the software system may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to implement connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard). Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM memory) or a stable non-volatile memory (NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0068] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the device for locating the cause of slow software system query, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0069] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a program for locating the cause of slow software system query.

[0070] exist Figure 1 In the device for locating the cause of slow software system query shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the device for locating the cause of slow software system query of the present invention can be set in the device for locating the cause of slow software system query, and the device for locating the cause of slow software system query calls the program for locating the cause of slow software system query stored in the memory 1005 through the processor 1001, and executes the method for locating the cause of slow software system query provided by the embodiment of the present invention.

[0071] The present invention provides a method, device, equipment and storage medium for locating the cause of slow software system query.

[0072] The embodiment of the present invention provides a method for locating the cause of slow query of a software system, referring to Figure 2 , Figure 2This is a flow chart of a first embodiment of a method for locating the cause of slow software system querying according to the present invention.

[0073] like Figure 2 As shown, the method for locating the cause of slow query of the software system includes:

[0074] Step S100: When a query task triggers a preset timeout condition, the query task is marked as a timeout query task;

[0075] Step S200: Obtaining the code statement and command program of the timeout query task based on a preset tool;

[0076] Step S300: Analyzing the code statements and command programs according to the preset query slowness reasons to obtain occurrence parameters of different classification events;

[0077] Step S400: Determine the weight values ​​of the different classification events according to the preset classification rules for the reasons for slow query;

[0078] Step S500: integrating and summing the occurrence parameters and weight values ​​of the different classification events to obtain an integral value of the timeout query task;

[0079] Step S600: determining the target query slowness reason corresponding to the score value based on a preset score mapping table, and displaying the target query slowness reason.

[0080] It should be noted that the execution subject in this embodiment may be a device for locating the cause of slow software system query. The device for locating the cause of slow software system query may be a computer device with data processing functions, or other devices that can achieve the same or similar functions. This embodiment does not limit this. In this embodiment, a computer device is used as an example for explanation.

[0081] In one embodiment, when a query task triggers a preset timeout condition, the query task is marked as a timeout query task, wherein the query task triggering the preset timeout condition may include: when receiving the query task, searching for query results based on the query task; determining the query feedback time of the query result; and when the query feedback time exceeds a preset time threshold, determining that the query task triggers the preset timeout condition.

[0082] Specifically, when querying a certain interface on a browser, if the query feedback time for returning the result of the query on a certain interface exceeds a preset time threshold, for example, 60 seconds, it is considered that the software system query is slow. The database used by the browser can be Tidb.

[0083] In one embodiment, obtaining the code statement and command program of the timeout query task based on a preset tool may include: obtaining the slow query statement of the timeout query task from the preset database based on the preset tool, and using the slow query statement as the code statement; obtaining the database access program of the timeout query task based on the preset tool; calling the Linux command of the timeout query task to obtain the operating system access program and server memory resource program of the timeout query task; and constructing a command program based on the database access program, the operating system access program and the server memory resource program.

[0084] For example, slow query statements can be obtained from the Tidb database through relevant tools such as a browser;

[0085] You can call related tools such as NAVIcat to determine whether database access is abnormal; you can call related Linux commands such as ssh ip to determine whether operating system access is abnormal; you can call related Linux commands such as free_g to determine whether server memory resources are abnormal.

[0086] In one embodiment, the code statements and command programs are analyzed according to a preset query slow cause classification to obtain occurrence parameters of different classification events, which may include: determining software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events according to the preset query slow cause classification; determining the occurrence parameters of the software code abnormal events according to the slow query statements; determining the occurrence parameters of the database access abnormal events according to the database access program; determining the occurrence parameters of the operating system access abnormal events according to the operating system access program; and determining the occurrence parameters of the server memory resource abnormal events according to the server memory resource program.

[0087] Specifically, the causes of slow query are defined as events, denoted by Sn. This embodiment uses the example of a preset query slowness classification consisting of four events. For example, these four causes are: S1: a slow query SQL statement in the software code; S2: a database access anomaly; S3: an operating system access anomaly; and S4: a server resource anomaly.

[0088] Exemplarily, whether event Sn occurs is defined as Qn. If event Sn occurs, Qn is 1, and if event Sn does not occur, Qn is 0. In one example, when a software code exception event is determined to have occurred according to a slow query statement, the occurrence parameter Q1 of S1 is 1. When a database access exception event is determined to have occurred according to a database access program, the occurrence parameter Q2 of S2 is 1. When an operating system access exception event is determined to have occurred according to an operating system access program, the occurrence parameter Q3 of S3 is 1. When a server memory resource exception event is determined to have occurred according to a server memory resource program, the occurrence parameter Q4 of S4 is 1. In another example, when a software code exception event is determined not to have occurred according to a slow query statement, the occurrence parameter Q1 of S1 is 0. When a database access exception event is determined not to have occurred according to a database access program, the occurrence parameter Q2 of S2 is 0. When an operating system access exception event is determined not to have occurred according to an operating system access program, the occurrence parameter Q3 of S3 is 0. When a server memory resource exception event is determined not to have occurred according to a server memory resource program, the occurrence parameter Q4 of S4 is 0.

[0089] In one embodiment, the weight values ​​of the different classification events are determined according to the preset query slow cause classification analysis rules, which may include: determining software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events according to the preset query slow cause classification; determining the software code abnormality weight value according to the software code abnormality event analysis rules; determining the database access abnormality weight value according to the database access abnormality event analysis rules; determining the operating system access abnormality weight value according to the operating system access abnormality event analysis rules; determining the server memory resource abnormality weight value according to the server memory resource abnormality event analysis rules.

[0090] For example, the default query slowness classification includes four events: S1 is a software code exception event; S2 is a database access exception event; S3 is an operating system access exception event; and S4 is a server resource exception event. The probability of event Sn occurring is defined as Pn, where Pn represents the weight of event Sn. The weight of Sn occurrence is set as follows:

[0091] Table 1 Analysis and judgment rules for the reasons of slow system query

[0092]

[0093] In one embodiment, integrating and summing the occurrence parameters and weight values ​​of the different classification events to obtain the integral value of the timeout query task may include: multiplying the occurrence parameters of the software code exception event and the software code exception weight value to obtain a first integral; multiplying the occurrence parameters of the database access exception event and the database access exception weight value to obtain a second integral; multiplying the occurrence parameters of the operating system access exception event and the operating system access exception weight value to obtain a third integral; multiplying the occurrence parameters of the server memory resource exception event and the server memory resource exception weight value to obtain a fourth integral; and summing the first integral, the second integral, the third integral and the fourth integral to obtain the integral value of the timeout query task.

[0094] Specifically, the integral value Tn of the timed query task is obtained by integrating and summing the events occurring in Sn, i.e., Tn = SUM(Pn * Qn). For example, the preset query slowness cause classification includes four events, n = 4, and T4 = P1 * Q1 + P2 * Q2 + P3 * Q3 + P4 * Q4. It will be understood that the preset query slowness cause classification includes but is not limited to four events, and this embodiment is not limited to this.

[0095] It should be noted that the reference Figure 3 , by scoring when a timeout is triggered through the above steps, the integral value Tn of the timed-out query task is obtained, the size of the integral value Tn is judged, and the root cause of the slow query of the software system can be quickly located by calculating the integral value using the above steps multiple times. In one embodiment, the target query slow cause corresponding to the integral value is determined based on a preset integral mapping table, and the target query slow cause is displayed, which may include: judging whether the integral value is zero; when the integral value is zero, performing a stress test through a preset performance testing tool; looping the stress test until the integral value is not zero and ending the stress test to obtain a stress test query result; obtaining a test integral value of the stress test query result; determining the target query slow cause corresponding to the test integral value based on a preset integral mapping table, and displaying the target query slow cause.

[0096] For example, the preset points mapping table includes the system query slow occurrence score and the corresponding reason, as shown in Table 2 below:

[0097] Table 2 System query slowness scores and corresponding reasons

[0098]

[0099] Specifically, it is determined whether the integral value is zero. In one example, if the integral value is not zero, the target query slowness reason corresponding to the integral value is determined through a preset integral mapping table, and the target query slowness reason is displayed. In another example, if the integral value is zero, a preset performance testing tool is used to simulate multiple concurrent queries to perform a stress test until the integral value is not 0, and the test integral value of the final stress test query result is obtained. The target query slowness reason corresponding to the test integral value is determined through a preset integral mapping table, and the target query slowness reason is displayed.

[0100] This embodiment marks the query task as a timed-out query task when the query task triggers a preset timeout condition; obtains the code statement and command program of the timed-out query task based on a preset tool; analyzes the code statement and command program according to the preset classification of slow query reasons to obtain the occurrence parameters of different classification events; determines the weight values ​​of the different classification events according to the preset judgment rules of the classification of slow query reasons; integrates and sums the occurrence parameters and weight values ​​of the different classification events to obtain the integral value of the timed-out query task; determines the target slow query reason corresponding to the integral value based on the preset integral mapping table, and displays the target slow query reason. In this embodiment, the reasons for the slow system query are classified, and the weights of the reasons for the slow query are respectively set and the integral values ​​are calculated. Through multiple tests, the integral values ​​are judged to locate the reasons for the slow system query, thereby quickly and accurately locating the reasons for the slow system query, solving the existing technical problem of difficulty in quickly and accurately determining the root cause of the slow software system query or even software system anomalies.

[0101] In some embodiments, as Figure 4 As shown, based on the first embodiment, a second embodiment of the method for locating the cause of slow software system query of the present invention is proposed. Step S600 includes:

[0102] Step S601: determining whether the integral value is zero;

[0103] Step S602: When the integral value is zero, a stress test is performed using a preset performance test tool;

[0104] Step S603: looping the stress test until the integral value is not zero, ending the stress test and obtaining a stress test query result;

[0105] Step S604: Obtain the test score value of the stress test query result;

[0106] Step S605: determining the target query slowness reason corresponding to the test score value based on a preset score mapping table, and displaying the target query slowness reason.

[0107] It should be noted that it is determined whether the integral value is zero. Figure 5 Score judgment shown: In one example, the integral value is not zero ( Figure 5 The score is judged as "yes" branch), the target query slow reason corresponding to the score is determined by the preset score mapping table, and the target query slow reason is displayed. In another example, the score is zero ( Figure 5 The score is judged as "no" branch), and a preset performance testing tool is used to simulate multiple concurrent queries to perform a stress test until the score is not 0. The test score value of the final stress test query result is obtained. The target query slowness reason corresponding to the test score value is determined through the preset score mapping table, and the target query slowness reason is displayed.

[0108] Exemplarily, when the integral value is zero, a stress test is performed using a preset performance test tool; the stress test is looped until the integral value is not zero, and the stress test is terminated to obtain a stress test query result.

[0109] Specifically, for example, using a single-person query, record the M1 value of the stress test query result of the first test. If the M1 value is 0, it means that the single-person query is normal, and continue to the next stress test; if the M1 value is not 0, the reason for the slow software system query can be determined based on the M1 value and the preset point mapping table.

[0110] For example, if the M1 value is 0, indicating that a single-user query is normal, the next stress test is performed: a performance testing tool is used to simulate multiple concurrent queries, for example, 100 people, and the M2 value of the second stress test query result is recorded. If the M2 value is 0, indicating that 100 concurrent queries are normal, the next stress test is performed. If the M2 value is not 0, the reason for the slow software system query can be determined based on the M2 value and the preset score mapping table.

[0111] For example, if the M2 value is 0, it indicates that 100 concurrent queries are normal, and the next stress test is performed: use the performance testing tool to simulate 200 concurrent queries, and record the M3 value of the third stress test query result. If the M3 value is 0, it indicates that 200 concurrent queries are normal, and the next stress test is performed. If the M3 value is not 0, the reason for the slow software system query can be determined based on the M3 value and the preset score mapping table.

[0112] For example, if the M3 value is 0, it indicates that 200 concurrent queries are normal, and the next stress test is performed: Use the performance testing tool to simulate 300 concurrent queries, and record the M4 value of the fourth stress test query result. If the M4 value is 0, it indicates that 300 concurrent queries are normal, and the next stress test is performed. If the M4 value is not 0, the reason for the slow software system query can be determined based on the M4 value and the preset point mapping table. Use the performance testing tool to simulate multiple concurrent queries until the Mn value is not 0.

[0113] It will be appreciated that the preset integral mapping table shown in Table 2 shows 16 results. In actual applications, in order to further quickly and accurately locate the cause of the slow software system query, the 16 results in Table 2 are sorted and analyzed to obtain the correspondence between integral values ​​and inevitable events, resulting in the results shown in Table 3. For example, integral values ​​are obtained through multiple tests, the range of integral value Tn is determined based on Table 3, and the corresponding inevitable event is determined based on the integral range. This inevitable event is then used as the cause of the slow software system query and displayed, further improving the speed of locating the cause of the slow software system query.

[0114] Specifically, by analyzing the preset point mapping table, that is, the scores and corresponding causes of slow system query shown in Table 2 above, the corresponding scores and inevitable events in Table 3 below are obtained:

[0115] Table 3 Corresponding scores and inevitable events

[0116]

[0117] This embodiment determines whether the integral value is zero; when the integral value is zero, performs a stress test using a preset performance test tool; loops the stress test until the integral value is not zero, ends the stress test, and obtains a stress test query result; obtains a test integral value of the stress test query result; determines the target query slowness cause corresponding to the test integral value based on a preset integral mapping table, and displays the target query slowness cause. In this embodiment, the causes of slow system queries are classified, and weights are set for the causes of slow queries and integral values ​​are calculated. Through multiple tests, the integral values ​​are judged to locate the causes of slow system queries, thereby quickly and accurately locating the causes of slow system queries, solving the existing technical problem of difficulty in quickly and accurately determining the root causes of slow software system queries or even software system anomalies.

[0118] In addition, an embodiment of the present invention also proposes a storage medium, on which a program for locating the cause of slow software system query is stored. When the program for locating the cause of slow software system query is executed by a processor, the steps of the method for locating the cause of slow software system query as described above are implemented.

[0119] Reference Figure 6 , Figure 6 This is a structural block diagram of the first embodiment of the device for locating the cause of slow software system query in the present invention.

[0120] like Figure 6 As shown, the device for locating the cause of slow query of the software system includes:

[0121] A triggering module 10 is configured to mark a query task as a timed-out query task when the query task triggers a preset timeout condition;

[0122] An acquisition module 20 is configured to acquire a code statement and a command program for the timeout query task based on a preset tool;

[0123] An event judgment module 30 is used to analyze the code statements and command programs according to preset query slowness reasons to obtain occurrence parameters of different classification events;

[0124] A weight setting module 40 is used to determine the weight values ​​of the different classification events according to the preset classification rules of the query slowness cause;

[0125] A scoring module 50 is configured to integrate and sum the occurrence parameters and weight values ​​of the different classification events to obtain an integral value of the timeout query task;

[0126] The cause determination module 60 is configured to determine the target query slowness cause corresponding to the integral value based on a preset integral mapping table, and display the target query slowness cause.

[0127] In one embodiment, when a query task triggers a preset timeout condition, the query task is marked as a timeout query task, wherein the query task triggering the preset timeout condition may include: when receiving the query task, searching for query results based on the query task; determining the query feedback time of the query result; and when the query feedback time exceeds a preset time threshold, determining that the query task triggers the preset timeout condition.

[0128] Specifically, when querying a certain interface on a browser, if the query feedback time for returning the result of the query on a certain interface exceeds a preset time threshold, for example, 60 seconds, it is considered that the software system query is slow. The database used by the browser can be Tidb.

[0129] In one embodiment, obtaining the code statement and command program of the timeout query task based on a preset tool may include: obtaining the slow query statement of the timeout query task from the preset database based on the preset tool, and using the slow query statement as the code statement; obtaining the database access program of the timeout query task based on the preset tool; calling the Linux command of the timeout query task to obtain the operating system access program and server memory resource program of the timeout query task; and constructing a command program based on the database access program, the operating system access program and the server memory resource program.

[0130] For example, slow query statements can be obtained from the Tidb database through relevant tools such as a browser; relevant tools such as NAVIcat can be called to determine whether database access is abnormal; relevant Linux commands such as ssh ip can be called to determine whether operating system access is abnormal; relevant Linux commands such as free_g can be called to determine whether server memory resources are abnormal.

[0131] In one embodiment, the code statements and command programs are analyzed according to a preset query slow cause classification to obtain occurrence parameters of different classification events, which may include: determining software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events according to the preset query slow cause classification; determining the occurrence parameters of the software code abnormal events according to the slow query statements; determining the occurrence parameters of the database access abnormal events according to the database access program; determining the occurrence parameters of the operating system access abnormal events according to the operating system access program; and determining the occurrence parameters of the server memory resource abnormal events according to the server memory resource program.

[0132] Specifically, the causes of slow query are defined as events, denoted by Sn. This embodiment uses the example of a preset query slowness classification consisting of four events. For example, these four causes are: S1: a slow query SQL statement in the software code; S2: a database access anomaly; S3: an operating system access anomaly; and S4: a server resource anomaly.

[0133] Exemplarily, whether event Sn occurs is defined as Qn. If event Sn occurs, Qn is 1, and if event Sn does not occur, Qn is 0. In one example, when a software code exception event is determined to have occurred according to a slow query statement, the occurrence parameter Q1 of S1 is 1. When a database access exception event is determined to have occurred according to a database access program, the occurrence parameter Q2 of S2 is 1. When an operating system access exception event is determined to have occurred according to an operating system access program, the occurrence parameter Q3 of S3 is 1. When a server memory resource exception event is determined to have occurred according to a server memory resource program, the occurrence parameter Q4 of S4 is 1. In another example, when a software code exception event is determined not to have occurred according to a slow query statement, the occurrence parameter Q1 of S1 is 0. When a database access exception event is determined not to have occurred according to a database access program, the occurrence parameter Q2 of S2 is 0. When an operating system access exception event is determined not to have occurred according to an operating system access program, the occurrence parameter Q3 of S3 is 0. When a server memory resource exception event is determined not to have occurred according to a server memory resource program, the occurrence parameter Q4 of S4 is 0.

[0134] In one embodiment, the weight values ​​of the different classification events are determined according to the preset query slow cause classification analysis rules, which may include: determining software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events according to the preset query slow cause classification; determining the software code abnormality weight value according to the software code abnormality event analysis rules; determining the database access abnormality weight value according to the database access abnormality event analysis rules; determining the operating system access abnormality weight value according to the operating system access abnormality event analysis rules; determining the server memory resource abnormality weight value according to the server memory resource abnormality event analysis rules.

[0135] For example, the preset query slowness cause classification includes four events: S1 is a software code exception event; S2 is a database access exception event; S3 is an operating system access exception event; and S4 is a server resource exception event. The probability of event Sn occurring is defined as Pn, where Pn represents the weight of event Sn. The weight of Sn is set for the system query slowness cause analysis rules in Table 1, which will not be detailed here.

[0136] In one embodiment, integrating and summing the occurrence parameters and weight values ​​of the different classification events to obtain the integral value of the timeout query task may include: multiplying the occurrence parameters of the software code exception event and the software code exception weight value to obtain a first integral; multiplying the occurrence parameters of the database access exception event and the database access exception weight value to obtain a second integral; multiplying the occurrence parameters of the operating system access exception event and the operating system access exception weight value to obtain a third integral; multiplying the occurrence parameters of the server memory resource exception event and the server memory resource exception weight value to obtain a fourth integral; and summing the first integral, the second integral, the third integral and the fourth integral to obtain the integral value of the timeout query task.

[0137] Specifically, the integral value Tn of the timed query task is obtained by integrating and summing the events occurring in Sn, i.e., Tn = SUM(Pn * Qn). For example, the preset query slowness cause classification includes four events, n = 4, and T4 = P1 * Q1 + P2 * Q2 + P3 * Q3 + P4 * Q4. It will be understood that the preset query slowness cause classification includes but is not limited to four events, and this embodiment is not limited to this.

[0138] It should be noted that the reference Figure 3 , by scoring when a timeout is triggered through the above steps, the integral value Tn of the timed-out query task is obtained, the size of the integral value Tn is judged, and the root cause of the slow query of the software system can be quickly located by calculating the integral value using the above steps multiple times. In one embodiment, the target query slow cause corresponding to the integral value is determined based on a preset integral mapping table, and the target query slow cause is displayed, which may include: judging whether the integral value is zero; when the integral value is zero, performing a stress test through a preset performance testing tool; looping the stress test until the integral value is not zero and ending the stress test to obtain a stress test query result; obtaining a test integral value of the stress test query result; determining the target query slow cause corresponding to the test integral value based on a preset integral mapping table, and displaying the target query slow cause.

[0139] Exemplarily, the preset point mapping table includes the system query slow occurrence score and the corresponding reason. Please refer to Table 2 for the system query slow occurrence score and the corresponding reason, which will not be repeated here.

[0140] Specifically, it is determined whether the integral value is zero. In one example, if the integral value is not zero, the target query slowness reason corresponding to the integral value is determined through a preset integral mapping table, and the target query slowness reason is displayed. In another example, if the integral value is zero, a preset performance testing tool is used to simulate multiple concurrent queries to perform a stress test until the integral value is not 0, and the test integral value of the final stress test query result is obtained. The target query slowness reason corresponding to the test integral value is determined through a preset integral mapping table, and the target query slowness reason is displayed.

[0141] In this embodiment, the causes of slow system query are classified, weights are set for each of the causes of slow query, and integral values ​​are calculated. Through multiple tests, the integral values ​​are judged to locate the cause of slow system query, thereby quickly and accurately locating the cause of slow system query, solving the existing technical problem of difficulty in quickly and accurately determining the root cause of slow software system query or even software system abnormality.

[0142] In addition, for technical details not fully described in the embodiment of the device for locating the cause of slow software system query, please refer to the method for locating the cause of slow software system query as described above provided in any embodiment of the present invention, and will not be repeated here.

[0143] It should be understood that the above is only an example and does not constitute any limitation to the technical solution of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any limitation on this.

[0144] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the embodiment scheme, and no limitation is made here.

[0145] In addition, it should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.

[0146] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.

[0147] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0148] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for locating the cause of slow software system query, characterized in that: The method for locating the cause of slow query of the software system includes: When a query task triggers a preset timeout condition, marking the query task as a timed-out query task; Acquire the code statement and command program of the timeout query task based on a preset tool; Analyze the code statements and command programs according to the preset query slowness reasons to obtain occurrence parameters of different classification events; Determine the weight values ​​of the different classification events according to the preset rules for classifying the causes of slow query; Integrating and summing the occurrence parameters and weight values ​​of the different classification events to obtain an integral value of the timeout query task; Determine the target query slowness reason corresponding to the integral value based on a preset integral mapping table, and display the target query slowness reason; Determining the weight values ​​of the different classification events according to the preset query slow cause classification analysis rules, including: determining software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events according to the preset query slow cause classification; determining the software code abnormality weight value according to the software code abnormality event analysis rules; determining the database access abnormality weight value according to the database access abnormality event analysis rules; determining the operating system access abnormality weight value according to the operating system access abnormality event analysis rules; determining the server memory resource abnormality weight value according to the server memory resource abnormality event analysis rules; The occurrence parameters and weight values ​​of the different classification events are integrated and summed to obtain the integral value of the timeout query task, including: multiplying the occurrence parameters of the software code exception event and the software code exception weight value to obtain a first integral; multiplying the occurrence parameters of the database access exception event and the database access exception weight value to obtain a second integral; multiplying the occurrence parameters of the operating system access exception event and the operating system access exception weight value to obtain a third integral; multiplying the occurrence parameters of the server memory resource exception event and the server memory resource exception weight value to obtain a fourth integral; summing the first integral, the second integral, the third integral and the fourth integral to obtain the integral value of the timeout query task.

2. The method for locating the cause of slow software system query according to claim 1, characterized in that: The query task triggers a preset timeout condition, including: Upon receiving a query task, searching for query results based on the query task; Determining a query feedback time for the query result; When the query feedback time exceeds a preset time threshold, it is determined that the query task triggers a preset timeout condition.

3. The method for locating the cause of slow software system query according to claim 1, characterized in that: The method of obtaining the code statement and command program of the timeout query task based on a preset tool includes: Obtaining the slow query statement of the timed-out query task from a preset database based on a preset tool, and using the slow query statement as a code statement; Obtaining a database access program for the timeout query task based on a preset tool; Calling the Linux command of the timeout query task to obtain the operating system access program and server memory resource program of the timeout query task; A command program is constructed according to the database access program, the operating system access program and the server memory resource program.

4. The method for locating the cause of slow software system query according to claim 3, characterized in that: The code statements and command programs are analyzed according to the preset query slowness reasons to obtain occurrence parameters of different classification events, including: According to the preset query slowness reasons, the software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events are determined; Determining occurrence parameters of the software code abnormal event according to the slow query statement; determining occurrence parameters of the database access abnormal event according to the database access program; Determining occurrence parameters of the operating system access abnormal event according to the operating system access program; The occurrence parameters of the server memory resource abnormal event are determined according to the server memory resource program.

5. The method for locating the cause of slow software system query according to claim 1, characterized in that: The determining the target query slowness reason corresponding to the integral value based on the preset integral mapping table and displaying the target query slowness reason includes: Determining whether the integral value is zero; When the integral value is zero, a stress test is performed using a preset performance testing tool; The stress test is looped until the integral value is not zero, and the stress test is terminated to obtain a stress test query result; Obtaining a test score value of the stress test query result; The target query slowness reason corresponding to the test score value is determined based on a preset score mapping table, and the target query slowness reason is displayed.

6. A device for locating the cause of slow software system query, characterized in that: The device for locating the cause of slow query of the software system includes: A trigger module, configured to mark a query task as a timed-out query task when the query task triggers a preset timeout condition; An acquisition module, configured to acquire the code statement and command program of the timeout query task based on a preset tool; An event judgment module is used to classify and analyze the code statements and command programs according to preset query slowness reasons to obtain occurrence parameters of different classification events; A weight setting module, configured to determine the weight values ​​of the different classification events according to the preset classification rules for the reasons for slow query; A scoring module, configured to integrate and sum the occurrence parameters and weight values ​​of the different classification events to obtain an integral value of the timeout query task; a cause determination module, configured to determine a target query slowness cause corresponding to the integral value based on a preset integral mapping table, and display the target query slowness cause; Determining the weight values ​​of the different classification events according to the preset query slow cause classification analysis rules, including: determining software code abnormal events, database access abnormal events, operating system access abnormal events and server memory resource abnormal events according to the preset query slow cause classification; determining the software code abnormality weight value according to the software code abnormality event analysis rules; determining the database access abnormality weight value according to the database access abnormality event analysis rules; determining the operating system access abnormality weight value according to the operating system access abnormality event analysis rules; determining the server memory resource abnormality weight value according to the server memory resource abnormality event analysis rules; The occurrence parameters and weight values ​​of the different classification events are integrated and summed to obtain the integral value of the timeout query task, including: multiplying the occurrence parameters of the software code exception event and the software code exception weight value to obtain a first integral; multiplying the occurrence parameters of the database access exception event and the database access exception weight value to obtain a second integral; multiplying the occurrence parameters of the operating system access exception event and the operating system access exception weight value to obtain a third integral; multiplying the occurrence parameters of the server memory resource exception event and the server memory resource exception weight value to obtain a fourth integral; summing the first integral, the second integral, the third integral and the fourth integral to obtain the integral value of the timeout query task.

7. A device for locating the cause of slow software system query, characterized in that: The device for locating the cause of slow software system query includes: a memory, a processor, and a program for locating the cause of slow software system query stored in the memory and runnable on the processor. The program for locating the cause of slow software system query is configured to implement the method for locating the cause of slow software system query as described in any one of claims 1 to 5.

8. A storage medium, characterized in that: The storage medium stores a program for locating the cause of slow software system query, which is used to enable a processor to implement the method for locating the cause of slow software system query according to any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Database optimization method, database optimization device, electronic equipment and storage medium

    CN113535773A

  • Risk control management method and device for business system

    CN116204393A