Data query method, device, electronic device, and storage medium

By filtering target data sources based on connectivity and integrity information for data query, the unavailability and inaccurate query results in the data query system are solved, and the reliability and accuracy of the data query service are achieved.

CN114547069BActive Publication Date: 2025-08-01BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210099519.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-27
Publication Date
2025-08-01
Estimated Expiration
2042-01-27

AI Technical Summary

Technical Problem

In the existing data query system, when the data source is deployed in different service areas, the service is prone to be unavailable due to failures, and the data source differences in different regions lead to low accuracy of query results.

Method used

By receiving data query requests, the availability information of multiple preconfigured data sources is determined, the target data source is filtered based on connectivity and integrity information, and data query is performed and query results are returned.

Benefits of technology

Ensure the reliability of data query services, improve the accuracy of query results, avoid service interruptions caused by failure of a single data source, and optimize the matching of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114547069B_ABST
    Figure CN114547069B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data query method, apparatus, electronic device, and storage medium. The present disclosure relates to the technical field of data processing, specifically to the technical field of data intelligent search, and can be applied to scenarios such as bill query. The specific implementation solution is as follows: receiving a data query request; in response to the data query request, determining the availability information of each data source among multiple pre-configured data sources; based on the availability information of each data source, screening a target data source from the multiple pre-configured data sources; performing data query from the target data source and returning a query result. The above method avoids the unavailability of the data query service due to the failure of a certain data source, and ensures the operational reliability of the data query service; screening the target data source based on connectivity information and integrity information can largely ensure that the target data source can provide the query results expected by the user, which helps to improve the accuracy of the query results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of data processing, specifically to the technical field of data intelligent search, and can be applied to scenarios such as bill query. Background Art

[0002] In existing data query systems, data sources are usually deployed in different service areas, and each data source is used to provide data query services for users within the corresponding service area. However, when a data source deployed within a service area fails, the data query service within that service area becomes unavailable; in addition, there may be differences between data sources in different service areas, and the query results provided by the data source for users within the same service area may not fully match the actual needs of the users, easily resulting in low accuracy of the query results obtained by the users. Summary of the Invention

[0003] The present disclosure provides a data query method, apparatus, electronic device, and storage medium.

[0004] According to the first aspect of the present disclosure, a data query method is provided, including:

[0005] Receiving a data query request;

[0006] Responding to the data query request and determining the availability information of each data source among multiple pre-configured data sources;

[0007] Based on the availability information of each data source, screening target data sources from the multiple pre-configured data sources;

[0008] Querying data from the target data source and returning the query result.

[0009] According to the second aspect of the present disclosure, a data query apparatus is provided, including:

[0010] A request receiving module, configured to receive a data query request;

[0011] An information obtaining module, configured to respond to the data query request and determine the availability information of each data source among multiple pre-configured data sources;

[0012] A target determining module, configured to screen target data sources from the multiple pre-configured data sources based on the availability information of each data source;

[0013] A data query module, configured to query data from the target data source and return the query result.

[0014] According to the third aspect of the present disclosure, an electronic device is provided, including:

[0015] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above data query method.

[0016] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the above data query method.

[0017] According to a fifth aspect of the present disclosure, there is provided a computer program product including a computer program, where the computer program implements the above data query method when executed by a processor.

[0018] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description.

[0019] The beneficial effects brought by the technical solution provided by the present disclosure are:

[0020] In the technical solution of the present disclosure, a matching target data source can be screened out for a data query request from multiple data sources, avoiding the unavailability of the data query service due to the failure of a certain data source and ensuring the operational reliability of the data query service; moreover, screening the target data source based on connectivity information and integrity information can largely ensure that the target data source can provide the query results expected by the user, which helps to improve the accuracy of the query results. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:

[0022] Figure 1 shows a schematic flowchart of a data query method provided by an embodiment of the present disclosure;

[0023] Figure 2 shows a schematic flowchart of another data query method provided by an embodiment of the present disclosure;

[0024] Figure 3 shows a schematic flowchart of a process for calculating a computing load index;

[0025] Figure 4 shows a schematic diagram of a data query device provided by an embodiment of the present disclosure;

[0026] Figure 5FIG. 0 shows a schematic block diagram of an exemplary electronic device that can be used to implement the data query method provided by the embodiments of the present disclosure. DETAILED IMPLEMENTATION MANNER

[0027] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following.

[0028] In the data query system in the related art, usually, each data source is deployed in a different service area, and each data source is used to provide data query services for users within the corresponding service area to ensure high availability of the data source for users and reduce performance problems caused by network latency.

[0029] However, when a data source deployed within a service area fails, the data query service within that service area will become unavailable. In addition, there may be differences between data sources in different service areas. For example, there may be differences in the connectivity, integrity, load conditions, and data structure characteristics of the data sources, which may cause the query results provided by the data sources for users within the same service area not to fully match the actual needs of the users. As a result, the accuracy of the query results obtained by the users is not high, affecting the user experience.

[0030] The data query method, apparatus, electronic device, and storage medium provided by the embodiments of the present disclosure are intended to solve at least one of the above technical problems in the prior art.

[0031] Embodiments of the present disclosure can provide a data query system, and the data query system can be pre-configured with multiple data sources. It can be understood that the data types included in the data source can be determined based on the business scenario served by the data query system. Taking the data query system for serving the bill query business as an example, the data source can include the bill transaction data of users, and the bill transaction data can store all the transaction details of users since history.

[0032] In the embodiments of the present disclosure, some data sources in the data query system may be copies of other data sources, and each data source may be stored in different hardware devices. Since there are differences in the update situations of the data sources, the connectivity and integrity of each data source will be different; due to the different environments where the data sources are located (such as different configuration parameters of hardware devices and different network environments), the load situations of each data source will be different; due to the differences in the types of databases deployed by the data sources and the configuration parameters of the databases, the data and data structure characteristics of each data source will be different. The data query method provided by the embodiments of the present disclosure can, for a user's data query request, determine a target data source that matches the data query request from these different data sources, and perform data query from the target data source. This solution can avoid the unavailability of the data query service caused by the failure of a certain data source, ensuring the operational reliability of the data query service; and, by screening the target data source based on the connectivity information and integrity information, it can largely ensure that the target data source can provide the query results expected by the user, which helps to improve the accuracy of the query results.

[0033] Figure 1 The flowchart of a data query method provided by the embodiments of the present disclosure is shown, as Figure 1 shown, the method mainly may include the following steps:

[0034] S110: Receive a data query request.

[0035] The execution subject of the embodiments of the present disclosure may receive a data query request sent by a user through a user terminal, and the data query request may include information related to the data expected to be requested by the user.

[0036] S120: In response to the data query request, determine the availability information of each data source among a plurality of pre-configured data sources.

[0037] In the embodiments of the present disclosure, the availability information can be used to evaluate whether a data source is available or the degree of its availability. Here, the availability information includes at least one of connectivity information and integrity information. The connectivity information is the test result obtained by performing a connectivity test on the data source, and the connectivity information is used to indicate whether the data source can be accessed. The integrity information is obtained by counting the return rate of the query results of the data source, and the integrity information is used to indicate the data integrity of the data source.

[0038] Embodiments of the present disclosure can obtain the connectivity information of a data source based on some characteristics inherent in the data source. For example, a connectivity test can be performed on the data source based on the select1 statement of the data source to obtain a test result, and the test result can be used as the connectivity information of the data source. The business module of the system in the embodiments of the present disclosure can continuously monitor and record the data source, count the return rate of the query results of the data source, and generate integrity information based on the return rate. It can be understood that the higher the return rate, the higher the data integrity of the data source.

[0039] S130: Filter out target data sources from multiple pre-configured data sources based on the availability information of each data source.

[0040] As shown above, the availability information can be used to evaluate whether a data source is available or the degree of its availability. Embodiments of the present disclosure filter out target data sources by determining whether a data source has availability, or filter out target data sources by the level of availability of the data source.

[0041] The availability information includes at least one of connectivity information and integrity information. Embodiments of the present disclosure can filter out target data sources based on at least one of the connectivity information and integrity information. The following is the process of filtering out target data sources for different situations.

[0042] Optionally, when filtering out target data sources only based on connectivity information, data sources that can be accessed can be filtered out from multiple pre-configured data sources based on the connectivity information of each data source; the data sources that can be accessed are determined as target data sources.

[0043] As described above, the connectivity information is used to indicate whether a data source can be accessed. When the connectivity information of only one data source indicates that the data source can be accessed, it can be determined that the data source has availability, and this data source is determined as the target data source. When the connectivity information of multiple data sources indicates that the corresponding data sources can be accessed, continue to determine the level of availability of each data source based on the operating conditions of each data source, and determine the data source with the highest availability as the target data source.

[0044] Optionally, when filtering out target data sources only based on integrity information, data sources whose return rate exceeds a preset threshold can be filtered out from multiple pre-configured data sources based on the integrity information of each data source; the data sources whose return rate exceeds the preset threshold are determined as target data sources.

[0045] As described above, the integrity information is used to indicate the data integrity of the data source. When the integrity information of only one data source indicates that its return rate exceeds the preset threshold, it can be determined that the data source is available, and this data source is determined as the target data source. When the integrity information of multiple data sources indicates that their return rates exceed the preset threshold, one of the multiple data sources can be selected as the target data source.

[0046] Optionally, when filtering the target data source based on the connectivity information and the integrity information, the data sources that can be accessed can be filtered out from multiple pre-configured data sources based on the connectivity information of each data source; the data sources whose return rates exceed the preset threshold can be filtered out from multiple pre-configured data sources based on the integrity information of each data source; the data sources that can be accessed and whose return rates exceed the preset threshold are determined as the target data sources.

[0047] As described above, the connectivity information is used to indicate whether the data source can be accessed, and the integrity information is used to indicate the data integrity of the data source. When the connectivity information of only one data source indicates that the data source can be accessed and the integrity information of the data source indicates that its return rate exceeds the preset threshold, it can be determined that the data source is available, and this data source is determined as the target data source. When the connectivity information of multiple data sources indicates that the data sources can be accessed and the integrity information of the data sources indicates that their return rates exceed the preset threshold, the availability levels of each data source are continuously determined based on the operating conditions of each data source, and the data source with the highest availability is determined as the target data source.

[0048] S140: Query data from the target data source and return the query result.

[0049] As described above, the data query request may include information related to the data expected to be requested by the user. Relevant data can be queried from the target data source based on this information, and the queried data is returned to the user's terminal as the query result. It should be noted here that if no target data source is determined in step S130, the response to the data query request received in step S110 is stopped, and no data is queried for this data query request.

[0050] Optionally, in the above step S130 of the embodiments of the present disclosure, after filtering the data sources based on the availability information, the data sources can be further filtered based on the load metrics of the data sources to obtain the target data sources. Specifically, the embodiments of the present disclosure can filter multiple first candidate data sources from multiple pre-configured data sources based on the availability information of each data source; calculate the load metrics of each first candidate data source; and filter the target data sources from the multiple first candidate data sources based on the load metrics of each first candidate data source. Here, the load metric is used to indicate the number of requests that a first candidate data source can currently respond to.

[0051] Optionally, after filtering the data sources through the availability information and the load metrics, the embodiments of the present disclosure can further filter the data sources based on the structural performance metrics of the data sources to obtain the target data sources. Specifically, the embodiments of the present disclosure can filter multiple first candidate data sources from multiple pre-configured data sources based on the availability information of each data source; calculate the load metrics of each first candidate data source; filter multiple second candidate data sources with load metrics greater than the load metric threshold from the multiple first candidate data sources based on the load metrics of each first candidate data source; obtain the structural performance metrics of each second candidate data source; and filter the target data sources from the multiple second candidate data sources based on the structural performance metrics of each second candidate data source. Here, the load metric is used to indicate the number of requests that a first candidate data source can currently respond to, and the structural performance metric is used to indicate the structural characteristics of the data in the second candidate data source.

[0052] The data query method provided by the embodiments of the present disclosure can filter matching target data sources for a data query request from multiple data sources, avoiding the unavailability of the data query service due to the failure of a certain data source and ensuring the running reliability of the data query service; moreover, filtering the target data source based on the connectivity information and the integrity information can largely ensure that the target data source can provide the query results expected by the user, which helps to improve the accuracy of the query results.

[0053] Figure 2 FIG. shows a schematic flowchart of a data query method provided by the embodiments of the present disclosure, as Figure 2 shown, the method mainly includes the following steps:

[0054] S201: Receive a data query request.

[0055] The execution subject of the embodiments of the present disclosure can receive the data query request sent by the user through the user terminal, and the data query request can include information related to the data expected to be requested by the user.

[0056] S202: In response to a data query request, determine the availability information of each data source among multiple pre-configured data sources.

[0057] In the embodiments of the present disclosure, the availability information can be used to evaluate whether a data source is available or the degree of its availability. Here, the availability information includes at least one of connectivity information and integrity information. The connectivity information is the test result obtained by performing a connectivity test on the data source, and the connectivity information is used to indicate whether the data source can be accessed. The integrity information is obtained by counting the return rate of the query results of the data source, and the integrity information is used to indicate the data integrity of the data source.

[0058] The embodiments of the present disclosure can obtain the connectivity information of the data source based on some characteristics of the data source itself. For example, the connectivity test can be performed on the data source based on the select 1 statement of the data source, so as to obtain the test result, and the test result is used as the connectivity information of the data source. The business module of the system in the embodiments of the present disclosure can continuously monitor and record the data source, count the return rate of the query results of the data source, and generate integrity information based on the return rate. It can be understood that the higher the return rate, the higher the data integrity of the data source.

[0059] After step S202 in the embodiments of the present disclosure, step S203 or step S204 can be executed.

[0060] S203: Based on the availability information of each data source, screen out the target data source from multiple pre-configured data sources.

[0061] As shown above, the availability information can be used to evaluate whether a data source is available or the degree of its availability. In the embodiments of the present disclosure, the target data source is screened out by determining whether the data source has availability, or the target data source is screened out by the level of the availability of the data source.

[0062] The availability information includes at least one of connectivity information and integrity information. The embodiments of the present disclosure can use at least one of the connectivity information and integrity information as the screening basis to screen out the target data source. The following is the process of screening the target data source for different situations.

[0063] Optionally, when only using the connectivity information as the screening basis to screen out the target data source, based on the connectivity information of each data source, the data sources that can be accessed can be screened out from multiple pre-configured data sources; and the data sources that can be accessed are determined as the target data sources.

[0064] As described above, the connectivity information is used to indicate whether a data source can be accessed. When the connectivity information of only one data source indicates that the data source can be accessed, it can be determined that the data source is available, and this data source is determined as the target data source. When the connectivity information of multiple data sources indicates that the corresponding data sources can be accessed, continue to determine the availability level of each data source based on the operating conditions of each data source, and determine the data source with the highest availability as the target data source.

[0065] Optionally, when filtering the target data source only based on the integrity information, data sources with a return rate exceeding a preset threshold can be filtered out from multiple pre-configured data sources based on the integrity information of each data source; the data sources with a return rate exceeding the preset threshold are determined as the target data sources.

[0066] As described above, the integrity information is used to indicate the data integrity of the data source. When the integrity information of only one data source indicates that its return rate exceeds the preset threshold, it can be determined that the data source is available, and this data source is determined as the target data source. When the integrity information of multiple data sources indicates that their return rates exceed the preset threshold, one of the multiple data sources can be selected as the target data source.

[0067] Optionally, when filtering the target data source based on the connectivity information and the integrity information, data sources that can be accessed can be filtered out from multiple pre-configured data sources based on the connectivity information of each data source; data sources with a return rate exceeding the preset threshold can be filtered out from multiple pre-configured data sources based on the integrity information of each data source; the data sources that can be accessed and have a return rate exceeding the preset threshold are determined as the target data sources.

[0068] As described above, the connectivity information is used to indicate whether a data source can be accessed, and the integrity information is used to indicate the data integrity of the data source. When the connectivity information of only one data source indicates that the data source can be accessed and the integrity information of the data source indicates that its return rate exceeds the preset threshold, it can be determined that the data source is available, and this data source is determined as the target data source. When the connectivity information of multiple data sources indicates that the data sources can be accessed and the integrity information of the data sources indicates that their return rates exceed the preset threshold, continue to determine the availability level of each data source based on the operating conditions of each data source, and determine the data source with the highest availability as the target data source.

[0069] After step S203 in the embodiments of the present disclosure, step S210 is executed. It should be noted here that if no target data source is determined in step S203, the data query request received in step S201 is stopped from being responded to, and data is no longer queried for this data query request, and the process ends.

[0070] S204: Based on the availability information of each data source, filter multiple first candidate data sources from multiple pre-configured data sources.

[0071] As shown above, the availability information can be used to evaluate whether a data source is available or the degree of its availability. In the embodiments of the present disclosure, the first candidate data sources are filtered by determining whether the data source has availability, or the first candidate data sources are filtered by the level of the availability of the data source.

[0072] The availability information includes at least one of connectivity information and integrity information. In the embodiments of the present disclosure, at least one of the connectivity information and the integrity information can be used as a filtering basis to filter the first candidate data sources. The following is the process of filtering the first candidate data sources for different situations.

[0073] Optionally, when only the connectivity information is used as the filtering basis to filter the first candidate data sources, the data sources that can be accessed can be filtered from multiple pre-configured data sources based on the connectivity information of each data source; and the data sources that can be accessed are determined as the first candidate data sources.

[0074] As described above, the connectivity information is used to indicate whether a data source can be accessed. When the connectivity information of only one data source indicates that the data source can be accessed, it can be determined that the data source has availability, and this data source is determined as the first candidate data source. When the connectivity information of multiple data sources indicates that the corresponding data sources can be accessed, continue to determine the level of availability of each data source based on the operating conditions of each data source, and determine the data source with the highest availability as the first candidate data source.

[0075] Optionally, when only the integrity information is used as the filtering basis to filter the first candidate data sources, the data sources whose return rate exceeds a preset threshold can be filtered from multiple pre-configured data sources based on the integrity information of each data source; and the data sources whose return rate exceeds the preset threshold are determined as the first candidate data sources.

[0076] As described above, the integrity information is used to indicate the data integrity of the data source. When the integrity information of only one data source indicates that its return rate exceeds the preset threshold, it can be determined that the data source has availability, and this data source is determined as the first candidate data source. When the integrity information of multiple data sources indicates that their return rates exceed the preset threshold, one can be selected from the multiple data sources as the first candidate data source.

[0077] Optionally, when screening the first candidate data source based on connectivity information and integrity information, data sources that can be accessed can be screened out from multiple pre-configured data sources based on the connectivity information of each data source; data sources with a return rate exceeding a preset threshold can be screened out from multiple pre-configured data sources based on the integrity information of each data source; and data sources that can be accessed and have a return rate exceeding the preset threshold are determined as the first candidate data sources.

[0078] As described above, the connectivity information is used to indicate whether a data source can be accessed, and the integrity information is used to indicate the data integrity of the data source. When the connectivity information of only one data source indicates that the data source can be accessed and the integrity information of the data source indicates that its return rate exceeds the preset threshold, it can be determined that the data source is available, and this data source is determined as the first candidate data source. When the connectivity information of multiple data sources indicates that the data source can be accessed and the integrity information of the data source indicates that its return rate exceeds the preset threshold, the availability level of each data source is continuously determined based on the operating conditions of each data source, and the data source with the highest availability is determined as the first candidate data source.

[0079] After step S204 in the embodiment of the present disclosure, step S205 is executed.

[0080] S205: Calculate the load metrics of each first candidate data source.

[0081] The load metrics are used to indicate the number of requests that the first candidate data source can currently respond to. In the embodiment of the present disclosure, the load metrics of the first candidate data source can be calculated through relevant data of the first candidate data source. For example, the load metrics of the first candidate data source can be calculated based on the query success rate, resource idle rate, and request response time metrics of the first candidate data source.

[0082] In the embodiment of the present disclosure, a preset time interval can be used as a statistical period, and the query success rate, resource idle rate, and request response time metrics of the first candidate data source can be obtained based on the data of the first candidate data source within the statistical period.

[0083] Optionally, in the embodiment of the present disclosure, the total number of data query requests received by the first candidate data source within the Nth statistical period and the number of failures of the first candidate data source to successfully return query results for the received data query requests within the Nth statistical period can be counted. It can be understood that the ratio of the above-mentioned number of failures to the total number is the query failure rate of the first candidate data source, and the query success rate of the first candidate data source is the absolute value of the difference between 1 and the query failure rate.

[0084] Optionally, there is an upper limit on the number of data query requests that the first candidate data source can respond to simultaneously. In the embodiments of the present disclosure, the maximum number of data query requests that the first candidate data source can respond to simultaneously can be defined as the maximum number. In the embodiments of the present disclosure, the real-time number of data query requests currently and actually responded to by the first candidate data source can be counted, the ratio of the above real-time number to the maximum number can be calculated, and the absolute value of the difference between 1 and the ratio can be used as the resource idle rate.

[0085] Optionally, in the embodiments of the present disclosure, the request response time index of the first candidate data source can be calculated by the following formula: T = 1 / (1 + e ^ (T N -T N-1 )); where T is the request response time index of the first candidate data source, T N is the average request response time of the Nth statistical period, and T N-1 is the average request response time of the (N - 1)th statistical period, and N is a positive integer.

[0086] The current operating condition of the first candidate data source can be determined based on the query success rate, the resource idle rate, and the request response time index, as follows:

[0087] 1. When the resource idle rate of the first candidate data source is high and the request response time index is high, it indicates that the first candidate data source receives fewer data query requests and the running speed of the first candidate data source is relatively fast. In the above situation, when the query success rate is low, the first candidate data source is in a network fluctuation scenario.

[0088] 2. When the resource idle rate of the first candidate data source is low and the request response time index is low, it indicates that the number of data query requests received by the first candidate data source is close to saturation, and the running speed of the first candidate data source is close to the upper limit.

[0089] 3. When the resource idle rate of the first candidate data source is high and the request response time index is low, it indicates that the first candidate data source receives fewer data query requests, but the running speed of the first candidate data source is close to the upper limit, and the first candidate data source is in a large query scenario.

[0090] 4. When the resource idle rate of the first candidate data source is low and the request response time index is high, it indicates that the number of data query requests received by the first candidate data source is close to saturation, and the first candidate data source has a large number of small query scenarios.

[0091] Optionally, in the embodiments of the present disclosure, the query success rate, the resource idle rate, and the request response time index of the first candidate data source can be obtained; the sum value of the query success rate, the resource idle rate, and the request response time index can be calculated, and the sum value can be used as the load index of the first candidate data source.

[0092] Optionally, when calculating the sum value of the query success rate, resource idle rate, and request response time metrics and using the sum value as the load metric of the first candidate data source in the embodiments of the present disclosure, the weight coefficients pre-configured for calculating the query success rate, resource idle rate, and request response time metrics can be determined respectively; based on the query success rate, resource idle rate, and request response time metrics, as well as the weight coefficients corresponding to the query success rate, resource idle rate, and request response time metrics respectively, a weighted sum value is calculated; and the weighted sum value is used as the load metric of the first candidate data source.

[0093] After step S205 in the embodiments of the present disclosure, step S206 or step S207 can be executed.

[0094] S206: Screen the target data source from multiple first candidate data sources based on the load metric of each first candidate data source.

[0095] In the embodiments of the present disclosure, the larger the load metric of the first candidate data source, the stronger the current load-bearing capacity of the first candidate data source. Therefore, in the embodiments of the present disclosure, the first candidate data source with the largest load metric can be screened out from multiple first candidate data sources based on the load metric of each first candidate data source, and the first candidate data source with the largest load metric is determined as the target data source.

[0096] After step S206 in the embodiments of the present disclosure, step S210 is executed. It should be noted here that if no target data source is determined in step S206, the response to the data query request received in step S201 is stopped, and data is no longer queried for this data query request, and the process ends.

[0097] S207: Screen out multiple second candidate data sources with load metrics greater than the load metric threshold from multiple first candidate data sources based on the load metric of each first candidate data source.

[0098] In the embodiments of the present disclosure, a load metric threshold can be preset in advance. When the load metric of the first candidate data source is greater than the load metric threshold, the first candidate data source can be determined as the second candidate data source. It can be understood that the specific value of the load metric threshold can be determined based on actual design requirements.

[0099] After step S207 in the embodiments of the present disclosure, step S208 is executed.

[0100] S : Obtain the structural performance metrics of each second candidate data source.

[0101] In the embodiments of the present disclosure, the structural performance index is used to indicate the structural characteristics of the data in the second candidate data source. Here, the structural performance index includes at least one of the proportion of filtered data rows, the number of covered partitions, the number of buckets, the proportion of table storage occupancy, whether there is an index, etc.

[0102] The specific content included in the structural performance index of the second candidate data source can be determined based on the type of the database deployed by the second candidate data source. Taking the MYSQL and PALO databases as examples, when the database deployed by the second candidate data source is MYSQL, the structural performance index of the second candidate data source can include the proportion of filtered data rows and the number of covered partitions; when the database deployed by the second candidate data source is PALO, the structural performance index of the second candidate data source can include the number of buckets, the proportion of table storage occupancy, and whether there is an index.

[0103] S209: Screen the target data source from multiple second candidate data sources based on the structural performance index of each second candidate data source.

[0104] In the embodiments of the present disclosure, the better the structural performance index of the first candidate data source, the more ordered and convenient for query and retrieval the data structure of the second candidate data source is. Therefore, the embodiments of the present disclosure can screen out the second candidate data source with the optimal structural performance index from multiple second candidate data sources based on the structural performance index of each second candidate data source; and determine the second candidate data source with the optimal structural performance index as the target data source.

[0105] S210: Perform data query from the target data source and return the query result.

[0106] As described above, the data query request may include information related to the data expected to be requested by the user. Relevant data can be queried from the target data source based on this information, and the queried data is returned to the user's terminal as the query result. It should be noted here that if the target data source is not determined in step S210, the response to the data query request received in step S201 is stopped, and data is no longer queried for this data query request.

[0107] The data query method provided by the embodiments of the present disclosure can screen out a matching target data source for the data query request from multiple data sources, avoiding the unavailability of the data query service due to the failure of a certain data source and ensuring the operational reliability of the data query service; and screening the target data source based on the connectivity information and integrity information can largely ensure that the target data source can provide the query result expected by the user, which helps to improve the accuracy of the query result.

[0108] Figure 3 shows a schematic flow diagram of calculating a computing load index, asFigure 3 As shown in the figure, the process mainly may include the following steps:

[0109] S310: Determine the weight coefficients pre-configured for calculating the query success rate, resource idle rate, and request response time index respectively.

[0110] The load index is used to indicate the number of requests that the first candidate data source can currently respond to. In the embodiments of the present disclosure, the load index of the first candidate data source can be calculated based on relevant data of the first candidate data source. For example, the load index of the first candidate data source can be calculated based on the query success rate, resource idle rate, and request response time index of the first candidate data source.

[0111] In the embodiments of the present disclosure, a preset time interval can be used as a statistical period, and the query success rate, resource idle rate, and request response time index of the first candidate data source can be obtained based on the data of the first candidate data source within the statistical period.

[0112] Optionally, in the embodiments of the present disclosure, the total number of data query requests received by the first candidate data source within the Nth statistical period and the number of failures of the first candidate data source that did not successfully return query results for the received data query requests within the Nth statistical period can be counted. It can be understood that the ratio of the above-mentioned number of failures to the total number is the query failure rate of the first candidate data source, and the query success rate of the first candidate data source is the absolute value of the difference between 1 and the query failure rate.

[0113] Optionally, the number of data query requests that the first candidate data source can simultaneously respond to has an upper limit. In the embodiments of the present disclosure, the maximum number of data query requests that the first candidate data source can simultaneously respond to can be defined as the maximum number. In the embodiments of the present disclosure, the real-time number of data query requests currently and actually responded to by the first candidate data source can be counted, the ratio of the above-mentioned real-time number to the maximum number can be calculated, and the absolute value of the difference between 1 and the ratio can be used as the resource idle rate.

[0114] Optionally, in the embodiments of the present disclosure, the request response time index of the first candidate data source can be calculated by the following formula: T = 1 / (1 + e ^ (T N -T N-1 )); where T is the request response time index of the first candidate data source, T N is the average request response time of the Nth statistical period, T N-1 is the average request response time of the (N - 1)th statistical period, and N is a positive integer.

[0115] The current operating condition of the first candidate data source can be determined through the query success rate, resource idle rate, and request response time index, as follows:

[0116] 1. When the resource idle rate of the first candidate data source is high and the request response time metric is high, it indicates that the first candidate data source receives fewer data query requests and the running speed of the first candidate data source is relatively fast. In the above situation, when the query success rate is low, the first candidate data source is in a network fluctuation scenario.

[0117] 2. When the resource idle rate of the first candidate data source is low and the request response time metric is low, it indicates that the number of data query requests received by the first candidate data source has approached saturation and the running speed of the first candidate data source has approached the upper limit.

[0118] 3. When the resource idle rate of the first candidate data source is high and the request response time metric is low, it indicates that the first candidate data source receives fewer data query requests, but the running speed of the first candidate data source has approached the upper limit, and the first candidate data source is in a large query scenario.

[0119] 4. When the resource idle rate of the first candidate data source is low and the request response time metric is high, it indicates that the number of data query requests received by the first candidate data source has approached saturation and there are a large number of small query scenarios for the first candidate data source.

[0120] Optionally, embodiments of the present disclosure may obtain the query success rate, resource idle rate, and request response time metric of the first candidate data source; calculate the sum value of the query success rate, resource idle rate, and request response time metric, and use the sum value as the load metric of the first candidate data source.

[0121] S320: Calculate a weighted sum value based on the query success rate, resource idle rate, request response time metric, and the corresponding weight coefficients of the three.

[0122] In embodiments of the present disclosure, the specific values of the query success rate, resource idle rate, request response time metric, and the weight coefficients corresponding to the query success rate, resource idle rate, and request response time metric may be determined based on actual design requirements.

[0123] Optionally, the weight coefficient corresponding to the resource idle rate and the weight coefficient corresponding to the request response time metric are close to each other and are both smaller than the weight coefficient corresponding to the query success rate. This configuration of weight coefficients can largely avoid determining the first candidate data source with a low query success rate as the target data source.

[0124] It can be understood that in step S330, the query success rate, resource idle rate, and request response time metric of the first candidate data source are respectively multiplied by the corresponding weight coefficients to obtain 3 products, and the sum value of these 3 products is the weighted sum value.

[0125] S330: Use the weighted sum value as the load metric of the first candidate data source.

[0126] Based on the same principle as the above data query method, an embodiment of the present disclosure also provides a data query device. Figure 4 FIG. shows a schematic diagram of a data query device provided by an embodiment of the present disclosure. As Figure 4 shown, the data query device 400 includes a request receiving module 410, an information acquisition module 420, a target determination module 430, and a data query module 440.

[0127] The request receiving module 410 is configured to receive a data query request.

[0128] The information acquisition module 420 is configured to determine the availability information of each data source among a plurality of pre-configured data sources in response to the data query request.

[0129] The target determination module 430 is configured to screen a target data source from the plurality of pre-configured data sources based on the availability information of each data source.

[0130] The data query module 440 is configured to perform a data query from the target data source and return a query result.

[0131] The data query device provided by the embodiment of the present disclosure can screen a matching target data source for a data query request from multiple data sources, avoiding the unavailability of the data query service caused by the failure of a certain data source, and ensuring the operational reliability of the data query service; moreover, screening the target data source based on the connectivity information and integrity information can largely ensure that the target data source can provide the query results expected by the user, which helps to improve the accuracy of the query results.

[0132] In the embodiment of the present disclosure, the availability information includes at least one of connectivity information and integrity information;

[0133] The connectivity information is a test result obtained by performing a connectivity test on the data source, and the connectivity information is used to indicate whether the data source can be accessed;

[0134] The integrity information is obtained by statistically calculating the return rate of the query results of the data source, and the integrity information is used to indicate the data integrity of the data source.

[0135] In the embodiment of the present disclosure, when the target determination module 430 is configured to screen a target data source from the plurality of pre-configured data sources based on the availability information of each data source, it is specifically configured to:

[0136] Based on the connectivity information of each data source, screen out the data sources that can be accessed from the plurality of pre-configured data sources; determine the data sources that can be accessed as the target data sources;

[0137] Alternatively, based on the integrity information of each of the data sources, filter out the data sources whose return rate exceeds a preset threshold from the multiple pre-configured data sources; and determine the data sources whose return rate exceeds the preset threshold as the target data sources.

[0138] Alternatively, based on the connectivity information of each of the data sources, filter out the accessible data sources from the multiple pre-configured data sources; based on the integrity information of each of the data sources, filter out the data sources whose return rate exceeds a preset threshold from the multiple pre-configured data sources; and determine the data sources that are accessible and whose return rate exceeds the preset threshold as the target data sources.

[0139] In the embodiments of the present disclosure, when the target determination module 430 is used to filter out target data sources from multiple pre-configured data sources based on the availability information of each data source, it is specifically configured to:

[0140] Filter out multiple first candidate data sources from the multiple pre-configured data sources based on the availability information of each data source;

[0141] Calculate the load metric of each first candidate data source, where the load metric is used to indicate the number of requests that the first candidate data source can currently respond to;

[0142] Filter out target data sources from the multiple first candidate data sources based on the load metric of each first candidate data source.

[0143] In the embodiments of the present disclosure, when the target determination module 430 is used to filter out multiple first candidate data sources from the multiple pre-configured data sources based on the availability information of each data source, it is further configured to:

[0144] Filter out the accessible data sources from the multiple pre-configured data sources based on the connectivity information of each data source; and determine the accessible data sources as the first candidate data sources;

[0145] Alternatively, filter out the data sources whose return rate exceeds a preset threshold from the multiple pre-configured data sources based on the integrity information of each data source; and determine the data sources whose return rate exceeds the preset threshold as the first candidate data sources;

[0146] Alternatively, filter out the accessible data sources from the multiple pre-configured data sources based on the connectivity information of each data source; filter out the data sources whose return rate exceeds a preset threshold from the multiple pre-configured data sources based on the integrity information of each data source; and determine the data sources that are accessible and whose return rate exceeds the preset threshold as the first candidate data sources.

[0147] In an embodiment of the present disclosure, when the target determination module 430 is used to calculate the load metrics of each first candidate data source, it is specifically configured to:

[0148] Obtain the query success rate, resource idle rate, and request response time metrics of the first candidate data source;

[0149] Calculate the sum of the query success rate, resource idle rate, and request response time metrics, and use the sum as the load metric of the first candidate data source.

[0150] In an embodiment of the present disclosure, when the target determination module 430 is used to calculate the sum of the query success rate, resource idle rate, and request response time metrics and use the sum as the load metric of the first candidate data source, it is specifically configured to:

[0151] Respectively determine the weight coefficients pre-configured for calculating the query success rate, resource idle rate, and request response time metrics;

[0152] Based on the query success rate, resource idle rate, and request response time metrics, and the respective weight coefficients of the three, calculate the weighted sum value;

[0153] Use the weighted sum value as the load metric of the first candidate data source.

[0154] In an embodiment of the present disclosure, the target determination module 430 is used to calculate the request response time metric of the first candidate data source through the following formula:

[0155] T = 1 / (1 + e^(T N -T N-1 ));

[0156] Wherein, T is the request response time metric of the first candidate data source, T N is the average request response time of the Nth statistical period, and T N-1 is the average request response time of the (N - 1)th statistical period, and N is a positive integer.

[0157] In an embodiment of the present disclosure, when the target determination module 430 is used to screen the target data source from multiple first candidate data sources based on the load metrics of each first candidate data source, it is specifically configured to:

[0158] Based on the load metrics of each first candidate data source, screen out the first candidate data source with the largest load metric from multiple first candidate data sources;

[0159] Determine the first candidate data source with the largest load metric as the target data source.

[0160] In an embodiment of the present disclosure, when the target determination module 430 is used to screen a target data source from multiple first candidate data sources based on the load metrics of each first candidate data source, it is specifically configured to:

[0161] Screen out multiple second candidate data sources with load metrics greater than the load metric threshold from multiple first candidate data sources based on the load metrics of each first candidate data source;

[0162] Obtain the structural performance metrics of each second candidate data source, where the structural performance metrics are used to indicate the structural characteristics of the data in the second candidate data source;

[0163] Screen the target data source from multiple second candidate data sources based on the structural performance metrics of each second candidate data source.

[0164] In an embodiment of the present disclosure, when the target determination module 430 is used to screen a target data source from multiple second candidate data sources based on the structural performance metrics of each second candidate data source, it is specifically configured to:

[0165] Screen out the second candidate data source with the optimal structural performance metric from multiple second candidate data sources based on the structural performance metrics of each second candidate data source;

[0166] Determine the second candidate data source with the optimal structural performance metric as the target data source.

[0167] In an embodiment of the present disclosure, the structural performance metrics include at least one of the proportion of filtered data rows, the number of covered partitions, the number of buckets, the proportion of table storage occupancy, and whether there is an index.

[0168] It can be understood that the above-mentioned modules of the data query device in the embodiments of the present disclosure have the functions of implementing the corresponding steps of the above-mentioned data query method. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The above modules can be software and / or hardware, and the above-mentioned modules can be implemented separately or multiple modules can be integrated. For the function descriptions of the above-mentioned modules of the data query device, reference can be specifically made to the corresponding descriptions of the above-mentioned data query method, which will not be elaborated here.

[0169] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information and other processing all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0170] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0171] Figure 5FIG. shows a schematic block diagram of an exemplary electronic device that may be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as, personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0172] As Figure 5 shown, device 500 includes a computing unit 501 that can perform various appropriate actions and processes in accordance with a computer program stored in a read only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0173] A plurality of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0174] The computing unit 501 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 executes the various methods and processes described above, such as the data query method. For example, in some embodiments, the data query method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the data query method described above can be executed. Alternatively, in other embodiments, the computing unit 501 can be configured to execute the data query method by any other suitable means (e.g., by means of firmware).

[0175] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field-programmable gate arrays (FPGA), application-specific integrated circuits (ASIC), application-specific standard products (ASSP), systems-on-chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a dedicated or general-purpose programmable processor, that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0176] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to the processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0177] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0178] To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic, speech, or tactile input).

[0179] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0180] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server incorporating a blockchain.

[0181] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution disclosed in this disclosure can be achieved, and no limitations are imposed herein.

[0182] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub - combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.

Claims

1. A data query method, comprising: Receiving a data query request; In response to the data query request, determining the availability information of each of a plurality of pre-configured data sources; The availability information includes at least one of connectivity information and integrity information; Based on the availability information of each data source, screening target data sources from the plurality of pre-configured data sources; Performing a data query from the target data sources and returning a query result; The screening of target data sources from the plurality of pre-configured data sources based on the availability information of each data source includes: Based on the availability information of each data source, screening a plurality of first candidate data sources from the plurality of pre-configured data sources; Calculating a load metric for each of the first candidate data sources, where the load metric is used to indicate the number of requests that the first candidate data source can currently respond to; Based on the load metric of each first candidate data source, screening target data sources from the plurality of first candidate data sources; The screening of target data sources from the plurality of first candidate data sources based on the load metric of each first candidate data source includes: Based on the load metric of each first candidate data source, screening out a plurality of second candidate data sources whose load metric is greater than a load metric threshold from the plurality of first candidate data sources; Obtaining a structural performance metric for each of the second candidate data sources, where the structural performance metric is used to indicate the structural characteristics of the data in the second candidate data source; Based on the structural performance metric of each second candidate data source, screening target data sources from the plurality of second candidate data sources.

2. The method according to claim 1, wherein the connectivity information is a test result obtained by performing a connectivity test on the data source, and the connectivity information is used to indicate whether the data source can be accessed; The integrity information is obtained by statistically calculating the return rate of the query results of the data source, and the integrity information is used to indicate the data integrity of the data source.

3. The method according to claim 2, wherein The screening of target data sources from the plurality of pre-configured data sources based on the availability information of each data source includes: Based on the connectivity information of each data source, screening out data sources that can be accessed from the plurality of pre-configured data sources; determining the data sources that can be accessed as target data sources; Or, based on the integrity information of each data source, screening out data sources whose return rate exceeds a preset threshold from the plurality of pre-configured data sources; determining the data sources whose return rate exceeds the preset threshold as target data sources; Or, based on the connectivity information of each data source, screening out data sources that can be accessed from the plurality of pre-configured data sources; based on the integrity information of each data source, screening out data sources whose return rate exceeds a preset threshold from the plurality of pre-configured data sources; determining the data sources that can be accessed and whose return rate exceeds the preset threshold as target data sources.

4. The method according to claim 1, wherein The screening of a plurality of first candidate data sources from the plurality of pre-configured data sources based on the availability information of each data source includes: Based on the connectivity information of each of the data sources, filter out the accessible data sources from the multiple pre-configured data sources; determine the accessible data sources as the first candidate data sources; Alternatively, based on the integrity information of each of the data sources, filter out the data sources with a return rate exceeding a preset threshold from the multiple pre-configured data sources; determine the data sources with a return rate exceeding the preset threshold as the first candidate data sources; Alternatively, based on the connectivity information of each of the data sources, filter out the accessible data sources from the multiple pre-configured data sources; based on the integrity information of each of the data sources, filter out the data sources with a return rate exceeding a preset threshold from the multiple pre-configured data sources; determine the data sources that are accessible and have a return rate exceeding the preset threshold as the first candidate data sources.

5. The method according to claim 1, wherein The calculating the load metrics of each of the first candidate data sources includes: Obtain the query success rate, resource idle rate, and request response time metrics of the first candidate data sources; Calculate the sum of the query success rate, the resource idle rate, and the request response time metrics, and use the sum as the load metric of the first candidate data source.

6. The method according to claim 5, wherein, The calculating the sum of the query success rate, the resource idle rate, and the request response time metrics and using the sum as the load metric of the first candidate data source includes: Respectively determine the weight coefficients pre-configured for calculating the query success rate, the resource idle rate, and the request response time metrics; Based on the query success rate, the resource idle rate, the request response time metrics, and the respective weight coefficients of the three, calculate a weighted sum value; Use the weighted sum value as the load metric of the first candidate data source.

7. According to the method of claim 5 or 6, calculate the request response time metric of the first candidate data source through the following formula: T = 1 / (1 + e^(T N -T N-1 )); Among them, T is the request response time metric of the first candidate data source, T N is the average request response time of the Nth statistical period, T N-1 is the average request response time of the (N - 1)th statistical period, and N is a positive integer.

8. The method according to claim 1, wherein The filtering the target data source from the multiple first candidate data sources based on the load metrics of each of the first candidate data sources includes: Based on the load metrics of each of the first candidate data sources, filter out the first candidate data source with the largest load metric from the multiple first candidate data sources; Determine the first candidate data source with the largest load metric as the target data source.

9. The method according to claim 8, wherein, The filtering the target data source from the multiple second candidate data sources based on the structural performance metrics of each of the second candidate data sources includes: Based on the structural performance metrics of each of the second candidate data sources, filter out the second candidate data source with the optimal structural performance metric from the multiple second candidate data sources; Determine the second candidate data source with the optimal structural performance metric as the target data source.

10. According to the method of claim 8, the structural performance metrics include at least one of the proportion of filtered data rows, the number of covered partitions, the number of buckets, the proportion of table storage occupancy, and whether there is an index.

11. A data query device, comprising: A request receiving module, configured to receive a data query request; An information acquisition module, configured to respond to the data query request and determine the availability information of each data source among a plurality of pre-configured data sources; the availability information includes at least one of connectivity information and integrity information; A target determination module, configured to screen target data sources from the plurality of pre-configured data sources based on the availability information of each data source; A data query module, configured to query data from the target data sources and return a query result; When the target determination module is configured to screen target data sources from the plurality of pre-configured data sources based on the availability information of each data source, it is further configured to: Screen a plurality of first candidate data sources from the plurality of pre-configured data sources based on the availability information of each data source; Calculate the load index of each first candidate data source, where the load index is used to indicate the number of requests that the first candidate data source can currently respond to; Screen target data sources from the plurality of first candidate data sources based on the load index of each first candidate data source; When the target determination module is configured to screen target data sources from the plurality of first candidate data sources based on the load index of each first candidate data source, it is further configured to: Screen a plurality of second candidate data sources with a load index greater than a load index threshold from the plurality of first candidate data sources based on the load index of each first candidate data source; Obtain the structural performance index of each second candidate data source, where the structural performance index is used to indicate the structural characteristics of the data in the second candidate data source; Screen target data sources from the plurality of second candidate data sources based on the structural performance index of each second candidate data source.

12. The apparatus according to claim 11, wherein the connectivity information is a test result obtained by performing a connectivity test on the data source, and the connectivity information is used to indicate whether the data source can be accessed; The integrity information is obtained by statistically calculating the return rate of the query results of the data source, and the integrity information is used to indicate the data integrity of the data source.

13. The apparatus according to claim 11, wherein When the target determination module is configured to screen target data sources from the plurality of pre-configured data sources based on the availability information of each data source, it is further configured to: Screen the data sources that can be accessed from the plurality of pre-configured data sources based on the connectivity information of each data source; Determine the data sources that can be accessed as target data sources; Alternatively, screen the data sources with a return rate exceeding a preset threshold from the plurality of pre-configured data sources based on the integrity information of each data source; Determine the data sources with a return rate exceeding the preset threshold as target data sources; Alternatively, screen the data sources that can be accessed from the plurality of pre-configured data sources based on the connectivity information of each data source; Screen the data sources with complete data from the plurality of pre-configured data sources based on the integrity information of each data source; Determine the data sources with complete data and can be accessed as target data sources.

14. The apparatus according to claim 11, wherein When the target determination module is configured to calculate the load index of each first candidate data source, it is further configured to: Obtain the query success rate, resource idle rate, and request response time metrics of the first candidate data source; Calculate the sum of the query success rate, the resource idle rate, and the request response time metrics, and use the sum as the load metric of the first candidate data source.

15. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1-10.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.

17. A computer program product, comprising a computer program, where the computer program implements the method according to any one of claims 1-10 when executed by a processor.

Citation Information

Patent Citations

  • Data query method and device

    CN110990444A

  • Data source dynamic scheduling method and device, electronic equipment and storage medium

    CN112817729A