Query mode switching method and apparatus, service device, and storage medium

By acquiring real-time performance metrics data of the query component, calculating anomaly scores, and automatically switching to a component with better performance, the inefficiency caused by manual switching in existing technologies is solved, achieving efficient automatic switching of the fast query component.

CN117520634BActive Publication Date: 2026-06-19CHINA UNITED NETWORK COMM GRP CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA UNITED NETWORK COMM GRP CO LTD
Filing Date
2023-11-22
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In existing technologies, when the performance of the fast query method component fails, the system switches by having maintenance personnel manually log in and modify system parameters, resulting in excessively long operation times and low efficiency.

Method used

By acquiring performance metrics data of the target query component in real time, calculating anomaly scores, and comparing them with the score threshold, the system automatically switches to the query component with better performance. This continuous real-time acquisition of performance metrics data enables automatic switching between components.

Benefits of technology

It enables rapid component switching without human intervention after a failure occurs, improving operational efficiency and avoiding the problem of excessive time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117520634B_ABST
    Figure CN117520634B_ABST
Patent Text Reader

Abstract

This application provides a query mode switching method, apparatus, service device, and storage medium. The method includes: acquiring first performance index data of a target query component and calculating a first anomaly score; if the first anomaly score is greater than a scoring threshold, acquiring second performance index data of a database query component and calculating a second anomaly score; if the first anomaly score is greater than the second anomaly score and the current query mode is the target query component, switching to the database query component; acquiring first performance index data of the target query component and calculating a first anomaly score of the target query component based on the first performance index data; if the first anomaly score is less than or equal to the scoring threshold and the current query mode is the database query component, switching to the target query component and acquiring first performance index data of the target query component. This achieves automatic switching between different query modes, avoiding problems such as excessively long operation time and low efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a query mode switching method, apparatus, service device, and storage medium. Background Technology

[0002] Currently, with the advent of the big data era, data volume is exploding, and enterprises and organizations need to quickly extract valuable information from massive amounts of data. Therefore, there is a demand for fast data retrieval, which can be met by components of distributed search engines. However, when the performance of components providing fast query methods encounters problems, switching to those components is an effective solution.

[0003] In existing technologies, when the performance of the fast query method component malfunctions, operations and maintenance personnel need to log into the system and manually modify system parameters to switch to the fast query method component.

[0004] However, in the existing technology, after a failure occurs, the operation and maintenance personnel log into the system and manually modify the system parameters to switch the quick query method component, which has the problems of excessive operation time and low efficiency. Summary of the Invention

[0005] This application provides a query method switching method, apparatus, service device, and storage medium to solve the problem that in the prior art, after a failure, the operation time is too long and the efficiency is too low when the operation personnel log into the system and manually modify the system parameters to quickly switch the query method component.

[0006] Firstly, this application provides a query method switching method, applied to a service device, including:

[0007] Real-time acquisition of the first performance metric data of the target query component;

[0008] Based on the first performance index data, calculate the first anomaly score of the target query component;

[0009] The first abnormal score is compared with the score threshold;

[0010] If the first abnormal score is greater than the score threshold, then the second performance index data of the database query component at the current moment is obtained;

[0011] Based on the second performance metric data, calculate the second anomaly score of the database query component;

[0012] Compare the first anomaly score with the second anomaly score;

[0013] If the first anomaly score is greater than the second anomaly score, then determine the query method used at the current moment;

[0014] If the current query method is the query method of the target query component, then switch to the query method of the database query component;

[0015] Continuously acquire the first performance index data of the target query component in real time, and calculate the first anomaly score of the target query component based on the first performance index data of the target query component;

[0016] If the first abnormal score is less than or equal to the score threshold, then determine the query method used at the current moment;

[0017] If the current query method is the database query component's query method, then switch to the target query component's query method and continuously obtain the target query component's first performance indicator data in real time.

[0018] In one possible design, the first performance metric data includes CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate recorded within a statistical period. Correspondingly, calculating the first anomaly score of the target query component based on the first performance metric data includes: obtaining a first anomaly value based on CPU utilization recorded within a statistical period according to a preset scoring rule; obtaining a second anomaly value based on disk utilization recorded within a statistical period according to a preset scoring rule; obtaining a third anomaly value based on memory utilization recorded within a statistical period according to a preset scoring rule; obtaining a fourth anomaly value based on cluster health status recorded within a statistical period according to a preset scoring rule; obtaining a fifth anomaly value based on request latency recorded within a statistical period according to a preset scoring rule; obtaining a sixth anomaly value based on query rejection rate recorded within a statistical period according to a preset scoring rule; and weighting and summing the first, second, third, fourth, fifth, and sixth anomalies according to a preset weight allocation to obtain the first anomaly score of the target query component.

[0019] In one possible design, after comparing the first anomaly score with the scoring threshold, the method further includes: if the first anomaly score is less than or equal to the scoring threshold, determining the query method used at the current moment; if the query method used at the current moment is the query method of the target query component, outputting the first anomaly score; and continuously acquiring the first performance index data of the target query component in real time.

[0020] In one possible design, after comparing the first anomaly score with the second anomaly score, the method further includes: if the first anomaly score is less than or equal to the second anomaly score, then outputting the first anomaly score and the second anomaly score, as well as the anomaly status of the target query component and the anomaly status of the database query component; and continuously acquiring the first performance index data of the target query component in real time.

[0021] In one possible design, after outputting the first anomaly score and the second anomaly score, as well as the anomaly status of the target query component and the database query component, the method further includes: sending the anomaly status of the target query component and the anomaly status of the database query component to the maintenance personnel's terminal.

[0022] In one possible design, if the first anomaly score is greater than the second anomaly score, after determining the query method used at the current moment, the method further includes: if the query method used at the current moment is the query method of the database query component, then the first anomaly score and the anomaly status of the target query component are output; and the first performance index data of the target query component is continuously acquired in real time.

[0023] Secondly, this application provides a query method switching device, applied to a service device, including:

[0024] First Acquisition Module: Used to acquire the first performance metric data of the target query component in real time;

[0025] First calculation module: used to calculate the first anomaly score of the target query component based on the first performance index data;

[0026] First comparison module: used to compare the first anomaly score with the score threshold;

[0027] The second acquisition module is used to acquire the second performance index data of the database query component at the current moment if the first abnormal score is greater than the score threshold.

[0028] The second calculation module is used to calculate the second anomaly score of the database query component based on the second performance index data.

[0029] The second comparison module is used to compare the first anomaly score with the second anomaly score.

[0030] First judgment module: used to determine the query method used at the current moment if the first abnormal score is greater than the second abnormal score;

[0031] First switching module: used to switch to the query method of the database query component if the current query method is the query method of the target query component;

[0032] The third calculation module is used to continuously and in real time acquire the first performance index data of the target query component, and calculate the first anomaly score of the target query component based on the first performance index data of the target query component.

[0033] The second judgment module is used to determine the query method used at the current moment if the first abnormal score is less than or equal to the score threshold.

[0034] The second switching module is used to switch to the query method of the target query component if the current query method is the query method of the database query component, and to continuously obtain the first performance index data of the target query component in real time.

[0035] In one possible design, the first performance metric data includes CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate recorded within a statistical period. The first calculation module is specifically configured to: obtain a first outlier based on the CPU utilization recorded within a statistical period according to a preset scoring rule; obtain a second outlier based on the disk utilization recorded within a statistical period according to a preset scoring rule; obtain a third outlier based on the memory utilization recorded within a statistical period according to a preset scoring rule; obtain a fourth outlier based on the cluster health status recorded within a statistical period according to a preset scoring rule; obtain a fifth outlier based on the request latency recorded within a statistical period according to a preset scoring rule; obtain a sixth outlier based on the query rejection rate recorded within a statistical period according to a preset scoring rule; and perform a weighted summation of the first, second, third, fourth, fifth, and sixth outliers according to a preset weight allocation to obtain a first outlier score for the target query component.

[0036] Thirdly, this application provides a service device, comprising: at least one processor and a memory;

[0037] The memory stores computer-executed instructions;

[0038] The at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the query mode switching method as described in the first aspect and various possible designs of the first aspect.

[0039] Fourthly, this application provides a computer storage medium storing computer execution instructions, which, when executed by a processor, implement the query method switching method described in the first aspect and various possible designs of the first aspect.

[0040] The query mode switching method, apparatus, service device, and storage medium provided in this application first calculate a first anomaly score based on the first performance index data of the acquired target query component, and compare the first anomaly score with a scoring threshold. If the first anomaly score is greater than the scoring threshold, a second anomaly score is calculated based on the second performance index data of the acquired database query component. Then, the first and second anomaly scores are compared. If the first anomaly score is greater than the second anomaly score, and the current query mode is the query mode of the target query component, the query mode is switched to the query mode of the database query component. The first performance index data of the target query component is continuously acquired in real time, and the first anomaly score is calculated. If the current first anomaly score is less than or equal to the scoring threshold, and the current query mode is the query mode of the database query component, the query mode is switched back to the query mode of the target query component. Continuously acquiring the first performance index data of the target query component in real time achieves the purpose of automatically switching between different query modes based on changes in the first performance index data, avoiding problems of excessively long operation time and low efficiency. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 This is a schematic diagram illustrating an application scenario of the query method switching method provided in the embodiments of this application;

[0043] Figure 2 A flowchart illustrating a query method switching method provided in one embodiment of this application;

[0044] Figure 3 A flowchart illustrating a query method switching method provided in another embodiment of this application;

[0045] Figure 4 This is a schematic diagram of the query method switching device provided in the embodiments of this application;

[0046] Figure 5 A schematic diagram of the hardware structure of the service device provided in the embodiments of this application. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0048] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0049] With the advent of the big data era, data volume is exploding, and enterprises and organizations need to quickly extract valuable information from massive amounts of data. Therefore, there is a demand for fast data retrieval—that is, efficiently retrieving the required information from large amounts of data within a limited time. To meet this demand, researchers and engineers have proposed many fast query methods, one of which is the query method of distributed search engines. However, in existing technologies, switching to fast query methods by having maintenance personnel log into the system and manually modify system parameters after a failure is time-consuming and inefficient.

[0050] To address the aforementioned technical problems, this application proposes the following technical concept: The service device defaults to providing a query method for a target query component with relatively high query efficiency. Based on this, the inventors conceived of calculating the anomaly score of the target query component based on its performance index data, and then comparing this anomaly score with an anomaly score threshold. Switching between the target query component and a backup database component is achieved based on different comparison results, while continuously acquiring the performance index data of the target query component in real time. This enables automatic control without manual intervention, thus achieving automatic switching between different query components.

[0051] Figure 1 This is a schematic diagram illustrating an application scenario for the query method switching method provided in this application embodiment. The scenario includes: a service device 101, a target query component 102, a database query component 103, a display device 104, and a terminal 105.

[0052] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the item recognition method. In other feasible embodiments of this application, the above architecture may include more or fewer components than illustrated, or combine some components, or split some components, or arrange different components, which can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown can be implemented in hardware, software, or a combination of both.

[0053] The target query component 102 is used to provide performance indicator data for the target query component; the database query component 103 is used to provide performance indicator data for the database query component.

[0054] Service device 101 is used to obtain performance index data of the target query component and the database query component, and to obtain anomaly scores and anomaly situations based on the performance index data.

[0055] Display device 104 is used to display various abnormal scores and abnormal situations output by service device 101.

[0056] Terminal 105 is used to receive abnormal situations of the database query component sent by service device 101.

[0057] The query method switching method provided in this application is intended to solve the above-mentioned technical problems in the prior art.

[0058] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0059] based on Figure 1 As shown in the application scenario, this application embodiment provides a query method switching method, applied to... Figure 1 The service equipment shown. Figure 2 A flowchart of a query method switching method provided in one embodiment of this application is shown below. Figure 2 As shown, the query method switching method includes:

[0060] S201: Obtain the first performance metric data of the target query component.

[0061] Among them, the target query component is a real-time distributed storage, search and analysis engine that can be used as a query component for ES (Elasticsearch, a distributed search engine).

[0062] The first performance metric data may include one or more of the following: CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate.

[0063] S202: Calculate the first anomaly score of the target query component based on the first performance index data.

[0064] Specifically, S202 includes:

[0065] S2021: According to the preset scoring rules, the first outlier is obtained based on the CPU usage recorded within a statistical period.

[0066] The preset scoring rule for CPU utilization is as follows: if the CPU utilization exceeds 80%, then for every 1% exceeding that, 20 points will be added.

[0067] The statistical period can be 1 minute.

[0068] CPU utilization is a key performance indicator in computers. This indicator measures the amount of time the CPU spends executing various tasks and processes.

[0069] S2022: According to the preset scoring rules, the second outlier is obtained based on the disk usage recorded within a statistical period.

[0070] The preset scoring rule for disk usage is as follows: if the disk usage exceeds 80%, then for every 1% exceeding that, 10 points will be added.

[0071] Disk utilization is a percentage of the time the disk spends processing input / output requests.

[0072] S2023: According to the preset scoring rules, the third outlier is obtained based on the memory usage rate recorded within a statistical period.

[0073] The preset scoring rule for memory usage is as follows: if the memory usage exceeds 80%, then for every 1% exceeding that, 20 points will be added.

[0074] Among them, memory utilization is an important indicator for measuring the utilization of system memory resources. It represents the proportion of physical memory currently in use by the system to the total available memory.

[0075] S2024: According to the preset scoring rules, the fourth outlier is obtained based on the cluster health status recorded within a statistical period.

[0076] Cluster health status can be divided into healthy and unhealthy.

[0077] The preset scoring rules for cluster health status can be as follows: if the cluster health status is healthy, the score is 0 points; if the cluster health status is unhealthy, the score is 100 points.

[0078] S2025: According to the preset scoring rules, the fifth outlier is obtained based on the request latency rate recorded within a statistical period.

[0079] The preset scoring rule for request latency rate is as follows: if the latency rate exceeds 80%, then for every 1% exceeding 80%, 20 points will be added.

[0080] Among them, request latency rate is a key indicator for measuring system performance, which mainly represents the time required from sending a request to receiving a response.

[0081] S2026: According to the preset scoring rules, the sixth outlier is obtained based on the query rejection rate recorded within a statistical period.

[0082] The preset scoring rule for query rejection rate is as follows: if the query rejection rate exceeds 80%, then for every 1% exceeding that, 20 points will be added.

[0083] The query rejection rate refers to the percentage of queries that were rejected by the cluster within a single period, out of the total number of queries.

[0084] S2027: According to the preset weight allocation, the first outlier, the second outlier, the third outlier, the fourth outlier, the fifth outlier and the sixth outlier are weighted and summed to obtain the first outlier score of the target query component.

[0085] The weights for different outliers can be: 20% for the first outlier, 10% for the second outlier, 20% for the third outlier, 30% for the fourth outlier, 10% for the fifth outlier, and 10% for the sixth outlier.

[0086] For example, assuming the CPU utilization is 90%, the cluster is unhealthy, the request latency is 85%, and the disk utilization, memory utilization, and query rejection rate do not meet the scoring criteria, then the first anomaly score is calculated to be 40 + 30 + 10 = 80 points. The mapping relationship between different outliers, scoring rules, and their weights in the first performance indicator data is shown in Table 1.

[0087] Table 1. Mapping Relationship between Outliers, Scoring Rules, and Weights

[0088] index Statistical period Scoring Rules Weight CPU utilization 1 minute For every 1% exceeding 80%, add 20 points. 20% Disk usage 1 minute For every 1% exceeding 80%, add 10 points. 10% Memory usage 1 minute For every 1% exceeding 80%, add 20 points. 20% Cluster health status 1 minute Healthy: 0 points; Unhealthy: 100 points 30% Request latency 1 minute For every 1% exceeding 80%, add 20 points. 10% Query rejection rate 1 minute For every 1% exceeding 80%, add 20 points. 10%

[0089] S203: Compare the first abnormality score with the scoring threshold.

[0090] For example, assuming the scoring threshold is 70 points, the CPU utilization is 90%, the cluster is unhealthy, the request latency is 85%, and the disk utilization, memory utilization, and query rejection rate do not meet the scoring criteria, the first anomaly score is calculated to be 40+30+10=80 points. Therefore, the first anomaly score is greater than the scoring threshold.

[0091] S204: If the first anomaly score is greater than the score threshold, then obtain the second performance index data of the database query component at the current moment.

[0092] The database query component includes at least one of the following: single-table query, join query, and union query.

[0093] The second performance metric data includes CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate recorded within a statistical period.

[0094] S205: Calculate the second anomaly score for the database query component based on the second performance metric data.

[0095] S206: Compare the first abnormality score with the second abnormality score.

[0096] S207: If the first abnormal score is greater than the second abnormal score, then determine the query method used at the current moment.

[0097] Determining which query component the service device is currently using requires different methods depending on the component. For example, for SQL Server (Structured Query Language Server, a relational database management system), running the "SELECT @@VERSION" command to obtain the current version information will return a version number starting with "8.0", indicating that SQL Server 2000 is being used; if the returned version number starts with "9.0", then SQL Server 2005 or a later version is being used.

[0098] S208: If the current query method is the query method of the target query component, then switch to the query method of the database query component.

[0099] For example, for SQL Server, you can use the "USE database_name" command to switch to the specified query component.

[0100] S209: Continuously acquire the first performance index data of the target query component in real time, and calculate the first anomaly score of the target query component based on the first performance index data of the target query component.

[0101] The purpose of continuously acquiring the first performance index data of the target query component in real time is to enable automatic switching between different query components in real time.

[0102] S210: If the first abnormal score is less than or equal to the score threshold, then determine the query method used at the current moment.

[0103] S211: If the current query method is the database query component's query method, then switch to the target query component's query method and continuously obtain the target query component's first performance index data in real time.

[0104] In summary, the process first calculates a first anomaly score based on the first performance metric data of the target query component and compares it with a scoring threshold. If the first anomaly score is greater than the scoring threshold, a second anomaly score is calculated based on the second performance metric data of the database query component. Then, the first and second anomaly scores are compared. If the first anomaly score is greater than the second anomaly score, and the current query method is the target query component's query method, the process switches to the database query component's query method. The first performance metric data of the target query component is continuously acquired in real-time, and the first anomaly score is calculated. If the current first anomaly score is less than or equal to the scoring threshold, and the current query method is the database query component's query method, the process switches back to the target query component's query method. This continuous real-time acquisition of the target query component's first performance metric data allows for automatic switching between different query methods based on changes in the first performance metric data, avoiding excessively long operation times and low efficiency.

[0105] Figure 3 This is a flowchart of a query method switching method provided in another embodiment of this application. Based on the above embodiment, this embodiment also describes other processes after the first abnormal score is less than or equal to a scoring threshold and after the first abnormal score is greater than the scoring threshold. The execution subject of this embodiment is also... Figure 1 The service facilities shown. For example... Figure 3 As shown, the method includes:

[0106] S301: Real-time acquisition of the first performance metric data of the target query component.

[0107] S302: Calculate the first anomaly score of the target query component based on the first performance index data.

[0108] S303: Compare the first abnormal score with the scoring threshold. If the first abnormal score is greater than the scoring threshold, proceed to S304; if the first abnormal score is less than or equal to the scoring threshold, proceed to S312.

[0109] In this embodiment, the contents of steps S307, S308, S310, S312, and S313 are the same as those of steps S201-S211. Please refer to steps S201-S211 for details, which will not be repeated here.

[0110] S304: Retrieve the second performance metric data of the database query component at the current moment.

[0111] S305: Calculate the second anomaly score for the database query component based on the second performance metric data.

[0112] S306: Compare the first abnormal score with the second abnormal score. If the first abnormal score is less than or equal to the second abnormal score, proceed to S307; if the first abnormal score is greater than the second abnormal score, proceed to S309.

[0113] S307: Output the first and second anomaly scores, as well as the anomalies of the target query component and the database query component; and continue to execute the step of S301 to obtain the first performance index data of the target query component in real time.

[0114] S308: Send the abnormal situation of the target query component and the abnormal situation of the database query component to the maintenance personnel's terminal.

[0115] S309: Determine the query method currently in use. If it is the query method of the database query component, execute S310; if it is the query method of the target query component, execute S311.

[0116] S310: Output the first anomaly score and the anomaly status of the target query component; and continue to execute the step of S301 to obtain the first performance index data of the target query component in real time.

[0117] S311: Switch to the query mode of the database query component; continue to execute the step of S301 to obtain the first performance index data of the target query component in real time.

[0118] S312: Determine the query method currently in use. If it is the query method of the database query component, execute S313; if it is the query method of the target query component, execute S314.

[0119] S313: Switch to the query mode of the target query component and continue to execute the step of S301 to obtain the first performance index data of the target query component in real time.

[0120] S314: Output the first anomaly score and continue to execute the step of S301 to obtain the first performance index data of the target query component in real time.

[0121] In summary, if the first anomaly score is less than or equal to the score threshold, and the current query method is determined to be the query method of the target query component, then the anomaly score and anomaly status are output; if the first anomaly score is less than or equal to the second anomaly score, then the anomaly score and anomaly status are output; if the first anomaly score is greater than the second anomaly score, and the current query method is determined to be the query method of the database query component, then the anomaly score and anomaly status are output. These three descriptions more clearly illustrate how the service device automatically switches the query method according to different situations, ensuring the accuracy and stability of the query method switching.

[0122] Figure 4 This is a schematic diagram of the query method switching device provided in an embodiment of this application. Figure 4 As shown, the query method switching device is applied to a service device and includes: a first acquisition module 401, a first calculation module 402, a first comparison module 403, a second acquisition module 404, a second calculation module 405, a second comparison module 406, a first judgment module 407, a first switching module 408, a third calculation module 409, a second judgment module 410, and a second switching module 411.

[0123] First acquisition module 401: Used to acquire the first performance index data of the target query component in real time;

[0124] First calculation module 402: used to calculate the first anomaly score of the target query component based on the first performance index data;

[0125] First comparison module 403: used to compare the first anomaly score with the score threshold;

[0126] The second acquisition module 404 is used to acquire the second performance index data of the database query component at the current moment if the first abnormal score is greater than the score threshold.

[0127] Second calculation module 405: used to calculate the second anomaly score of the database query component based on the second performance index data;

[0128] Second comparison module 406: used to compare the first anomaly score with the second anomaly score;

[0129] First judgment module 407: Used to determine the query method used at the current time if the first abnormal score is greater than the second abnormal score;

[0130] First switching module 408: Used to switch to the query method of the database query component if the current query method is the query method of the target query component;

[0131] The third calculation module 409 is used to continuously and in real time acquire the first performance index data of the target query component, and calculate the first anomaly score of the target query component based on the first performance index data of the target query component.

[0132] Second judgment module 410: used to determine the query method used at the current time if the first abnormal score is less than or equal to the score threshold;

[0133] The second switching module 411 is used to switch to the query method of the target query component if the current query method is the query method of the database query component, and continuously obtain the first performance index data of the target query component in real time.

[0134] In one possible design, the first performance metric data includes CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate recorded within a statistical period; the first calculation module 402 is specifically used for: wherein the first performance metric data includes CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate recorded within a statistical period; correspondingly, based on the first performance metric data, calculating a first anomaly score for the target query component, including: obtaining a first anomaly value according to a preset scoring rule based on the CPU utilization recorded within a statistical period; and calculating a first anomaly score according to a preset scoring rule based on a... The disk usage rate recorded within a statistical period is used to obtain the second outlier; the memory usage rate recorded within a statistical period is used to obtain the third outlier according to the preset scoring rules; the cluster health status recorded within a statistical period is used to obtain the fourth outlier according to the preset scoring rules; the request latency rate recorded within a statistical period is used to obtain the fifth outlier according to the preset scoring rules; the query rejection rate recorded within a statistical period is used to obtain the sixth outlier according to the preset scoring rules; the first, second, third, fourth, fifth, and sixth outliers are weighted and summed according to the preset weight allocation to obtain the first outlier score of the target query component.

[0135] In one possible design, the above-mentioned device further includes:

[0136] The third judgment module 412 is used to determine the query method used at the current moment if the first abnormal score is less than or equal to the score threshold.

[0137] First output module 413: If the query method used at the current moment is the query method of the target query component, output the first anomaly score; and continuously obtain the first performance index data of the target query component in real time.

[0138] In one possible design, the above-mentioned device further includes:

[0139] The second output module 414 is used to output the first abnormal score and the second abnormal score, as well as the abnormal situation of the target query component and the database query component, if the first abnormal score is less than or equal to the second abnormal score; and to continuously acquire the first performance index data of the target query component in real time.

[0140] In one possible design, the above-mentioned device further includes:

[0141] Sending module 415: Used to send abnormal situations of the target query component and the database query component to the maintenance personnel's terminal.

[0142] In one possible design, the above-mentioned device further includes:

[0143] The third output module 416 is used to output the first anomaly score and the anomaly status of the target query component if the current query method is the query method of the database query component; and to continuously obtain the first performance index data of the target query component in real time.

[0144] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0145] Figure 5 A schematic diagram of the hardware structure of the service device provided in the embodiments of this application. For example... Figure 5 As shown, the service device includes: at least one processor 501 and a memory 502; the memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, causing at least one processor to execute the above-described query mode switching method.

[0146] Alternatively, the memory 502 can be either standalone or integrated with the processor 501.

[0147] When the memory 502 is set up independently, the service device also includes a bus 503 for connecting the memory 502 and the processor 501.

[0148] This application also provides a computer storage medium storing computer execution instructions. When the processor executes the computer execution instructions, the above-mentioned query method switching method is implemented.

[0149] This application also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-described query method switching method.

[0150] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.

[0151] The modules described above as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to implement the solution of this embodiment according to actual needs.

[0152] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.

[0153] The integrated modules implemented as software functional modules described above can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application.

[0154] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0155] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.

[0156] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0157] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.

[0158] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.

[0159] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for switching query modes, characterized in that, Applied to service equipment, including: Real-time acquisition of the first performance metric data of the target query component; Based on the first performance index data, calculate the first anomaly score of the target query component; The first abnormal score is compared with the score threshold; If the first abnormal score is greater than the score threshold, then the second performance index data of the database query component at the current moment is obtained; Based on the second performance metric data, calculate the second anomaly score of the database query component; Compare the first anomaly score with the second anomaly score; If the first anomaly score is greater than the second anomaly score, then determine the query method used at the current moment; If the current query method is the query method of the target query component, then switch to the query method of the database query component; Continuously acquire the first performance index data of the target query component in real time, and calculate the first anomaly score of the target query component based on the first performance index data of the target query component; If the first abnormal score is less than or equal to the score threshold, then determine the query method used at the current moment; If the current query method is the database query component's query method, then switch to the target query component's query method and continuously obtain the target query component's first performance indicator data in real time.

2. The method of claim 1, wherein, The first performance metric data includes CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate recorded within a statistical period. Accordingly, calculating the first anomaly score of the target query component based on the first performance metric data includes: According to the preset scoring rules, the first outlier is obtained based on the CPU usage recorded within a statistical period. According to the preset scoring rules, the second outlier is obtained based on the disk usage recorded within a statistical period. According to the preset scoring rules, the third outlier is obtained based on the memory usage rate recorded within a statistical period. According to the preset scoring rules, the fourth outlier is obtained based on the cluster health status recorded within a statistical period. According to the preset scoring rules, the fifth outlier is obtained based on the request latency rate recorded within a statistical period. According to the preset scoring rules, the sixth outlier is obtained based on the query rejection rate recorded within a statistical period. According to the preset weight allocation, the first outlier, the second outlier, the third outlier, the fourth outlier, the fifth outlier, and the sixth outlier are weighted and summed to obtain the first outlier score of the target query component.

3. The method of claim 1, wherein, After comparing the first abnormal score with the score threshold, the method further includes: If the first abnormal score is less than or equal to the score threshold, then determine the query method used at the current moment; If the query method used at the current moment is the query method of the target query component, then the first anomaly score is output; and the first performance index data of the target query component is continuously obtained in real time.

4. The method of claim 1, wherein, After comparing the first anomaly score with the second anomaly score, the method further includes: If the first anomaly score is less than or equal to the second anomaly score, then the first anomaly score and the second anomaly score, as well as the anomaly status of the target query component and the anomaly status of the database query component, are output; and the first performance index data of the target query component is continuously acquired in real time.

5. The method of claim 4, wherein, After outputting the first anomaly score and the second anomaly score, as well as the anomalies of the target query component and the database query component, the method further includes: Send the abnormal situation of the target query component and the abnormal situation of the database query component to the maintenance personnel's terminal.

6. The method according to any one of claims 1 to 5, characterized in that, If the first anomaly score is greater than the second anomaly score, then after determining the query method used at the current moment, the method further includes: If the query method used at the current moment is the query method of the database query component, then the first anomaly score and the anomaly status of the target query component are output; and the first performance index data of the target query component are continuously acquired in real time.

7. A query mode switching device, characterized by comprising: Applied to service equipment, including: First Acquisition Module: Used to acquire the first performance metric data of the target query component in real time; First calculation module: used to calculate the first anomaly score of the target query component based on the first performance index data; First comparison module: used to compare the first abnormal score with the score threshold; The second acquisition module is used to acquire the second performance index data of the database query component at the current moment if the first abnormal score is greater than the score threshold. The second calculation module is used to calculate the second anomaly score of the database query component based on the second performance index data. The second comparison module is used to compare the first anomaly score with the second anomaly score. First judgment module: used to determine the query method used at the current moment if the first abnormal score is greater than the second abnormal score; First switching module: used to switch to the query method of the database query component if the current query method is the query method of the target query component; The third calculation module is used to continuously and in real time acquire the first performance index data of the target query component, and calculate the first anomaly score of the target query component based on the first performance index data of the target query component. The second judgment module is used to determine the query method used at the current moment if the first abnormal score is less than or equal to the score threshold. The second switching module is used to switch to the query method of the target query component if the current query method is the query method of the database query component, and to continuously obtain the first performance index data of the target query component in real time.

8. The apparatus of claim 7, wherein, The first performance metric data includes CPU utilization, disk utilization, memory utilization, cluster health status, request latency, and query rejection rate recorded within a statistical period. The first calculation module is specifically used to: obtain a first outlier based on the CPU usage recorded within a statistical period according to a preset scoring rule; obtain a second outlier based on the disk usage recorded within a statistical period according to a preset scoring rule; obtain a third outlier based on the memory usage recorded within a statistical period according to a preset scoring rule; obtain a fourth outlier based on the cluster health status recorded within a statistical period according to a preset scoring rule; obtain a fifth outlier based on the request latency rate recorded within a statistical period according to a preset scoring rule; and obtain a sixth outlier based on the query rejection rate recorded within a statistical period according to a preset scoring rule. According to the preset weight allocation, the first outlier, the second outlier, the third outlier, the fourth outlier, the fifth outlier, and the sixth outlier are weighted and summed to obtain the first outlier score of the target query component.

9. A service device, characterized by At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the query mode switching method as described in any one of claims 1 to 6.

10. A computer storage medium, characterized in that, The computer storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, it implements the query mode switching method as described in any one of claims 1 to 6.