Database monitoring method, device, equipment and storage medium
By collecting and analyzing multiple preset indicator information of the ClickHouse database, generating measurement indicators and monitoring it, the problem that the existing technology cannot accurately monitor the ClickHouse database is solved, and more accurate database monitoring and early warning are achieved.
Patent Information
- Application Number
- CN202210067284.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2042-01-20
AI Technical Summary
The existing database monitoring scheme cannot accurately monitor the ClickHouse database because the ClickHouse database uses parallel computing models and greedy resource usage strategies, resulting in sudden increase in some indicators, and the existing monitoring scheme cannot effectively handle this situation.
A database monitoring method is proposed, by collecting multiple preset indicator information, generating measurement indicators, and monitoring them based on these indicator information. The method includes collecting indicator information within the first preset period, generating monitoring information, detecting whether it is in the measurement indicator, and making predictions if it is in the measurement indicator, and generating alarm information if the prediction information exceeds the measurement indicator.
This method can accurately monitor the database, avoid monitoring inaccurate problems caused by greedy strategies, and improve the availability and user experience of the database through prediction and alarm mechanisms.
Smart Images

Figure CN114490262B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of monitoring technology, and in particular to a database monitoring method, device, equipment and storage medium. Background Art
[0002] During the operation of the database, it is necessary to monitor the operation status of the database in real time, so that users can be quickly reminded when the database is running abnormally. In the current database monitoring solution, it is often determined whether the database is abnormal by monitoring a single indicator in the database. However, for the ClickHouse database, since the ClickHouse database uses parallel computing models and greedy strategies such as resource usage strategies in its design, it is common for a certain indicator of the ClickHouse database to suddenly increase, which makes the current database monitoring solution unable to accurately monitor the ClickHouse database. Summary of the invention
[0003] In view of the above, it is necessary to provide a database monitoring method, device, equipment and storage medium that can accurately monitor the database.
[0004] In one aspect, the present invention provides a database monitoring method, the database monitoring method comprising:
[0005] When a monitoring request is received, index information of the database to be monitored within a first preset time period is collected according to the monitoring request and the preset index;
[0006] Generate a measurement indicator according to the dimension information of the database to be monitored in a preset dimension, wherein the preset dimension includes a resource dimension and a service dimension;
[0007] Generate monitoring information of the database to be monitored on the preset dimension according to the indicator information;
[0008] detecting whether the monitoring information is within the measurement index;
[0009] If the monitoring information is within the measurement index, predicting the database to be monitored in a second preset time period according to the monitoring information to obtain prediction information of the database to be monitored;
[0010] When it is detected that the predicted information exceeds the measurement index, alarm information of the database to be monitored is generated according to the predicted information.
[0011] According to a preferred embodiment of the present invention, collecting indicator information of the database to be monitored within a first preset time period according to the monitoring request and the preset indicator includes:
[0012] Identifying the database to be monitored from the monitoring request, wherein the monitoring request carries a database identifier of the database to be monitored;
[0013] Locate the target server corresponding to the database to be monitored from the preset routing table, and obtain the server identifier of the target server;
[0014] Writing the database identifier, the server identifier, the preset index and the first preset time period into a preset search instruction to obtain a query statement;
[0015] The query statement is run based on a preset monitoring tool to obtain the indicator information.
[0016] According to a preferred embodiment of the present invention, the resource dimensions include resource utilization, resource saturation and error rate, and the service dimensions include the number of requests per second, the number of errors per second and request response time.
[0017] According to a preferred embodiment of the present invention, the indicator information includes CPU usage, number of CPUs, number of first tasks being executed, number of second tasks to be executed, number of third tasks that have been completed, merge tree depth, and number of crashes. The monitoring information of the database to be monitored on the preset dimension generated according to the indicator information includes:
[0018] The monitoring information of the database to be monitored on the resource utilization is generated according to the CPU utilization, the first task quantity and the number of CPUs. The calculation formula of the monitoring information of the database to be monitored on the resource utilization is: Wherein, u refers to the resource utilization, a refers to the CPU utilization, m1 refers to the first task quantity, n refers to the number of CPUs, and k is a non-zero parameter;
[0019] The monitoring information of the database to be monitored on the resource saturation is generated according to the first task quantity, the second task quantity and the merge tree depth. The calculation formula of the monitoring information of the database to be monitored on the resource saturation is: Wherein, s refers to the resource saturation, m2 refers to the number of the second tasks, and h refers to the depth of the merged tree;
[0020] The monitoring information of the database to be monitored on the error rate is generated according to the number of the third tasks and the number of crashes. The calculation formula of the monitoring information of the database to be monitored on the error rate is: Wherein, e refers to the error rate, m3 refers to the number of the third tasks, and b refers to the number of crashes.
[0021] According to a preferred embodiment of the present invention, generating a measurement indicator according to the dimension information of the database to be monitored on a preset dimension includes:
[0022] Acquire the dimension information from the database to be monitored based on the preset dimension;
[0023] Acquire the target ratio of the preset dimension from the configuration table of the database to be monitored;
[0024] The product of the dimension information and the target ratio is calculated to obtain the measurement index.
[0025] According to a preferred embodiment of the present invention, the step of predicting the database to be monitored in a second preset time period according to the monitoring information to obtain the prediction information of the database to be monitored includes:
[0026] Obtaining the collection time of the generation indicator of the monitoring information in the database to be monitored as the monitoring time;
[0027] Sorting the monitoring information according to the collection time to obtain an information list;
[0028] Calculate the dimension growth rate of each information pair in the information list, where the information pair includes any two adjacent monitoring information in the information list. The calculation formula for the dimension growth rate is: Wherein, v refers to the growth rate of the dimension, s1 and s2 are respectively the monitoring information of the information pair, and t1 and t2 are respectively the monitoring time of the information pair;
[0029] Calculate the average of the growth rates of the multiple dimensions to obtain an average rate;
[0030] The average rate is adjusted based on a preset adjustment ratio to obtain a threshold range;
[0031] The database to be monitored is predicted in the preset dimension and the second preset time period according to the monitoring information and the domain value range to obtain the prediction information.
[0032] According to a preferred embodiment of the present invention, generating the alarm information of the database to be monitored according to the prediction information includes:
[0033] Locate a target time at which the prediction information exceeds the measurement indicator from the second preset time period;
[0034] The warning information is generated according to the target time and the target prediction information that exceeds the measurement index.
[0035] On the other hand, the present invention further provides a database monitoring device, the database monitoring device comprising:
[0036] A collection unit, configured to collect index information of the database to be monitored within a first preset time period according to the monitoring request and preset indicators when receiving a monitoring request;
[0037] A generating unit, configured to generate a measurement indicator according to dimension information of the database to be monitored in a preset dimension, wherein the preset dimension includes a resource dimension and a service dimension;
[0038] The generating unit is further configured to generate monitoring information of the database to be monitored on the preset dimension according to the indicator information;
[0039] A detection unit, configured to detect whether the monitoring information is within the measurement index;
[0040] A prediction unit, configured to predict the database to be monitored in a second preset time period according to the monitoring information if the monitoring information is within the measurement index, to obtain prediction information of the database to be monitored;
[0041] The generating unit is further configured to generate alarm information of the database to be monitored according to the predicted information when it is detected that the predicted information exceeds the measurement indicator.
[0042] On the other hand, the present invention further provides an electronic device, comprising:
[0043] a memory storing computer readable instructions; and
[0044] The processor executes the computer-readable instructions stored in the memory to implement the database monitoring method.
[0045] On the other hand, the present invention further proposes a computer-readable storage medium, in which computer-readable instructions are stored. The computer-readable instructions are executed by a processor in an electronic device to implement the database monitoring method.
[0046] It can be seen from the above technical solutions that the present invention monitors the database to be monitored in combination with the resource dimension and the service dimension, which can avoid the inability to accurately monitor the database to be monitored due to the existence of a greedy strategy in the database to be monitored. Furthermore, the database to be monitored is predicted in the second preset time period based on the monitoring information, and the prediction information of the database to be monitored in the second preset time period can be accurately predicted based on the trend of the monitoring information in the first preset time period. When it is detected that the prediction information exceeds the measurement indicator, the alarm information can be generated in time, and the database to be monitored can be warned in advance, thereby avoiding the user's inability to access the database to be monitored due to the temporary collapse of the database to be monitored, thereby improving the warning capability of the database to be monitored. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a flow chart of a preferred embodiment of the database monitoring method of the present invention.
[0048] Figure 2 It is a functional module diagram of a preferred embodiment of the database monitoring device of the present invention.
[0049] Figure 3 It is a structural schematic diagram of an electronic device of a preferred embodiment of the database monitoring method of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0051] like Figure 1 FIG. 1 is a flow chart of a preferred embodiment of the database monitoring method of the present invention. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
[0052] The database monitoring method can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0053] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0054] The database monitoring method is applied to one or more electronic devices, which are devices that can automatically perform numerical calculations and / or information processing according to pre-set or stored computer-readable instructions, and whose hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0055] The electronic device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0056] The electronic device may include a network device and / or a user device. The network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of multiple network electronic devices, or a cloud consisting of a large number of hosts or network electronic devices based on cloud computing.
[0057] The network where the electronic device is located includes, but is not limited to: the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0058] S10, when a monitoring request is received, index information of the database to be monitored within a first preset time period is collected according to the monitoring request and preset indicators.
[0059] In at least one embodiment of the present invention, the monitoring request may be triggered to be generated upon receiving a monitoring requirement.
[0060] The preset indicator refers to a basic indicator that has a certain operation relationship with the preset dimension, wherein the preset dimension includes a resource dimension and a service dimension.
[0061] The first preset time period may refer to any time period that needs to be monitored. The first preset time period refers to a period of time, for example, the first preset time period may be 9:00-10:00.
[0062] The indicator information may be specific time series information of the database to be monitored on the preset indicator and the first preset time period. The indicator information includes CPU usage, number of CPUs, number of first tasks being executed, number of second tasks to be executed, number of third tasks that have been completed, merge tree depth, and number of crashes.
[0063] In at least one embodiment of the present invention, the electronic device collecting indicator information of the database to be monitored within the first preset time period according to the monitoring request and the preset indicator includes:
[0064] Identifying the database to be monitored from the monitoring request, wherein the monitoring request carries a database identifier of the database to be monitored;
[0065] Locate the target server corresponding to the database to be monitored from the preset routing table, and obtain the server identifier of the target server;
[0066] Writing the database identifier, the server identifier, the preset index and the first preset time period into a preset search instruction to obtain a query statement;
[0067] The query statement is run based on a preset monitoring tool to obtain the indicator information.
[0068] The preset routing table stores mapping relationships between multiple servers and databases.
[0069] The preset search instruction is used to perform data query on a certain object. It can be understood that the query statement is used to query the indicator information of the monitored database on both the preset indicator and the first preset time period.
[0070] The preset monitoring tool may include Promethues, which is responsible for collecting monitoring indicator data as a monitoring tool.
[0071] The target server can be accurately located through the preset routing table, and then the indicator information can be accurately collected from the preset monitoring tool in combination with the target server and the database to be monitored, which is conducive to accurate monitoring of the database to be monitored.
[0072] S11, generating a measurement indicator according to dimension information of the database to be monitored in preset dimensions, where the preset dimensions include resource dimensions and service dimensions.
[0073] In at least one embodiment of the present invention, the resource dimension includes resource utilization, resource saturation and error rate, and the service dimension includes the number of requests per second, the number of errors per second and request response time.
[0074] In at least one embodiment of the present invention, the measurement index refers to the maximum operating limit requirement of the database to be monitored in the preset dimension. For example, the measurement index of the database to be monitored in the resource utilization is: 30%-60%, the measurement index of the database to be monitored in the resource saturation is: 0-80%, the measurement index of the database to be monitored in the error rate is 0, etc.
[0075] In at least one embodiment of the present invention, the electronic device generates a measurement indicator according to the dimension information of the database to be monitored on a preset dimension, including:
[0076] Acquire the dimension information from the database to be monitored based on the preset dimension;
[0077] Acquire the target ratio of the preset dimension from the configuration table of the database to be monitored;
[0078] The product of the dimension information and the target ratio is calculated to obtain the measurement index.
[0079] The dimension information includes information about the resource utilization, resource saturation, error rate, number of requests per second, number of errors per second and request response time of the database to be monitored.
[0080] The configuration table records the mapping relationship between each preset dimension and the maximum operating limit requirement.
[0081] The configuration table can be used to accurately obtain the maximum operating limit requirements of the database to be monitored in the preset dimension, so that the measurement index can be accurately generated in combination with the target ratio and the dimensional information, which is helpful for detecting whether there are any operating abnormalities in the database to be monitored.
[0082] S12: Generate monitoring information of the database to be monitored on the preset dimension according to the indicator information.
[0083] In at least one embodiment of the present invention, the monitoring information refers to information of the database to be monitored corresponding to the preset dimension within the first preset time period. It is understandable that the monitoring information is time series information.
[0084] In at least one embodiment of the present invention, the electronic device generates monitoring information of the to-be-monitored database on the preset dimension according to the indicator information, including:
[0085] The monitoring information of the database to be monitored on the resource utilization is generated according to the CPU utilization, the first task quantity and the number of CPUs. The calculation formula of the monitoring information of the database to be monitored on the resource utilization is: Wherein, u refers to the resource utilization, a refers to the CPU utilization, m1 refers to the first task quantity, n refers to the number of CPUs, and k is a non-zero parameter;
[0086] The monitoring information of the database to be monitored on the resource saturation is generated according to the first task quantity, the second task quantity and the merge tree depth. The calculation formula of the monitoring information of the database to be monitored on the resource saturation is: Wherein, s refers to the resource saturation, m2 refers to the number of the second tasks, and h refers to the depth of the merged tree;
[0087] The monitoring information of the database to be monitored on the error rate is generated according to the number of the third tasks and the number of crashes. The calculation formula of the monitoring information of the database to be monitored on the error rate is: Wherein, e refers to the error rate, m3 refers to the number of the third tasks, and b refers to the number of crashes.
[0088] Among them, k can be adjusted according to the stress test situation of the database to be monitored. Specifically, when k=0.5, the resource utilization of the database to be monitored reaches the best. It can be understood that when k is set to 0.5 when calculating the monitoring information of the database to be monitored on the resource utilization, k in calculating the measurement index of the database to be monitored on the resource utilization should also be set to 0.5.
[0089] The merge tree depth refers to the upper limit of the amount of data that can be merged at the same time.
[0090] Through the above implementation, the monitoring information of the database to be monitored in the preset dimension can be accurately generated.
[0091] S13, detecting whether the monitoring information is within the measurement index.
[0092] In at least one embodiment of the present invention, for each preset dimension, the electronic device detects whether each monitoring information is within the corresponding measurement indicator. If any monitoring information exceeds the measurement indicator, an alarm message is generated based on the monitoring information that exceeds the measurement indicator.
[0093] S14: If the monitoring information is within the measurement index, predicting the database to be monitored in a second preset time period according to the monitoring information to obtain prediction information of the database to be monitored.
[0094] In at least one embodiment of the present invention, the prediction information refers to information predicted by the database to be monitored in the second preset time period and the preset dimension.
[0095] In at least one embodiment of the present invention, the electronic device predicts the database to be monitored in a second preset time period according to the monitoring information, and obtaining the prediction information of the database to be monitored includes:
[0096] Obtaining the collection time of the generation indicator of the monitoring information in the database to be monitored as the monitoring time;
[0097] Sorting the monitoring information according to the collection time to obtain an information list;
[0098] Calculate the dimension growth rate of each information pair in the information list, where the information pair includes any two adjacent monitoring information in the information list. The calculation formula for the dimension growth rate is: Wherein, v refers to the growth rate of the dimension, s1 and s2 are respectively the monitoring information of the information pair, and t1 and t2 are respectively the monitoring time of the information pair;
[0099] Calculate the average of the growth rates of the multiple dimensions to obtain an average rate;
[0100] The average rate is adjusted based on a preset adjustment ratio to obtain a threshold range;
[0101] The database to be monitored is predicted in the preset dimension and the second preset time period according to the monitoring information and the domain value range to obtain the prediction information.
[0102] The preset adjustment ratio may be a ratio range value, for example, the preset adjustment ratio may be 90%-125%.
[0103] By taking the collection time of the generation index of the monitoring information in the database to be monitored as the monitoring time, the monitoring information can be accurately sorted, so that the dimension growth rate can be accurately calculated, and then the average rate is adjusted based on the preset adjustment ratio, thereby improving the tolerance of the dimension growth rate. Then, the monitoring information and the domain value range are combined to predict the database to be monitored on the preset dimension and the second preset time period, which can improve the reliability of the predicted information.
[0104] S15, when it is detected that the predicted information exceeds the measurement index, generating alarm information of the database to be monitored according to the predicted information.
[0105] In at least one embodiment of the present invention, the alarm information includes target prediction information exceeding the measurement indicator and the time at which the target prediction information is located.
[0106] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned alarm information, the above-mentioned alarm information can also be stored in a node of a blockchain.
[0107] In at least one embodiment of the present invention, the electronic device generating the alarm information of the database to be monitored according to the prediction information includes:
[0108] Locate a target time at which the prediction information exceeds the measurement indicator from the second preset time period;
[0109] The warning information is generated according to the target time and the target prediction information that exceeds the measurement index.
[0110] In at least one embodiment of the present invention, after generating the alarm information of the database to be monitored according to the prediction information, the method further includes:
[0111] Obtaining a triggering user of the monitoring request and a binding terminal of the triggering user;
[0112] The alarm information is sent to the binding terminal.
[0113] Through the above implementation, the triggering user can be reminded in time when the alarm information is generated.
[0114] It can be seen from the above technical solutions that the present invention monitors the database to be monitored in combination with the resource dimension and the service dimension, which can avoid the inability to accurately monitor the database to be monitored due to the existence of a greedy strategy in the database to be monitored. Furthermore, the database to be monitored is predicted in the second preset time period based on the monitoring information, and the prediction information of the database to be monitored in the second preset time period can be accurately predicted based on the trend of the monitoring information in the first preset time period. When it is detected that the prediction information exceeds the measurement indicator, the alarm information can be generated in time, and the database to be monitored can be warned in advance, thereby avoiding the user's inability to access the database to be monitored due to the temporary collapse of the database to be monitored, thereby improving the warning capability of the database to be monitored.
[0115] like Figure 2 , which is a functional module diagram of a preferred embodiment of the database monitoring device of the present invention. The database monitoring device 11 includes a collection unit 110, a generation unit 111, a detection unit 112, a prediction unit 113, an acquisition unit 114 and a sending unit 115. The module / unit referred to in the present invention refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can complete a fixed function, which is stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0116] When receiving a monitoring request, the collecting unit 110 collects the indicator information of the database to be monitored within a first preset time period according to the monitoring request and the preset indicator.
[0117] In at least one embodiment of the present invention, the monitoring request may be triggered to be generated upon receiving a monitoring requirement.
[0118] The preset indicator refers to a basic indicator that has a certain operation relationship with the preset dimension, wherein the preset dimension includes a resource dimension and a service dimension.
[0119] The first preset time period may refer to any time period that needs to be monitored. The first preset time period refers to a period of time, for example, the first preset time period may be 9:00-10:00.
[0120] The indicator information may be specific time series information of the database to be monitored on the preset indicator and the first preset time period. The indicator information includes CPU usage, number of CPUs, number of first tasks being executed, number of second tasks to be executed, number of third tasks that have been completed, merge tree depth, and number of crashes.
[0121] In at least one embodiment of the present invention, the collecting unit 110 collects the indicator information of the to-be-monitored database within the first preset period according to the monitoring request and the preset indicator, including:
[0122] Identifying the database to be monitored from the monitoring request, wherein the monitoring request carries a database identifier of the database to be monitored;
[0123] Locate the target server corresponding to the database to be monitored from the preset routing table, and obtain the server identifier of the target server;
[0124] Writing the database identifier, the server identifier, the preset index and the first preset time period into a preset search instruction to obtain a query statement;
[0125] The query statement is run based on a preset monitoring tool to obtain the indicator information.
[0126] The preset routing table stores mapping relationships between multiple servers and databases.
[0127] The preset search instruction is used to perform data query on a certain object. It can be understood that the query statement is used to query the indicator information of the monitored database on both the preset indicator and the first preset time period.
[0128] The preset monitoring tool may include Promethues, which is responsible for collecting monitoring indicator data as a monitoring tool.
[0129] The target server can be accurately located through the preset routing table, and the indicator information can be accurately collected from the preset monitoring tool in combination with the target server and the database to be monitored, which is conducive to accurate monitoring of the database to be monitored.
[0130] The generating unit 111 generates a measurement indicator according to dimension information of the database to be monitored in preset dimensions, where the preset dimensions include resource dimensions and service dimensions.
[0131] In at least one embodiment of the present invention, the resource dimensions include resource utilization, resource saturation and error rate, and the service dimensions include the number of requests per second, the number of errors per second and request response time.
[0132] In at least one embodiment of the present invention, the measurement index refers to the maximum operating limit requirement of the database to be monitored. For example, the measurement index of the database to be monitored on the resource utilization is: 30%-60%, the measurement index of the database to be monitored on the resource saturation is: 0-80%, the measurement index of the database to be monitored on the error rate is 0, etc.
[0133] In at least one embodiment of the present invention, the generating unit 111 generates the measurement indicator according to the dimension information of the database to be monitored on the preset dimension, including:
[0134] Acquire the dimension information from the database to be monitored based on the preset dimension;
[0135] Acquire the target ratio of the preset dimension from the configuration table of the database to be monitored;
[0136] The product of the dimension information and the target ratio is calculated to obtain the measurement index.
[0137] The dimension information includes information about the resource utilization, resource saturation, error rate, number of requests per second, number of errors per second and request response time of the database to be monitored.
[0138] The configuration table records the mapping relationship between each preset dimension and the maximum operating limit requirement.
[0139] The configuration table can be used to accurately obtain the maximum operating limit requirements of the database to be monitored in the preset dimension, so that the measurement index can be accurately generated in combination with the target ratio and the dimensional information, which is helpful for detecting whether there are any operating abnormalities in the database to be monitored.
[0140] The generating unit 111 generates monitoring information of the database to be monitored on the preset dimension according to the indicator information.
[0141] In at least one embodiment of the present invention, the monitoring information refers to information of the database to be monitored corresponding to the preset dimension within the first preset time period. It is understandable that the monitoring information is time series information.
[0142] In at least one embodiment of the present invention, the generating unit 111 generates the monitoring information of the to-be-monitored database on the preset dimension according to the indicator information, including:
[0143] The monitoring information of the database to be monitored on the resource utilization is generated according to the CPU utilization, the first task quantity and the number of CPUs. The calculation formula of the monitoring information of the database to be monitored on the resource utilization is: Wherein, u refers to the resource utilization, a refers to the CPU utilization, m1 refers to the first task quantity, n refers to the number of CPUs, and k is a non-zero parameter;
[0144] The monitoring information of the database to be monitored on the resource saturation is generated according to the first task quantity, the second task quantity and the merge tree depth. The calculation formula of the monitoring information of the database to be monitored on the resource saturation is: Wherein, s refers to the resource saturation, m2 refers to the number of the second tasks, and h refers to the depth of the merged tree;
[0145] The monitoring information of the database to be monitored on the error rate is generated according to the number of the third tasks and the number of crashes. The calculation formula of the monitoring information of the database to be monitored on the error rate is: Wherein, e refers to the error rate, m3 refers to the number of the third tasks, and b refers to the number of crashes.
[0146] Among them, k can be adjusted according to the stress test situation of the database to be monitored. Specifically, when k=0.5, the resource utilization of the database to be monitored reaches the best. It can be understood that when k is set to 0.5 when calculating the monitoring information of the database to be monitored on the resource utilization, k in calculating the measurement index of the database to be monitored on the resource utilization should also be set to 0.5.
[0147] The merge tree depth refers to the upper limit of the amount of data that can be merged at the same time.
[0148] Through the above implementation, the monitoring information of the database to be monitored in the preset dimension can be accurately generated.
[0149] The detection unit 112 detects whether the monitoring information is within the measurement index.
[0150] In at least one embodiment of the present invention, for each preset dimension, the detection unit 112 detects whether each monitoring information is within the corresponding measurement indicator. If any monitoring information exceeds the measurement indicator, an alarm information is generated based on the monitoring information that exceeds the measurement indicator.
[0151] If the monitoring information is within the measurement index, the prediction unit 113 predicts the database to be monitored in a second preset time period according to the monitoring information to obtain prediction information of the database to be monitored.
[0152] In at least one embodiment of the present invention, the prediction information refers to information predicted by the database to be monitored in the second preset time period and the preset dimension.
[0153] In at least one embodiment of the present invention, the prediction unit 113 predicts the database to be monitored in a second preset time period according to the monitoring information, and the prediction information of the database to be monitored includes:
[0154] Obtaining the collection time of the generation indicator of the monitoring information in the database to be monitored as the monitoring time;
[0155] Sorting the monitoring information according to the collection time to obtain an information list;
[0156] Calculate the dimension growth rate of each information pair in the information list, where the information pair includes any two adjacent monitoring information in the information list. The calculation formula for the dimension growth rate is: Wherein, v refers to the growth rate of the dimension, s1 and s2 are respectively the monitoring information of the information pair, and t1 and t2 are respectively the monitoring time of the information pair;
[0157] Calculate the average of the growth rates of the multiple dimensions to obtain an average rate;
[0158] The average rate is adjusted based on a preset adjustment ratio to obtain a threshold range;
[0159] The database to be monitored is predicted in the preset dimension and the second preset time period according to the monitoring information and the domain value range to obtain the prediction information.
[0160] The preset adjustment ratio may be a ratio range value, for example, the preset adjustment ratio may be 90%-125%.
[0161] By taking the collection time of the generation index of the monitoring information in the database to be monitored as the monitoring time, the monitoring information can be accurately sorted, so that the dimension growth rate can be accurately calculated, and then the average rate is adjusted based on the preset adjustment ratio, thereby improving the tolerance of the dimension growth rate. Then, the monitoring information and the domain value range are combined to predict the database to be monitored on the preset dimension and the second preset time period, which can improve the reliability of the predicted information.
[0162] When it is detected that the prediction information exceeds the measurement index, the generating unit 111 generates alarm information of the database to be monitored according to the prediction information.
[0163] In at least one embodiment of the present invention, the alarm information includes target prediction information exceeding the measurement indicator and the time at which the target prediction information is located.
[0164] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned alarm information, the above-mentioned alarm information can also be stored in a node of a blockchain.
[0165] In at least one embodiment of the present invention, the generating unit 111 generates the alarm information of the database to be monitored according to the prediction information, including:
[0166] Locate a target time at which the prediction information exceeds the measurement indicator from the second preset time period;
[0167] The warning information is generated according to the target time and the target prediction information that exceeds the measurement index.
[0168] In at least one embodiment of the present invention, after generating the alarm information of the database to be monitored according to the prediction information, the acquisition unit 114 acquires the triggering user of the monitoring request and acquires the binding terminal of the triggering user;
[0169] The sending unit 115 sends the warning information to the bound terminal.
[0170] Through the above implementation, the triggering user can be reminded in time when the alarm information is generated.
[0171] It can be seen from the above technical solutions that the present invention monitors the database to be monitored in combination with the resource dimension and the service dimension, which can avoid the inability to accurately monitor the database to be monitored due to the existence of a greedy strategy in the database to be monitored. Furthermore, the database to be monitored is predicted in the second preset time period based on the monitoring information, and the prediction information of the database to be monitored in the second preset time period can be accurately predicted based on the trend of the monitoring information in the first preset time period. When it is detected that the prediction information exceeds the measurement indicator, the alarm information can be generated in time, and the database to be monitored can be warned in advance, thereby avoiding the user's inability to access the database to be monitored due to the temporary collapse of the database to be monitored, thereby improving the warning capability of the database to be monitored.
[0172] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device of a preferred embodiment of the database monitoring method of the present invention.
[0173] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer-readable instructions stored in the memory 12 and executable on the processor 13, such as a database monitoring program.
[0174] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the electronic device 1 may also include input and output devices, network access devices, buses, etc.
[0175] The processor 13 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 13 is the computing core and control center of the electronic device 1, and uses various interfaces and lines to connect various parts of the entire electronic device 1, and executes the operating system of the electronic device 1 and various installed applications, program codes, etc.
[0176] Exemplarily, the computer-readable instructions may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer-readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into a collection unit 110, a generation unit 111, a detection unit 112, a prediction unit 113, an acquisition unit 114, and a sending unit 115.
[0177] The memory 12 can be used to store the computer-readable instructions and / or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12, and calling the data stored in the memory 12. The memory 12 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device, etc. The memory 12 can include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.
[0178] The memory 12 may be an external memory and / or an internal memory of the electronic device 1. Furthermore, the memory 12 may be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.
[0179] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware to complete it through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned various method embodiments can be implemented.
[0180] The computer-readable instructions include computer-readable instruction codes, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).
[0181] The blockchain referred to in the present invention is a new application model of computer technologies such as distributed database monitoring, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0182] Combination Figure 1 The memory 12 in the electronic device 1 stores computer-readable instructions to implement a database monitoring method, and the processor 13 can execute the computer-readable instructions to implement:
[0183] When a monitoring request is received, index information of the database to be monitored within a first preset time period is collected according to the monitoring request and the preset index;
[0184] Generate a measurement indicator according to the dimension information of the database to be monitored in the preset dimension, wherein the preset dimension includes a resource dimension and a service dimension;
[0185] Generate monitoring information of the database to be monitored on the preset dimension according to the indicator information;
[0186] detecting whether the monitoring information is within the measurement index;
[0187] If the monitoring information is within the measurement index, predicting the database to be monitored in a second preset time period according to the monitoring information to obtain prediction information of the database to be monitored;
[0188] When it is detected that the predicted information exceeds the measurement index, alarm information of the database to be monitored is generated according to the predicted information.
[0189] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer readable instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0190] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0191] The computer-readable storage medium stores computer-readable instructions, wherein the computer-readable instructions are used to implement the following steps when executed by the processor 13:
[0192] When a monitoring request is received, index information of the database to be monitored within a first preset time period is collected according to the monitoring request and the preset index;
[0193] Generate a measurement indicator according to the dimension information of the database to be monitored in the preset dimension, wherein the preset dimension includes a resource dimension and a service dimension;
[0194] Generate monitoring information of the database to be monitored on the preset dimension according to the indicator information;
[0195] detecting whether the monitoring information is within the measurement index;
[0196] If the monitoring information is within the measurement index, predicting the database to be monitored in a second preset time period according to the monitoring information to obtain prediction information of the database to be monitored;
[0197] When it is detected that the predicted information exceeds the measurement index, alarm information of the database to be monitored is generated according to the predicted information.
[0198] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0199] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0200] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0201] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices mentioned can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0202] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A database monitoring method, characterized in that: The database monitoring method comprises: When a monitoring request is received, the indicator information of the monitored database within a first preset time period is collected according to the monitoring request and the preset indicators, wherein the indicator information includes CPU utilization, number of CPUs, number of first tasks being executed, number of second tasks to be executed, number of third tasks that have been completed, merge tree depth, and number of crashes; Generate a measurement indicator according to the dimension information of the database to be monitored on the preset dimension, the preset dimension includes a resource dimension and a service dimension, the resource dimension includes resource utilization, resource saturation and error rate, and the service dimension includes the number of requests per second, the number of errors per second and request response time; Generating monitoring information of the database to be monitored on the preset dimension according to the indicator information includes: generating monitoring information of the database to be monitored on the resource utilization according to the CPU utilization, the first task quantity and the number of CPUs, and the calculation formula of the monitoring information of the database to be monitored on the resource utilization is: ,in, refers to the resource utilization rate, refers to the CPU utilization, refers to the first task quantity, refers to the number of CPUs, is a non-zero parameter; and the monitoring information of the to-be-monitored database on the resource saturation is generated according to the first task quantity, the second task quantity and the merge tree depth, and the calculation formula of the monitoring information of the to-be-monitored database on the resource saturation is: ,in, refers to the resource saturation, refers to the second task quantity, Refers to the merge tree depth; the monitoring information of the database to be monitored on the error rate is generated according to the number of the third tasks and the number of crashes, and the calculation formula of the monitoring information of the database to be monitored on the error rate is: ,in, is the error rate, refers to the third task quantity, is the number of said crashes; detecting whether the monitoring information is within the measurement index; If the monitoring information is within the measurement index, predicting the database to be monitored in a second preset time period according to the monitoring information to obtain prediction information of the database to be monitored; When it is detected that the predicted information exceeds the measurement index, alarm information of the database to be monitored is generated according to the predicted information.
2. The database monitoring method according to claim 1, characterized in that: The collecting of indicator information of the to-be-monitored database within the first preset period according to the monitoring request and the preset indicator comprises: Identifying the database to be monitored from the monitoring request, wherein the monitoring request carries a database identifier of the database to be monitored; Locate the target server corresponding to the database to be monitored from the preset routing table, and obtain the server identifier of the target server; Writing the database identifier, the server identifier, the preset index and the first preset time period into a preset search instruction to obtain a query statement; The query statement is run based on a preset monitoring tool to obtain the indicator information.
3. The database monitoring method according to claim 1, characterized in that: The step of generating a measurement indicator according to the dimension information of the database to be monitored on a preset dimension includes: Acquire the dimension information from the database to be monitored based on the preset dimension; Acquire the target ratio of the preset dimension from the configuration table of the database to be monitored; The product of the dimension information and the target ratio is calculated to obtain the measurement index.
4. The database monitoring method according to claim 1, characterized in that: The step of predicting the database to be monitored in a second preset time period according to the monitoring information to obtain the prediction information of the database to be monitored includes: Obtaining the collection time of the generation indicator of the monitoring information in the database to be monitored as the monitoring time; Sorting the monitoring information according to the collection time to obtain an information list; Calculate the dimension growth rate of each information pair in the information list, where the information pair includes any two adjacent monitoring information in the information list. The calculation formula for the dimension growth rate is: ,in, is the growth rate of the dimension, are respectively monitoring information of the information pair, are respectively the monitoring moments of the information pairs; Calculate the average of the growth rates of the multiple dimensions to obtain an average rate; The average rate is adjusted based on a preset adjustment ratio to obtain a threshold range; The database to be monitored is predicted in the preset dimension and the second preset time period according to the monitoring information and the domain value range to obtain the prediction information.
5. The database monitoring method according to claim 1, characterized in that: The generating of the alarm information of the database to be monitored according to the prediction information includes: Locate a target time at which the prediction information exceeds the measurement indicator from the second preset time period; The warning information is generated according to the target time and the target prediction information that exceeds the measurement index.
6. A database monitoring device, characterized in that: The database monitoring device comprises: a collection unit, configured to, when receiving a monitoring request, collect indicator information of the database to be monitored within a first preset time period according to the monitoring request and preset indicators, wherein the indicator information includes CPU utilization, number of CPUs, number of first tasks being executed, number of second tasks to be executed, number of third tasks that have been completed, merge tree depth, and number of crashes; A generating unit, configured to generate a measurement indicator according to dimension information of the database to be monitored in preset dimensions, wherein the preset dimensions include resource dimensions and service dimensions, wherein the resource dimensions include resource utilization, resource saturation and error rate, and the service dimensions include the number of requests per second, the number of errors per second and the request response time; The generating unit is further used to generate monitoring information of the database to be monitored on the preset dimension according to the indicator information, including: generating monitoring information of the database to be monitored on the resource utilization according to the CPU utilization, the first task quantity and the number of CPUs, and the calculation formula of the monitoring information of the database to be monitored on the resource utilization is: ,in, refers to the resource utilization rate, refers to the CPU utilization, refers to the first task quantity, refers to the number of CPUs, is a non-zero parameter; and the monitoring information of the to-be-monitored database on the resource saturation is generated according to the first task quantity, the second task quantity and the merge tree depth, and the calculation formula of the monitoring information of the to-be-monitored database on the resource saturation is: ,in, refers to the resource saturation, refers to the second task quantity, Refers to the merge tree depth; the monitoring information of the database to be monitored on the error rate is generated according to the number of the third tasks and the number of crashes, and the calculation formula of the monitoring information of the database to be monitored on the error rate is: ,in, is the error rate, refers to the third task quantity, is the number of said crashes; A detection unit, configured to detect whether the monitoring information is within the measurement index; A prediction unit, configured to predict the database to be monitored in a second preset time period according to the monitoring information if the monitoring information is within the measurement index, to obtain prediction information of the database to be monitored; The generating unit is further configured to generate alarm information of the database to be monitored according to the predicted information when it is detected that the predicted information exceeds the measurement indicator.
7. An electronic device, characterized in that: The electronic device comprises: a memory storing computer-readable instructions; and A processor executes computer-readable instructions stored in the memory to implement the database monitoring method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the database monitoring method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Big data application optimization method and device and storage medium
CN110990154A
Data monitoring method and device, computer equipment and storage medium
CN111143163A