Cross-database query method and device, equipment and storage medium
Through dynamic resource evaluation and task decomposition between central equipment and edge equipment, the production interruption and long response time caused by limited computing power of edge equipment are solved, and efficient, stable and real-time cross-database query is achieved.
Patent Information
- Application Number
- CN202510898832.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-07-01
AI Technical Summary
In the edge-center cross-database architecture, edge devices have problems such as production interruptions or query response time due to limited computing power, and it is difficult for the prior art to find a balance between ensuring device stability and real-time.
Dynamically evaluate the available computing power and network bandwidth of edge devices through central devices, decompose query operations and allocate them to edge devices for processing, and combine the task decomposition and data transmission strategies of edge devices to achieve fine-grained task division and avoid edge device crashes and center device overload.
In extreme scenarios with low computing power and poor network, it not only avoids edge equipment crash due to "strong computing", but also prevents central equipment from overloading due to "full collection", so as to achieve a balance between equipment stability, transmission efficiency and real-time computing, reduce production interruptions and shorten query response time.
Smart Images

Figure CN120407600A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a cross-database query method, apparatus, device, and storage medium. Background Art
[0002] Cross-database query refers to the technology of simultaneously accessing multiple different databases (which may belong to different types, different manufacturers, and different deployment environments) in a single query operation, and integrating, correlating, or analyzing the data in these databases. It can break the boundaries of a single database and achieve cross-source access and collaborative processing of data.
[0003] In an edge-center cross-database architecture, data processing faces a dilemma. Edge devices usually store real-time generated business data, but due to their limited memory and computing power, they are difficult to undertake complex computing tasks. For example, when it is necessary to query the average energy consumption of multiple edge devices and their sub-devices in the past hour, if forcing the edge devices to process such complex queries, it may cause the device resources to be exhausted or even crash, thus triggering production interruptions. On the contrary, if all business data is transmitted to the central device for processing, although the central device has powerful computing capabilities, significant delays will occur during the data transmission process, especially when multiple edge devices transmit simultaneously, resulting in too long query response times and unable to meet business scenarios with high real-time requirements.
[0004] Therefore, in an edge-center cross-database architecture, the industry needs a cross-database query method to reduce the situation of production interruptions and shorten the query response time. Summary of the Invention
[0005] This application provides a cross-database query method, apparatus, device, and storage medium, which can reduce the situation of production interruptions and shorten the query response time.
[0006] To achieve the above object, this application adopts the following technical solutions: In a first aspect, this application provides a cross-database query method, which is applied to a cross-database architecture composed of a central device and multiple edge devices. The method includes: The central device receives a query request sent by a service terminal; The central device obtains the target available computing power value of the target edge device and the target network bandwidth between the central device and the target edge device according to the query request; The central device determines whether the target available computing power value is greater than or equal to a first computing power threshold to obtain a first determination result; If the first judgment result indicates that the target available computing power value is less than the first computing power threshold, the central device determines whether the target network bandwidth is greater than or equal to the bandwidth threshold to obtain a second judgment result; If the second judgment result indicates that the target network bandwidth is less than the bandwidth threshold, the central device decomposes the query operation associated with the target edge device to obtain multiple query sub-operations, selects a target query sub-operation from the multiple query sub-operations, assigns the target query sub-operation to the target edge device for processing, receives the first sub-processing result fed back by the target edge device, obtains a third target processing result based on the first sub-processing result and other query sub-operations, and feeds back a query response to the service terminal based on the third target processing result and other processing results associated with other edge devices. Other query sub-operations are operations other than the target query sub-operation among the multiple query sub-operations, and other edge devices are devices other than the target edge device among the multiple edge devices.
[0007] Optionally, the method further includes: If the first judgment result indicates that the target available computing power value is greater than or equal to the first computing power threshold, the central device assigns the query operation associated with the target edge device to the target edge device for processing, receives the first target processing result fed back by the target edge device, and feeds back a query response to the service terminal based on the first target processing result and other processing results associated with other edge devices.
[0008] Optionally, the method further includes: If the second judgment result indicates that the target network bandwidth is greater than or equal to the bandwidth threshold, the central device instructs the target edge device to transmit the data related to the query request to the central device, processes the data related to the query request to obtain a second target processing result, and feeds back a query response to the service terminal based on the second target processing result and other processing results associated with other edge devices.
[0009] Optionally, the selecting the target query sub-operation from the multiple query sub-operations includes: According to the first mapping relationship between the preset reference query sub-operations and the reference required computing power values, obtain the required computing power value corresponding to each query sub-operation; Select the top N query sub-operations corresponding to the top N required computing power values in ascending order; wherein, the sum of the top N required computing power values is less than the target available computing power value.
[0010] Optionally, the obtaining the target available computing power value of the target edge device includes: Obtain the target available CPU cores, target CPU load, target maximum CPU cores, target available memory, and target total memory of the target edge device; Determine the target available computing power value according to the target available CPU cores, the target CPU load, the target maximum CPU cores, the target available memory, and the target total memory.
[0011] Optionally, the method further includes: Obtain the task plan of the target edge device; The central device allocates the query operation associated with the target edge device to the target edge device for processing, including: When the task plan of the target edge device indicates that there is no target task in the future preset time period, the central device allocates the query operation associated with the target edge device to the target edge device for processing; The target task is a task whose required computing power value is greater than or equal to the second computing power threshold when executing the task.
[0012] Optionally, the method further includes: The central device sends the task processing duration threshold to each edge device, so that each edge device feeds back the processing result within the processing duration threshold.
[0013] In a second aspect, the present application provides a cross-database query device, which is applied to a cross-database architecture composed of a central device and multiple edge devices. The device includes: A receiving module, configured to receive a query request sent by a service terminal; An obtaining module, configured to obtain the target available computing power value of the target edge device and the target network bandwidth between the target edge device according to the query request; A judging module, configured to judge whether the target available computing power value is greater than or equal to a first computing power threshold to obtain a first judgment result; if the first judgment result indicates that the target available computing power value is less than the first computing power threshold, then judge whether the target network bandwidth is greater than or equal to a bandwidth threshold to obtain a second judgment result; A query module, configured to, if the second determination result indicates that the target network bandwidth is less than the bandwidth threshold, decompose a query operation associated with the target edge device to obtain a plurality of query sub-operations, select a target query sub-operation from the plurality of query sub-operations, assign the target query sub-operation to the target edge device for processing, receive a first sub-processing result fed back by the target edge device, obtain a third target processing result according to the first sub-processing result and other query sub-operations, and feedback a query response to the service terminal according to the third target processing result and other processing results associated with other edge devices, where the other query sub-operations are operations other than the target query sub-operation among the plurality of query sub-operations, and the other edge devices are devices other than the target edge device among the plurality of edge devices.
[0014] In a third aspect, the present application provides a computing device, including a memory and a processor; wherein, one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the computing device is caused to execute the method according to any one of the first aspect.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute the method according to any one of the first aspect.
[0016] It can be seen from the above technical solutions that the present application has at least the following beneficial effects: The present application provides a cross-database query method, which is applied to a cross-database architecture composed of a central device and multiple edge devices. In this method, after receiving a query request sent by a service terminal, the central device obtains the available computing power values of each edge device and the network bandwidth between each edge device. Taking a target edge device as an example, when the target available computing power value of the target edge device is less than the first computing power threshold and the target network bandwidth is less than the bandwidth threshold, the central device does not adopt the traditional simple and crude processing method. Instead, it first decomposes the query operation associated with the target edge device to obtain multiple query sub-operations. These query sub-operations are not all executed by the target edge device. The target query sub-operation is selected from the multiple query sub-operations and assigned to the target edge device for processing. In this way, when the target available computing power is low, the target edge device can also perform business processing without crashing and obtain the first sub-processing result. Moreover, since the target edge device processes a part of the data, it does not need to transmit all the data to the central device, but only transmits part of the data, such as the first sub-processing result obtained after the target edge device processes the data. In this way, when the network bandwidth is poor, the target edge device can also transmit a small amount of data to the central device with low latency. The central device obtains the third target processing result based on the first sub-processing result and other query sub-operations. The processing methods for other edge devices are similar, and other processing results are obtained. The central device feeds back a query response to the service terminal according to the third target processing result and other processing results associated with other edge devices. It can be seen that the technical solution of the present application precisely solves the core contradiction in the edge-center architecture through the dual-dimensional evaluation of computing power and network and the hierarchical decomposition of query operations: in the extreme scenario of low computing power and poor network, it not only avoids the collapse of edge devices due to "intensive computing", but also prevents the central device from being overloaded due to "receiving all data", realizing the optimal coordination of "edge doing light work and center carrying heavy work". Through fine-grained task division, a balance is found among device stability, transmission efficiency, and computing real-time performance, reducing production interruptions and shortening the query response time.
[0017] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be achieved in any single embodiment. On the contrary, it can be understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution or beneficial effect is included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in this embodiment can be combined in any appropriate manner. Those skilled in the art will understand that an embodiment can be implemented without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in specific embodiments that do not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 FIG. 6 is a schematic diagram of an application scenario provided by an embodiment of the present application; Figure 2 FIG. 9 is a flowchart of a cross-database query method provided by an embodiment of the present application; Figure 3 FIG. 12 is a schematic diagram of a cross-database query device provided by an embodiment of the present application; Figure 4 FIG. 15 is a schematic diagram of a computing device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0019] The terms "first", "second", "third", etc. in the specification and drawings of this application are used to distinguish different objects, rather than to limit a specific order.
[0020] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.
[0021] Such as Figure 1As shown in the figure, this is a schematic diagram of an application scenario provided by an embodiment of the present application. This application scenario is a device monitoring system for an intelligent factory. The device monitoring system includes a central device 101 and multiple edge devices 102. Among them, the edge device 102 can be an industrial robot for device monitoring, equipped with an embedded database (such as SQLite (a database), TimescaleDB (a database)), which stores device status data in real time (such as motor speed, temperature, energy consumption). The database computing power of a single device is limited (for example, a CPU with four cores at 1.5 GHz and 4 GB of memory). The central device 101 uses a MySQL cluster to store the data of all the factory's devices (such as device information) and is responsible for complex business analysis (such as cross-production line energy consumption comparison, device fault prediction), etc.
[0022] In the above scenario, the business requirement is: query "the average energy consumption of each production line (composed of multiple devices) within the past 1 hour". Each edge device needs to filter the data within the time window from the local table (device_data) and associate it with the device metadata table (device_meta) to obtain the production line ID to which the device belongs. The central device groups the energy consumption data of each device by the production line ID and calculates the average energy consumption.
[0023] However, edge devices cannot handle complex aggregation tasks: The device_data table of a single device may contain more than 100,000 pieces of data per hour. When the database of the edge device (such as SQLite) performs association and grouped aggregation, the CPU occupancy rate will soar to more than 90%, resulting in delays in other control tasks of the edge device (such as robot motion control) and not meeting the real-time requirements of industrial control (the control cycle needs to be <1 ms); The cost of directly shifting the calculation to the central device: If the preprocessing of the edge device is skipped and the raw data (100,000 pieces / device × 100 devices = 10 million pieces of data) is directly transmitted to the central device, the round-trip delay of the 5G network is about 10 ms, and high-frequency transmission (such as 1 query per second) will accumulate the delay to 100 ms / query, and the bandwidth consumption reaches 50 MB / s (assuming each piece of data is 50 bytes), resulting in a network IO bottleneck of the central device. In fact, a certain edge device may generate a large amount of invalid data due to sensor anomalies. When the database of the edge device processes the WHERE time>'2024-05-14 14:00:00' filter (filtering data within the past hour), a full table scan occurs due to the lack of an index, taking 200 ms (far exceeding the 1 ms control cycle of the edge device), and finally the task times out and the production line monitoring is interrupted.
[0024] It can be seen that in the edge-center cross-database architecture, the current cross-database query scheme has an unreasonable task allocation situation, which will lead to problems such as long production terminal and query response time.
[0025] In view of this, an embodiment of the present application provides a cross-database query method, which is applied to the scenario of the above cross-database architecture composed of a central device and multiple edge devices. The method includes: The central device receives a query request sent by the service terminal, and then obtains the available computing power values of each edge device and the network bandwidth between the central device and the edge devices based on the query request. Taking the target edge device as an example, when the target available computing power value of the target edge device is less than the first computing power threshold and the target network bandwidth is less than the bandwidth threshold, the central device does not adopt the traditional simple and crude processing method. Instead, it first decomposes the query operation associated with the target edge device to obtain multiple query sub-operations. These query sub-operations are not all executed by the target edge device. The target query sub-operation is selected from the multiple query sub-operations and assigned to the target edge device for processing. In this way, when the target available computing power is low, the target edge device can also perform business processing without crashing and obtain the first sub-processing result. And because the target edge device processes a part of the data, it is not necessary to transmit all the data to the central device, but only transmit part of the data, such as the first sub-processing result obtained after the target edge device processes. In this way, when the network bandwidth is poor, the target edge device can also transmit a small amount of data to the central device with low latency. The central device obtains the third target processing result based on the first sub-processing result and other query sub-operations. The processing method for other edge devices is similar, and then other processing results are obtained. The central device feeds back the query response to the service terminal according to the third target processing result and other processing results associated with other edge devices. It can be seen that the technical solution of the present application accurately solves the core contradiction in the edge-center architecture through the dual-dimensional evaluation of computing power and network and the hierarchical decomposition of query operations: in the extreme scenario of low computing power and poor network, it not only avoids the collapse of edge devices due to "strong computing", but also prevents the central device from being overloaded due to "full reception", realizing the optimal coordination of "edge doing light work and center carrying heavy work". Through fine-grained task division, a balance is found among device stability, transmission efficiency, and calculation real-time performance, reducing the situation of production interruption and shortening the query response time.
[0026] Among them, the above application scenario is only an exemplary introduction, and the technical solution of the present application can also be applied to other application scenarios, which will not be elaborated here.
[0027] As Figure 2 shown, this figure is a flowchart of a cross-database query method provided by an embodiment of the present application. The method includes: S201. The central device receives a query request sent by the service terminal.
[0028] The central device refers to a device with powerful computing capabilities, such as a server. The service terminal refers to a terminal related to the service. The central device can receive the query request sent by the service terminal. The query request is used to query service-related data.
[0029] S202. The central device obtains the target available computing power value of the target edge device and the target network bandwidth between the central device and the target edge device according to the query request.
[0030] The edge device refers to a device deployed at the edge with weak computing power. In this application, the computing power of the edge device is less than that of the central device. The computing power of the central device can be dozens or hundreds of times that of the edge device. Multiple edge devices are all connected to the central device through the network. In this way, the central device can interact with each edge device.
[0031] In some examples, after receiving the query request, based on the query request, the central device can obtain the available computing power value of each edge device and the network bandwidth between the central device and the edge device. The available computing power value refers to the remaining available computing power value of the edge device currently. For example, taking the computing power value of 100% as the full value, if 60% has been used currently, the available computing power value is 40%.
[0032] For the convenience of understanding, the following introduction will be made by taking the target edge device among multiple edge devices as an example. In some embodiments, the central device can obtain the target available computing power value of the target edge device and the target network bandwidth between the central device and the target edge device.
[0033] The central device can obtain the target available CPU core number, target CPU load, target maximum CPU core number, target available memory and target total memory of the target edge device; then, according to the target available CPU core number, target CPU load, target maximum CPU core number, target available memory and target total memory, determine the target available computing power value. Specifically, the target available computing power value can be calculated through the following formula:
[0034] Where, represents the target available computing power value, represents the target maximum CPU core number, represents the target available CPU core number, represents the target CPU load (the current load of the CPU), represents the remaining degree of CPU resources, is the first weight coefficient, Indicates the target available memory, Indicates the target total memory, Indicates the second weight coefficient.
[0035] The central device can obtain the target network upload bandwidth and the target network maximum bandwidth (in Mbps) between the central device and the target edge device, and then calculate the target network bandwidth through the following formula:
[0036] Wherein, Indicates the target network bandwidth, Indicates the target network maximum bandwidth, Indicates the target network upload bandwidth, for example, the upload bandwidth of the current network.
[0037] After obtaining the target available computing power value and the target network bandwidth, the central device can perform subsequent logical judgments and then select a data query scheme.
[0038] In this application, the query scheme is not fixed and unchangeable, but is dynamically adjusted based on the available computing power value of the edge device and the network bandwidth between each edge device and the central device, so as to achieve cooperative optimal query.
[0039] S203. The central device determines whether the target available computing power value is greater than or equal to the first computing power threshold.
[0040] If so, execute S204; if not, execute S205. The central device determines whether the target available computing power value is greater than or equal to the first computing power threshold to obtain a first judgment result. When the first judgment result indicates that the target available computing power value is greater than or equal to the first computing power threshold, execute S204; when the first judgment result indicates that the target available computing power value is less than the first computing power threshold, execute S205.
[0041] S204. The central device assigns the query operation associated with the target edge device to the target edge device for processing, receives the first target processing result fed back by the target edge device, and feeds back a query response to the service terminal according to the first target processing result and other processing results associated with other edge devices.
[0042] Other edge devices refer to devices other than the target edge device among the multiple edge devices.
[0043] When the target available computing power value is greater than or equal to the first computing power threshold, it indicates that there is still a large available computing power value for the target edge device. Therefore, the central device can assign a query operation to the target edge device, and thus will not cause a great impact on the target edge device itself.
[0044] After receiving the query operation assigned by the central device, the target edge device performs relevant service processing based on the query operation. For example, data filtering, aggregation, and other processing are performed to obtain the first target processing result. Among them, the first target processing result can be the smallest unit processing result. After obtaining the first target processing result, the target edge device can feedback the first target processing result to the central device.
[0045] For other edge devices, there will also be other processing results associated with other edge devices. The task allocation method for other edge devices is similar to that of the target edge device, and both are processed based on the available computing power value and network bandwidth of the edge device. In this way, the central device can obtain the first target processing result and other processing results associated with other edge devices, and then feedback a query response to the service terminal based on the first target processing result and other processing results. Exemplarily, the central device processes the first target processing result and other processing results (which can be determined by service requirements, such as performing aggregation processing), so as to obtain a query response that matches the query request.
[0046] In the embodiments of the present application, the central device preferentially allocates the query operation to the edge device for processing by determining whether the available computing power value of the edge device meets the first computing power threshold, thereby reducing the computing pressure of the central device and avoiding performance bottlenecks or increased latency caused by centralized processing; the central device performs task allocation based on the real-time computing power state (such as whether the computing power of the edge device is sufficient), realizes dynamic matching of the computing power resources of the edge device, improves the resource utilization rate of the overall system, and avoids idle or wasted computing power.
[0047] In some embodiments, the central device can also obtain the task plan of the target edge device. When the task plan of the target edge device indicates that there is no target task in the future preset time period, the central device allocates the query operation associated with the target edge device to the target edge device for processing, where the target task is a task whose required computing power value is greater than or equal to the second computing power threshold when executing the task.
[0048] In the embodiments of the present application, the central device obtains the task plan of the target edge device in advance, so as to know the demand situation of the target edge device for computing power in the future preset time period. If there is no target task, it means that the demand for computing power in the future preset time period is small. At this time, it is suitable to allocate all query operations to the target edge device.
[0049] If there is a target task, it means that the demand for computing power in the future preset time period is large. At this time, it is not suitable to allocate all query operations to the target edge device. In this case, the central device can decompose the query operation and allocate appropriate query sub-operations to the target edge device. For details, please refer to the subsequent introduction of S207.
[0050] S205. The central device determines whether the target network bandwidth is greater than or equal to the bandwidth threshold.
[0051] If so, execute S206; if not, execute S207. The central device determines whether the target network bandwidth is greater than or equal to the bandwidth threshold, obtaining a second determination result. If the second determination result indicates that the target network bandwidth is greater than or equal to the bandwidth threshold, then execute S206; if the second determination result indicates that the target network bandwidth is less than the bandwidth threshold, then execute S207.
[0052] S206. The central device instructs the target edge device to transmit the data related to the query request to the central device, processes the data related to the query request to obtain a second target processing result, and feeds back a query response to the service terminal according to the second target processing result and other processing results associated with other edge devices.
[0053] In the case where the target available computing power value is less than the first computing power threshold and the target network bandwidth is greater than or equal to the bandwidth threshold, it indicates that the available computing power of the target edge device is insufficient, but the network bandwidth between the target edge device and the central device is good. Thus, the central device can instruct the target edge device to transmit the data related to the current query request to the central device. After receiving the data related to the query request transmitted by the target edge device, the central device can process these data to obtain a second target processing result. Similar to S205, the central device can also obtain other processing results associated with other edge devices, and then feed back a query response to the service terminal based on the second target processing result and other processing results associated with other edge devices. Since the network bandwidth between the target edge device and the central device is large, transmitting all relevant data will not have a great impact on the network, and the data transmission can also be completed in a short time, thus ensuring the timeliness of the query.
[0054] In the embodiments of the present application, the central device only instructs the edge device to transmit data to the central device when the network bandwidth of the edge device meets the bandwidth threshold (such as a high-bandwidth link), avoiding network congestion or transmission timeout caused by forced transmission in a low-bandwidth scenario, and improving the timeliness of the query request; in the case where the network bandwidth between the edge device and the central device is high, the edge device transmits the relevant data back to the central device, and in the case where the network bandwidth between the edge device and the central device is low, the edge device preferentially processes locally, realizing the matching of bandwidth capabilities and task requirements and avoiding waste of network resources.
[0055] S207. The central device decomposes the query operation associated with the target edge device to obtain multiple query sub-operations, selects a target query sub-operation from the multiple query sub-operations, assigns the target query sub-operation to the target edge device for processing, receives the first sub-processing result fed back by the target edge device, obtains a third target processing result based on the first sub-processing result and other query sub-operations, and feeds back a query response to the service terminal based on the third target processing result and other processing results associated with other edge devices.
[0056] The other query sub-operations are the operations among the multiple query sub-operations other than the target query sub-operation.
[0057] When the target available computing power value is less than the first computing power threshold and the target network bandwidth is less than the bandwidth threshold, the central device can decompose the query operation associated with the target edge device, thereby obtaining multiple query sub-operations. In some examples, the types or functions of the edge devices are different, and thus the query operations associated with different edge devices are different. When the central device determines that the available computing power value of an edge device is less than the first computing power threshold and the network bandwidth is less than the bandwidth threshold, it can decompose the query operation associated with the edge device.
[0058] After the central device completes the decomposition of the query operation, it can select a target query sub-operation from the multiple query sub-operations and assign the target query sub-operation to the target edge device for processing. The target query sub-operation refers to an operation suitable for the target edge device to execute, which can not only ensure that it does not affect other control tasks of the target edge device, but also reduce the amount of data transmitted to the central device after the execution of the target query sub-operation.
[0059] In some embodiments, the central device can obtain the required computing power value corresponding to each query sub-operation according to the first mapping relationship between the preset reference query sub-operation and the reference required computing power value, and then select the first N query sub-operations corresponding to the first N required computing power values in ascending order; wherein, the sum of the first N required computing power values is less than the target available computing power value, and the first N query sub-operations are the above-mentioned target query sub-operations.
[0060] In the embodiments of the present application, when the available computing power value of the edge device is less than the first computing power threshold, the central device assigns tasks with the sum of computing power requirements less than the available computing power value to the edge device, so that it will not affect other control tasks of the edge device, thereby avoiding situations such as insufficient computing power, memory overflow, and even causing the edge device to crash.
[0061] After the target edge device receives the target query sub-operation assigned by the central device, it can process data based on the target query sub-operation (related to the type of query sub-operation, such as filtering), obtain the first sub-processing result, and then transmit the first sub-processing result to the central device. At this time, since the target edge device has processed the data, the amount of data that needs to be transmitted to the central device is reduced, and it is not necessary to transmit all the data to the central device. Therefore, even when the network bandwidth is less than the bandwidth threshold, the first sub-processing result can be transmitted to the central device with low latency.
[0062] After the central device receives the first sub-processing result, it can continue to process the first sub-processing result based on other query sub-operations to obtain the third target processing result, and then feedback the query response to the service terminal based on the third target processing result and other processing results associated with other edge devices.
[0063] In this application, by dynamically evaluating the available computing power of edge devices, the central device can accurately judge its processing ability. When the computing power of the edge device is lower than the first computing power threshold and the network bandwidth is less than the bandwidth threshold, complex query tasks (such as cross-table aggregation and multi-condition association) are not directly assigned to prevent the edge device from crashing or production interruption due to resource exhaustion. Instead, the task is first decomposed and the edge device is allowed to process simple tasks. For example, in the industrial Internet of Things scenario, old edge devices only undertake lightweight tasks such as data filtering and local aggregation, while heavy tasks such as global aggregation are moved up to the central device. This not only utilizes the real-time data local processing ability of the edge device, reduces the amount of data to be transmitted, but also avoids its overload, reduces the failure rate of the edge device. After the amount of data to be transmitted is reduced, low-latency data transmission can be achieved under low bandwidth conditions, thus further ensuring the timeliness of the query.
[0064] In some embodiments, the central device can also send the task processing duration threshold to each edge device. After receiving the task processing duration threshold, the edge device can compare it with the expected required processing duration. When the task processing duration threshold is greater than or equal to the expected required processing duration, data processing is carried out normally. When the task processing duration is less than the expected required processing duration, the data processing speed needs to be increased. For example, for the same type of data, the amount of processing is reduced. Exemplarily, in the scenario of determining the average current of the device in the past hour, there are 10,000 pieces of data in the past hour. If all 10,000 pieces of data are processed, the requirement of the task processing duration threshold cannot be met. At this time, the amount of data can be reduced proportionally and then processed. For example, only 8,000 pieces of data are processed.
[0065] To make the technical solution of this application clearer, the following is an example.
[0066] In this example, multiple edge devices include a first edge device, a second edge device, and a third edge device. The first computing power threshold is 60%, the bandwidth threshold is 50 Mbps, the first available computing power value of the first edge device is 80%, the second available computing power value of the second edge device is 20%, the second network bandwidth between the second edge device and the central device is 100 Mbps, the third available computing power value of the third edge device is 50%, and the third network bandwidth between the third edge device and the central device is 40 Mbps.
[0067] In the technical solution of this application, when the central device receives a query request sent by the service terminal and needs to perform a cross-database query: Since the first available computing power value is greater than the first computing power threshold, the central device assigns the query operation associated with the first edge device to the first edge device for processing and receives the first processing result feedback by the first edge device. Since the second available computing power value is less than the first computing power threshold and the second network bandwidth is greater than the bandwidth threshold, the central device instructs the second edge device to transmit the data related to the query request to the central device, and the central device processes the data related to the query request to obtain a second processing result. Since the third available computing power value is less than the first computing power threshold and the third network bandwidth is less than the bandwidth threshold, the central device decomposes the query operation associated with the third edge device to obtain multiple query sub-operations, selects a target query sub-operation from the multiple query sub-operations, assigns the target query sub-operation to the third edge device for processing, receives the first sub-processing result feedback by the third edge device, and obtains a third processing result based on the first sub-processing result and other query sub-operations. After the central device obtains the first processing result, the second processing result, and the third processing result, it feeds back a query response to the service terminal based on these three processing results.
[0068] Based on the above description, an embodiment of this application provides a cross-database query method, which is applied to a cross-database query architecture in which a central device collaborates with multiple edge devices. Through a dynamic resource evaluation and task allocation strategy, it realizes the refined scheduling of computing power and network resources, and significantly improves the efficiency, reliability, and flexibility of cross-database queries. This application constructs a three-level response mechanism of computing power priority judgment - bandwidth-assisted decision-making - task intelligent decomposition, which can dynamically adjust the processing strategy according to the real-time status of edge devices, avoiding the processing bottleneck of a single central node and fully releasing the local processing potential of edge devices, thus forming an intelligent query system adapted to complex distributed environments.
[0069] As described above in conjunction with Figures 1 to 2 the cross-database query method provided by the embodiment of this application has been introduced in detail. Next, the devices and equipment provided by the embodiment of this application will be introduced in conjunction with the accompanying drawings.
[0070] Such asFigure 3 As shown, this figure is a schematic diagram of a cross-database query device provided by an embodiment of the present application. The device includes: A receiving module 301, configured to receive a query request sent by a service terminal; An obtaining module 302, configured to obtain a target available computing power value of a target edge device and a target network bandwidth between the target edge device according to the query request; A judging module 303, configured to judge whether the target available computing power value is greater than or equal to a first computing power threshold to obtain a first judgment result; if the first judgment result indicates that the target available computing power value is less than the first computing power threshold, then judge whether the target network bandwidth is greater than or equal to a bandwidth threshold to obtain a second judgment result; A query module 304, configured to, if the second judgment result indicates that the target network bandwidth is less than the bandwidth threshold, decompose the query operation associated with the target edge device to obtain a plurality of query sub-operations, select a target query sub-operation from the plurality of query sub-operations, allocate the target query sub-operation to the target edge device for processing, receive a first sub-processing result fed back by the target edge device, obtain a third target processing result according to the first sub-processing result and other query sub-operations, and feed back a query response to the service terminal according to the third target processing result and other processing results associated with other edge devices. Other query sub-operations are operations other than the target query sub-operation among the plurality of query sub-operations, and other edge devices are devices other than the target edge device among the plurality of edge devices.
[0071] Optionally, the query module 304 is further configured to, if the first judgment result indicates that the target available computing power value is greater than or equal to the first computing power threshold, allocate the query operation associated with the target edge device to the target edge device for processing, receive a first target processing result fed back by the target edge device, and feed back a query response to the service terminal according to the first target processing result and other processing results associated with other edge devices.
[0072] Optionally, the query module 304 is further configured to, if the second judgment result indicates that the target network bandwidth is greater than or equal to the bandwidth threshold, instruct the target edge device to transmit data related to the query request to the central device, process the data related to the query request to obtain a second target processing result, and feed back a query response to the service terminal according to the second target processing result and other processing results associated with other edge devices.
[0073] Optionally, the query module 304 is specifically configured to obtain the required computing power values corresponding to the respective query sub-operations according to a first mapping relationship between preset reference query sub-operations and reference required computing power values; select the top N query sub-operations corresponding to the top N required computing power values in ascending order; wherein, the sum of the top N required computing power values is less than the target available computing power value.
[0074] Optionally, the obtaining module 302 is specifically configured to obtain the target available CPU core count, target CPU load, target maximum CPU core count, target available memory, and target total memory of the target edge device; determine the target available computing power value according to the target available CPU core count, the target CPU load, the target maximum CPU core count, the target available memory, and the target total memory.
[0075] Optionally, the obtaining module 302 is further configured to obtain the task plan of the target edge device; The query module 304 is specifically configured to, when the task plan of the target edge device indicates that there is no target task in a preset future time period, allocate a query operation associated with the target edge device to the target edge device for processing; the target task is a task whose required computing power value is greater than or equal to a second computing power threshold when executing the task.
[0076] Optionally, the device further includes a sending module, configured to send a task processing duration threshold to each edge device, so that each edge device feeds back a processing result within the processing duration threshold.
[0077] The cross-database query device according to the embodiments of the present application can correspond to execute the methods described in the embodiments of the present application, and the above other operations and / or functions of each module / unit of the cross-database query device are respectively for implementing Figure 2 the corresponding processes of the respective methods in the illustrated embodiments, for the sake of brevity, will not be described in detail here.
[0078] Embodiments of the present application further provide a computing device. As Figure 4 shown, this figure is a schematic diagram of a computing device provided by an embodiment of the present application, the computing device 400 includes a bus 401, a processor 402, a communication interface 403, and a memory 404. The processor 402, the memory 404, and the communication interface 403 communicate with each other through the bus 401.
[0079] The bus 401 can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 4 only a thick line is used in Figure 4 , but it does not mean that there is only one bus or one type of bus.
[0080] The processor 402 can be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0081] The communication interface 403 is used for external communication.
[0082] The memory 404 can include volatile memory, such as random access memory (RAM). The memory 404 can also include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0083] Executable code is stored in the memory 404, and the processor 402 executes the executable code to execute the aforementioned cross-database query method.
[0084] Specifically, in the case of implementing Figure 3 the embodiments shown, and Figure 3 when each module or unit of the cross-database query device described in the embodiments is implemented by software, the software or program code required to execute the functions of each module / unit in Figure 3 can be partially or fully stored in the memory 404. The processor 402 executes the program code corresponding to each unit stored in the memory 404 to execute the aforementioned cross-database query method.
[0085] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive), etc. The computer-readable storage medium includes instructions that direct the computing device to execute the above cross-database query method.
[0086] The embodiments of the present application also provide a computer program product, which includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, they wholly or partially generate the processes or functions described in the embodiments of the present application.
[0087] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another website, computer, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line) or a wireless manner (such as infrared, wireless, microwave, etc.).
[0088] When the computer program product is executed by a computer, the computer executes any of the above cross-database query methods. The computer program product may be a software installation package. In the case where any of the above cross-database query methods needs to be used, the computer program product can be downloaded and executed on the computer.
[0089] The descriptions of the processes or structures corresponding to the above respective drawings have their own focuses. For parts not detailed in a certain process or structure, reference may be made to the relevant descriptions of other processes or structures.
[0090] As described above, the above are only the specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application.
Claims
1. A query method across databases, characterized in that, Applied to a cross-database architecture composed of a central device and multiple edge devices, the method includes: The central device receives a query request sent by a service terminal; The central device obtains the target available computing power value of the target edge device and the target network bandwidth between the central device and the target edge device according to the query request; The central device determines whether the target available computing power value is greater than or equal to a first computing power threshold, and obtains a first determination result; If the first determination result indicates that the target available computing power value is less than the first computing power threshold, the central device determines whether the target network bandwidth is greater than or equal to a bandwidth threshold, and obtains a second determination result; If the second determination result indicates that the target network bandwidth is less than the bandwidth threshold, the central device decomposes the query operation associated with the target edge device to obtain multiple query sub-operations, selects a target query sub-operation from the multiple query sub-operations, assigns the target query sub-operation to the target edge device for processing, receives the first sub-processing result fed back by the target edge device, obtains a third target processing result according to the first sub-processing result and other query sub-operations, and feeds back a query response to the service terminal according to the third target processing result and other processing results associated with other edge devices. Other query sub-operations are operations other than the target query sub-operation among the multiple query sub-operations, and other edge devices are devices other than the target edge device among the multiple edge devices.
2. The method according to claim 1, wherein The method further includes: If the first determination result indicates that the target available computing power value is greater than or equal to the first computing power threshold, the central device assigns the query operation associated with the target edge device to the target edge device for processing, receives the first target processing result fed back by the target edge device, and feeds back a query response to the service terminal according to the first target processing result and other processing results associated with other edge devices.
3. The method according to claim 1, wherein The method further includes: If the second determination result indicates that the target network bandwidth is greater than or equal to the bandwidth threshold, the central device instructs the target edge device to transmit the data related to the query request to the central device, processes the data related to the query request to obtain a second target processing result, and feeds back a query response to the service terminal according to the second target processing result and other processing results associated with other edge devices.
4. The method according to claim 1, wherein The selecting the target query sub-operation from the multiple query sub-operations includes: Obtaining the required computing power value corresponding to each query sub-operation according to the first mapping relationship between the preset reference query sub-operation and the reference required computing power value; Selecting the top N query sub-operations corresponding to the top N required computing power values in ascending order; wherein, the sum of the top N required computing power values is less than the target available computing power value.
5. The method according to claim 1, wherein The obtaining the target available computing power value of the target edge device includes: Obtaining the target available CPU core number, target CPU load, target maximum CPU core number, target available memory, and target total memory of the target edge device; Determine a target available computing power value according to the target available number of CPU cores, the target CPU load, the target maximum number of CPU cores, the target available memory, and the target total memory.
6. The method according to claim 2, wherein The method further includes: Obtain a task plan of the target edge device; The central device allocates a query operation associated with the target edge device to the target edge device for processing, including: When the task plan of the target edge device indicates that there is no target task within a preset future time period, the central device allocates a query operation associated with the target edge device to the target edge device for processing; The target task is a task whose required computing power value is greater than or equal to a second computing power threshold when executing the task.
7. The method according to any one of claims 1 to 6, characterized in that The method further includes: The central device sends a task processing duration threshold to each edge device, so that each edge device feeds back a processing result within the processing duration threshold.
8. A query device across databases, characterized in that, Applied to a cross-database architecture composed of a central device and multiple edge devices, the device includes: A receiving module, configured to receive a query request sent by a service terminal; An obtaining module, configured to obtain a target available computing power value of a target edge device and a target network bandwidth between the target edge device and the target edge device according to the query request; A judging module, configured to judge whether the target available computing power value is greater than or equal to a first computing power threshold to obtain a first judgment result; if the first judgment result indicates that the target available computing power value is less than the first computing power threshold, then judge whether the target network bandwidth is greater than or equal to a bandwidth threshold to obtain a second judgment result; A query module, configured to, if the second judgment result indicates that the target network bandwidth is less than the bandwidth threshold, decompose a query operation associated with the target edge device to obtain a plurality of query sub-operations, select a target query sub-operation from the plurality of query sub-operations, allocate the target query sub-operation to the target edge device for processing, receive a first sub-processing result fed back by the target edge device, obtain a third target processing result according to the first sub-processing result and other query sub-operations, and feed back a query response to the service terminal according to the third target processing result and other processing results associated with other edge devices, where the other query sub-operations are operations other than the target query sub-operation among the plurality of query sub-operations, and the other edge devices are devices other than the target edge device among the plurality of edge devices.
9. A computing device, characterized in that, Includes a memory and a processor; Wherein, one or more computer programs are stored in the memory, and the one or more computer programs include instructions; when the instructions are executed by the processor, the computing device is caused to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Cross-database data query method and device and readable medium
CN111767304A
Data query method, device and electronic equipment
CN111930770A
Task processing method and device, control equipment and LED display system
CN114220383A
Indexing provenance data and evaluating provenance data queries in data processing systems
US20100299339A1