Distributed power real-time data access system and method
By adopting unified data ID encoding, load balancing, and fault tolerance mechanisms in the power system, the complexity and slow response speed of distributed power real-time data access have been solved, achieving efficient and reliable data access, simplifying system coupling, and improving data access efficiency and reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NARI TECH CO LTD
- Filing Date
- 2026-01-19
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, distributed real-time data access in power systems is characterized by high complexity, slow response speed, and strong system coupling. Traditional methods cannot meet the requirements for efficient and reliable data access.
The system employs a unified data ID encoding module for structured encoding, a unified data access interface module for load balancing and data grouping, concurrent calls, and a fault tolerance module to implement timeout handling, failure retries, and heartbeat detection, thus shielding the details of the underlying data distribution and providing a unified access interface.
It enables transparent access to real-time distributed power data, simplifies application operations, enhances the system's high availability, high concurrency, and low latency characteristics, and significantly improves data access efficiency and reliability.
Smart Images

Figure CN121967462A_ABST
Abstract
Description
A distributed real-time power data access system and method Technical Field
[0001] This invention relates to the field of data access technology, and specifically to a distributed power real-time data access system and method. Background Technology
[0002] With the continuous expansion of power system scale and the in-depth advancement of smart grid construction, distributed storage and access to real-time power data has become an important component of power system informatization. In modern power systems, real-time data is typically distributed and stored in multiple databases across different geographical regions. While this distributed storage architecture improves system reliability and fault tolerance, it also brings technical challenges such as high data access complexity, slow response speed, and strong system coupling.
[0003] Traditional methods suffer from two main problems: First, client applications must know the exact storage location of the data in advance, retrieving it by calling interfaces in each region. This process is cumbersome, highly coupled, and has weak fault tolerance. Second, a centralized database model is used, periodically synchronizing data from various regions to a central database. While this solves some of the problem of geographically dispersed databases, the high data latency and the immense access pressure on the central database make it unsuitable for meeting the urgent need for real-time data access. Therefore, to improve the complexity of current data access, increase data retrieval efficiency, and ensure high availability and reliability of the system, there is an urgent need for a technical solution that can shield the details of the underlying data distribution and provide a unified access interface.
[0004] In existing technologies, requests typically rely on pre-defined data storage locations, which not only complicates the client but also incurs a high coupling cost. Furthermore, while centralized storage models solve the data centralization problem to some extent, the central database often becomes the performance bottleneck of the entire system, struggling to handle large-scale concurrent access. Summary of the Invention
[0005] Purpose of the invention: The purpose of this invention is to provide a distributed power real-time data access system that can shield the details of the underlying data distribution while possessing a unified access interface with high availability, high concurrency, and low latency characteristics, so as to efficiently and reliably access distributed power real-time data. On the other hand, it also provides a method for accessing distributed power real-time data.
[0006] Technical Solution: The distributed real-time power data access system of this invention includes: a unified data ID encoding module, used to encode all real-time data using a structured, globally unique encoding rule, with the encoding including a regional code for directly locating the physical storage location of the data; a unified data access interface module, used to receive client requests, group transmitted data, dynamically allocate requests to the optimal regional service proxy of the corresponding region through a load balancing strategy, compress and decompress transmitted data, and aggregate the results; a fault tolerance module, deployed on the data access side, used to implement timeout handling, failure retry, fault recovery, and heartbeat detection functions; and a regional service node module, deployed on the data storage side, used to store, query, and process local data.
[0007] Furthermore, in the unified data access interface module, data belonging to the same region are grouped together and divided into several data access groups based on the region code in the transmitted data ID encoding.
[0008] Furthermore, the unified data access interface module also includes a load balancing submodule, which records the application layer response time for each request, maintains the average response time schedule of the regional service proxy based on excluding timeout or erroneous requests, and prioritizes assigning a new request to the optimal regional service proxy in the local area.
[0009] Furthermore, if the difference in response time among multiple regional service agents is less than a preset threshold, a round-robin strategy will be enabled to ensure load balancing.
[0010] Furthermore, it also includes a concurrent call function, which is used to send grouped access requests in parallel to the corresponding regional service agents, enabling dual parallel queries from the interface layer to the service node and multiple data services within the node.
[0011] The present invention discloses a distributed power real-time data access method, comprising: a unified data access interface parsing the data ID in a data access request, extracting the region code to which the data belongs, grouping the data IDs that need to access the same region into several data access groups; the unified data access interface creating an independent asynchronous task for each data access group, sending the grouped requests to the corresponding region service agent, evaluating based on the historical response time of all service agents in the region, and prioritizing the allocation of requests to the optimal region service agent for the corresponding region; the unified data access interface compressing and decompressing the request and response data; the region service agent receiving and processing query requests from the unified data access interface, retrieving data from the local database and returning the results; and the unified data access interface receiving responses from all regions, aggregating the results, and returning them to the client.
[0012] Furthermore, if the regional service agent fails to respond multiple times, it is moved to the fault pool, and its recovery is checked periodically through a heartbeat detection mechanism. If it recovers, it is reinstated into the healthy service pool.
[0013] Furthermore, when a query failure request is generated, a failure retry mechanism is introduced into the unified data access interface and regional service proxy. An exponential backoff strategy is adopted for retrying, and the retry delay time increases exponentially with the number of retries and random perturbation is added.
[0014] Beneficial effects: Through unified encoding, grouping, concurrent access, and load balancing, transparent access to distributed real-time power data is achieved. Clients do not need to know the specific storage location of the data to complete the query of data across the entire region. Compared with existing technologies, this invention shields the details of the underlying data distribution, provides a unified access interface, simplifies the data operation process of applications, and reduces system coupling. The system of this invention has the characteristics of high availability, high concurrency, and low latency, significantly improving the efficiency and reliability of power data access, and solving the problems of cumbersome operation, poor fault tolerance, and high data latency in existing technologies. Attached Figure Description
[0015] Figure 1 is a schematic diagram of a distributed real-time power data access system provided in an embodiment of the present invention;
[0016] Figure 2 is a schematic diagram of the specific structure of a distributed real-time power data access system provided in an embodiment of the present invention;
[0017] Figure 3 is a schematic flowchart of a distributed power real-time data access method provided in an embodiment of the present invention;
[0018] Figure 4 is a schematic diagram of a single-call processing flow of the unified data access interface provided in an embodiment of the present invention;
[0019] Figure 5 is a schematic diagram of a single call processing flow for a regional service node provided in an embodiment of the present invention;
[0020] Figure 6 is a schematic diagram of a fault recovery process provided in an embodiment of the present invention. Detailed Implementation
[0021] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings.
[0022] To address the technical challenges of high data access complexity, slow response speed, and strong system coupling in existing distributed power real-time data access systems, and to achieve transparent access and efficient querying of distributed power real-time data, this paper provides a distributed power real-time data access system and method.
[0023] Example 1 This example provides a distributed power real-time data access system. Please refer to Figure 1. The system includes a unified data ID encoding module, a unified data access interface module, a fault tolerance module, and a regional service node module.
[0024] The data ID unified encoding module is used to encode all real-time data using a structured, globally unique encoding rule. The encoding includes a region code, which is used to directly locate the physical storage location of the data.
[0025] For example, all real-time data is encoded using a structured, globally unique encoding rule. The encoding format is: Equipment Type + Region Code + Plant Code + Equipment Code + Measurement Point Type. The encoding includes a region code, used to directly locate the physical storage location of the data. For instance, the data encoding format is 11013200001200022400002002, where 32 represents the Jiangsu region, 000012 represents the plant, 000224 represents the equipment, and 00002002 represents reactive power. By parsing the data ID, the physical server where the data resides can be directly located, providing a basis for subsequent data grouping and request routing.
[0026] This specific structured encoding format embeds the region code directly into the data ID, providing an efficient and direct mechanism for locating the physical storage location of data. It avoids additional data mapping or lookup processes, enabling the unified data access interface module to quickly and accurately identify the region to which data belongs. This provides a solid foundation for subsequent request grouping and concurrent calls, significantly improving the efficiency and accuracy of data routing.
[0027] Please refer to Figure 2. The unified data access interface module is used to receive client requests, group the transmitted data, dynamically allocate requests to the optimal regional service proxy in the corresponding region through load balancing strategy, compress and decompress the transmitted data, and aggregate the results.
[0028] Specifically, the unified data access interface module groups data belonging to the same region based on the region code in the transmitted data ID encoding, dividing them into several data access groups. Upon receiving a query request containing multiple data IDs, it parses the region code in each ID and uses a grouping function to group all data IDs according to their respective region codes, forming multiple data access groups. Each group corresponds to a target region, achieving request aggregation and reducing the number of network connections. For example, after parsing the encoding at the interface layer, data with the same 32-bit encoding are grouped together and sent in batches to the Jiangsu regional service node.
[0029] The unified data access interface module also includes a load balancing submodule, which records the application layer response time for each request and maintains the average response time schedule of the regional service proxy based on excluding timeout or erroneous requests.
[0030] Specifically, the load balancing submodule, after excluding timeout or erroneous requests, maintains the average response time schedule of healthy regional service proxies. Upon receiving a new request, it prioritizes assigning it to the local best regional service proxy. The best regional service proxy can be understood as the regional service proxy with the fastest response time. When the response time difference among multiple regional service proxies is less than a preset threshold, a round-robin strategy is activated to ensure load balancing. If the response time difference among multiple regional service proxies is less than 5ms, a round-robin strategy is activated to ensure load balancing.
[0031] The unified data access interface module dynamically allocates requests to the optimal regional service proxy in the corresponding region through a load balancing strategy, compresses and decompresses the transmitted data, and aggregates the results. This module uses the GZIP algorithm to compress request data and decompress it at the receiving end, performing the same processing on response data, significantly reducing the amount of data transmitted over the network and improving query efficiency.
[0032] The system also includes a concurrent call submodule, which sends grouped access requests in parallel to the corresponding regional service agents, enabling dual parallel queries from the interface layer to the service node and within the node for multiple data services.
[0033] Specifically, the concurrent call submodule uses multithreading technology to create independent asynchronous tasks for each data access group and send them in parallel to the corresponding regional service agent. After receiving the batch requests, the regional service agent activates multiple real-time data services under its jurisdiction to initiate query operations in parallel, realizing dual parallel processing from the interface layer to the node and multiple services within the node.
[0034] The fault tolerance module, deployed on the data access side, is used to implement timeout handling, failure retry, fault recovery, and heartbeat detection functions.
[0035] For example, in terms of timeout handling, both the data access interface and the regional service proxy have timeout handling functions. Concurrent query tasks are submitted through the thread pool, and a waiting timeout is set for each query task. With the help of the counter latch mechanism, the main thread waits for all child thread tasks to complete, and timeout tasks are immediately interrupted and marked as failed.
[0036] The timeout mechanism allows for precise control over the execution time of each concurrent task, effectively preventing the entire query process from being blocked by a single slow or unresponsive service node, thus avoiding prolonged occupation of system resources and request backlog. Setting a wait timeout ensures that tasks do not wait indefinitely, while the counter latch mechanism coordinates the synchronization between the main thread and subtasks, enabling the system to maintain overall responsiveness and stability even when some services experience performance degradation, thereby improving system availability.
[0037] Regarding retries, for requests that fail for specific query types, a retry mechanism is introduced within the fault tolerance system and regional service proxy, employing an exponential backoff plus random jitter strategy. The retry latency formula is as follows:
[0038] `delay = random(0, base_delay × (2 ^ (retry_count - 1)))`; The base delay `base_delay` is set to 1 second, and the maximum number of retries is 2. Setting the base delay `base_delay` to 1 second and the maximum number of retries to 2 results in retry delay ranges of 0-1 seconds for the first retry and 0-2 seconds for the second retry, effectively preventing service avalanche.
[0039] By combining exponential backoff and random jitter retry strategies, common problems in distributed systems, such as transient network fluctuations or temporary service overload, can be effectively addressed, significantly improving query success rates and system health. The exponential backoff mechanism gradually extends the retry interval, avoiding retries for faulty services; while random jitter further distributes retry requests, preventing a large number of clients from retrying simultaneously, thus protecting the recovery capabilities of backend services.
[0040] In terms of fault recovery, the fault recovery function is deployed within the fault tolerance unit. A failure counter is maintained for each regional service agent. After one call and two retries, the failure counter is incremented by 1. When the number of consecutive failures reaches the threshold of 3, the service agent is moved from the healthy server pool to the faulty server pool.
[0041] By introducing a failure counter and threshold mechanism, the system can intelligently distinguish between transient and persistent failures. This avoids immediately isolating service nodes due to occasional errors, while ensuring timely isolation of persistently unstable or failed nodes. This mechanism effectively prevents client requests from being continuously routed to faulty nodes, thereby improving the overall stability and reliability of the service and ensuring that clients always access healthy backend services.
[0042] In terms of heartbeat detection, the heartbeat detection is deployed in the fault tolerance unit. It sends a heartbeat request to the proxy server in the fault server pool every 3 seconds. It adopts a continuous success judgment strategy. After receiving 3 consecutive successful responses, it is determined that the server function has recovered. The recovered proxy service is then moved back to the healthy server pool.
[0043] The automatic recovery mechanism, employing heartbeat detection and a consecutive success evaluation strategy, ensures that isolated faulty nodes can be promptly reinstated after recovery, maximizing system resource utilization. By periodically probing and requiring multiple consecutive successful responses, it avoids reintroducing unstable nodes into the health pool due to momentary or false recoveries, thus guaranteeing the reliability of the recovery process. This allows the system to dynamically adapt to changes in the state of backend services, improving the overall system's resilience and availability.
[0044] The regional service node module, deployed on the data storage side, is used to store, query, and process local data. This module has data compression capabilities, using the GZIP algorithm to decompress and compress request and response bodies, reducing network transmission volume.
[0045] The distributed power real-time data access system provided in this embodiment of the invention achieves precise data location through structured globally unique coding rules, improves access efficiency through data grouping and concurrent calls, optimizes resource utilization through load balancing strategies, and ensures system stability through fault tolerance mechanisms, thereby achieving efficient and reliable access to distributed power real-time data.
[0046] Example 2 This embodiment of the invention also provides a distributed power real-time data access method. Please refer to Figure 3. The method achieves efficient multi-region data access through structured data encoding and concurrent processing technology.
[0047] S1. The unified data access interface parses the data ID in the data access request, extracts the region code to which the data belongs, and groups the data IDs that need to access the same region into several data access groups.
[0048] Specifically, the process begins by parsing the data ID in the data access request, extracting the region code to which the data belongs, and grouping data IDs that need to access the same region together to form several data access groups. The data ID uses a structured, globally unique data encoding rule, with the encoding format being: Device Type + Region Code + Plant Code + Device Code + Measurement Point Type. The region code explicitly points to the server or cluster node to which the data belongs. For example, in the data encoding 11013200001200022400002002, 32 represents the Jiangsu region, 000012 represents the plant, 000224 represents the device, and 00002002 represents reactive power. After parsing the encoding at the interface layer, data with the same 32-bit encoding are grouped together to achieve request aggregation and reduce the number of network connections.
[0049] S2. The unified data access interface creates an independent asynchronous task for each data access group, sends the grouped requests to the corresponding regional service agent, evaluates the historical response time of all service agents in the region, and prioritizes allocating the requests to the optimal regional service agent in the corresponding region.
[0050] Specifically, an independent asynchronous task is created for each data access group, sending the grouped requests to the corresponding regional service proxy. Based on the historical response times of all service proxies in that region, requests are preferentially assigned to the optimal regional service proxy. The load balancing module is deployed at the data access interface layer, recording the application layer response time for each request. Excluding timeout or erroneous requests, it maintains the average response time schedule of healthy regional service proxies. Upon receiving a new request, it is preferentially assigned to the fastest-responding service proxy in the local area. If the response time difference among multiple service proxies is less than a set threshold of 5ms, a round-robin strategy is activated to ensure load balancing.
[0051] S3. The unified data access interface compresses and decompresses request and response data.
[0052] Specifically, during data transmission, the unified data access interface compresses and decompresses request and response data. The data access interface and regional service nodes possess data compression capabilities, using the GZIP algorithm to compress and decompress the request and response bodies, reducing network transmission volume and improving data transmission efficiency.
[0053] S4. The regional service agent receives and processes query requests from the unified data access interface, retrieves data from the local database, and returns the results. The unified data access interface receives responses from all regions, aggregates the results, and returns them to the client.
[0054] Specifically, the regional service agent receives and processes query requests from the unified data access interface, retrieves data from the local database, and returns the results. Upon receiving batch requests, the regional service agent initiates parallel query operations using multiple real-time data services under its jurisdiction, achieving dual parallel processing from the interface layer to the node and across multiple services within the node. The unified data access interface receives responses from all regions, aggregates the results, and returns them to the client. The system uses multi-threading technology, coupled with a counter-latch mechanism, where the main thread waits for all child thread tasks to complete, ensuring that all regional data is collected completely before a unified return is made.
[0055] Optionally, to ensure system stability, when a service proxy fails to respond multiple times, the system moves it to a fault pool. A heartbeat mechanism periodically checks whether it has recovered; if so, it is reinstated to the healthy service pool. The fault recovery function maintains a failure counter for each regional service proxy. After one call and two retries, if the failure still occurs, the failure counter is incremented by 1. When the number of consecutive failures reaches a threshold of three, the service proxy is moved from the healthy server pool to the fault server pool. The heartbeat detection periodically sends heartbeat requests to the proxy servers in the fault server pool every 3 seconds, using a consecutive success determination strategy. After receiving three consecutive successful responses, the server is considered to have recovered, and the recovered proxy server is moved back to the healthy server pool.
[0056] The system also features robust timeout handling and retry mechanisms. Concurrent query tasks are submitted using a thread pool, and a timeout is set for each task. Timeout tasks are immediately interrupted and marked as failed. When a specific type of query failure occurs, a retry mechanism is introduced into the unified data access interface and regional service proxy. An exponential backoff strategy is used for retries, with the retry delay increasing exponentially with the number of retries and incorporating random perturbations. The retry delay formula is delay = random(0, base_delay × (2 ^ (retry_count - 1))), where the base delay is set to 1 second, and the maximum number of retries is 2, effectively preventing service avalanche.
[0057] Through the above-mentioned technical solution provided by the present invention, the present invention realizes efficient access to real-time distributed power data, and significantly improves the system's response speed and reliability through intelligent grouping, concurrent processing, load balancing and fault tolerance mechanisms.
[0058] Example 3 assumes that the power system needs to query real-time data distributed in two regions, Jiangsu and Zhejiang.
[0059] S1. The client initiates a query request, which contains the IDs of multiple data points, for example: ID of data point A: 11013200001200022400002002 (representing the reactive power of a certain device in a certain plant in Jiangsu region); ID of data point B: 11013300001500030000001001 (representing the active power of a certain device in a certain plant in Zhejiang region); ID of data point C: 11013200001300022500002003 (representing the voltage of a certain device in another plant in Jiangsu region).
[0060] S2. The client sends a query request containing the IDs of the three data points mentioned above to the unified data access interface module. After receiving the request, the unified data access interface module parses each data ID. The ID encoding format is "equipment type + region code + plant code + equipment code + measurement point type". For data points A and C, the region code in their IDs is 32, indicating that they belong to the Jiangsu region. For data point B, the region code in its ID is 33, indicating that it belongs to the Zhejiang region.
[0061] S3. The interface layer groups the requests based on the parsed region codes: Group 1 (Jiangsu region): contains query requests for data points A and C; Group 2 (Zhejiang region): contains query requests for data point B.
[0062] S4. Before sending the grouped requests, the unified data access interface uses the GZIP algorithm to compress the request data of the two groups to reduce network bandwidth consumption. The unified data access interface module creates an asynchronous task for group one and prepares to send it to the service proxy node in the Jiangsu region. Assuming there are multiple service proxy nodes in the Jiangsu region (e.g., Jiangsu proxy 1 and Jiangsu proxy 2), the load balancing module will query their historical response times. If Jiangsu proxy 1 currently has the fastest response time, the request for group one will be sent to Jiangsu proxy 1. At the same time, another asynchronous task is created for group two and sent to the service proxy node in the Zhejiang region (e.g., Zhejiang proxy 1).
[0063] S5. The requests for these two groups are sent in parallel, which can greatly shorten the overall query time.
[0064] S6. After receiving the compressed request packet 1, Jiangsu Agent 1 first decompresses it and then further distributes the request to multiple real-time data service nodes under its jurisdiction (such as Jiangsu Real-time Data Service 1 and Jiangsu Real-time Data Service 2). These service nodes will query the real-time values of data points A and C from their respective distributed real-time databases. During this process, the fault tolerance module monitors these requests. For example, if Jiangsu Agent 1 fails to respond within the set timeout period, or fails several queries consecutively, the fault tolerance module will trigger a failure retry mechanism. If the retry still fails, the fault tolerance module will temporarily isolate Jiangsu Agent 1 from the healthy service pool and periodically perform heartbeat checks, reactivating it once it recovers.
[0065] S7. After all regional service agent nodes (including nodes that have been retried or recovered from failures) return query results, the unified data access interface module will collect these results, decompress them, and then aggregate the real-time values of all data points to form a complete response, which will eventually be returned to the client.
[0066] Through the above embodiments of the present invention, the client only needs to provide the data ID, without needing to care about which region or database the data is specifically stored in, nor needing to handle complex distributed coordination and fault situations, to transparently, efficiently and reliably obtain the required real-time power data.
[0067] Example 4: The present invention provides a computer device including one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors.
[0068] The processor employs a multi-core CPU architecture, possessing powerful parallel computing capabilities and able to handle multiple data access tasks simultaneously. Memory includes main memory (RAM) and hard disk storage; RAM is used for temporary storage of data and intermediate results during program execution, while hard disk storage is used for permanent storage of program code and configuration information. The processor connects to the memory via the system bus, enabling high-speed data transfer and access.
[0069] When the program is executed by the processor, it implements the same distributed power real-time data access method as in Example 2. This method includes core functions such as parsing the data ID in the data access request and extracting the region code, creating asynchronous tasks for load balancing, data compression processing, local database querying, and result aggregation.
[0070] Specifically, when the processor executes the program, it first parses the data ID in the data access request, extracts the region code using the same structured coding rules as in Example 2, and groups the data IDs that need to access the same region together. The processor's multi-threaded processing capability enables the grouping operation to be executed efficiently in parallel, significantly improving the data processing speed.
[0071] In terms of asynchronous task creation and load balancing, the processor leverages its multi-core architecture to create independent asynchronous tasks for each data access group, performing intelligent routing based on a node response time schedule maintained in memory. The response time data in memory is updated in real time, providing accurate information for the processor's decisions.
[0072] For data compression and decompression, the processor integrates a GZIP algorithm processing module, enabling efficient data compression operations. The compressed data is temporarily stored in memory, reducing the burden on network transmission.
[0073] When a service agent fails, the program executes fault detection and recovery logic on the processor, moving the failed service agent to a fault pool in memory and monitoring the node status through a periodic heartbeat detection mechanism. The processor's timed task scheduling function ensures the accurate execution of heartbeat detection.
[0074] The large capacity of the memory supports the storage of large amounts of historical data and configuration information, ensuring stable system operation. The collaborative work of the processor and memory enables efficient distributed real-time power data access. Through hardware-level optimization combined with software algorithms, the overall system performance and reliability are significantly improved.
[0075] Example 5: This invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, enables the implementation of various functions of a distributed power real-time data access method.
[0076] The computer-readable storage medium may be a non-volatile storage medium, including but not limited to hard disks, solid-state drives, optical disks, magnetic tapes, flash memory, read-only memory (ROM), random access memory (RAM), etc. The computer program stored on the storage medium contains complete executable code, providing all functional modules for implementing real-time data access to distributed power systems.
[0077] When the processor executes the computer program in the storage medium, it first executes the data access request parsing module. This module has the same data ID parsing function as described in Example 2. It uses the same structured globally unique data encoding rules to parse the data, extract the region code, and group the data IDs by region.
[0078] Next, the asynchronous task creation and load balancing module is executed. This module implements the same concurrent processing mechanism as in Example 2, creating independent asynchronous tasks for each data access group and selecting the optimal regional service proxy based on historical response time evaluation.
[0079] The program also includes a data compression processing module, which uses the same GZIP algorithm as in Example 2 to compress and decompress request and response data, reducing network transmission overhead.
[0080] The data query processing module is responsible for receiving and processing query requests from the regional service agent, retrieving data from the local database and returning the results. Its working principle is consistent with the query processing mechanism described in Example 2.
[0081] The result aggregation module implements the same multi-threaded result collection mechanism as in Example 2, using a counter latch mechanism to wait for all regions to respond before performing unified result aggregation.
[0082] In a preferred embodiment, the computer program further includes a fault handling module that moves a service agent into a fault pool when the service agent fails to respond multiple times, periodically checks its recovery status through a heartbeat detection mechanism, and reintegrates it into the healthy service pool after recovery. This function is exactly the same as the fault recovery mechanism in Embodiment 2.
[0083] In another preferred embodiment, the data compression processing module specifically uses the GZIP algorithm to implement the compression function, which is consistent with the compression scheme in Embodiment 2.
[0084] This computer-readable storage medium, by storing complete executable program code, enables any computing device with a corresponding processor to achieve efficient distributed real-time power data access, offering excellent portability and deployment flexibility. During program execution, it fully utilizes the parallel computing capabilities of multi-core processors to achieve high-concurrency data access processing, significantly improving the overall system performance and response speed.
Claims
1. A distributed real-time power data access system, characterized in that, include: The data ID unified encoding module is used to encode all real-time data using a structured, globally unique encoding rule. The encoding includes a region code to locate the physical storage location of the data. The unified data access interface module is used to receive client requests, group the transmitted data, dynamically allocate requests to the optimal regional service proxy in the corresponding region through a load balancing strategy, compress and decompress the transmitted data, and aggregate the results. The fault tolerance module, deployed on the data access side, is used to implement timeout handling, failure retry, fault recovery, and heartbeat detection functions; the regional service node module, deployed on the data storage side, is used to store, query, and process local data.
2. The data access system according to claim 1, characterized in that, In the unified data access interface module, data belonging to the same region are grouped together and divided into several data access groups according to the region code in the transmitted data ID encoding.
3. The data access system according to claim 1, characterized in that, The unified data access interface module also includes a load balancing submodule, which records the application layer response time for each request, maintains the average response time schedule of the regional service proxy based on excluding timeout or erroneous requests, and prioritizes assigning a new request to the optimal regional service proxy in the local area.
4. The data access system according to claim 3, characterized in that, If the difference in response time among multiple regional service agents is less than a preset threshold, a round-robin strategy will be enabled to ensure load balancing.
5. The data access system according to claim 1, characterized in that, It also includes a concurrent call function, which is used to send grouped access requests in parallel to the corresponding regional service proxies, enabling dual parallel queries from the interface layer to the service node and multiple data services within the node.
6. A method for accessing distributed power real-time data, characterized in that, include: The unified data access interface parses the data ID in the data access request, extracts the region code to which the data belongs, and groups data IDs that need to access the same region into several data access groups. The unified data access interface creates an independent asynchronous task for each data access group, sends the grouped requests to the corresponding regional service proxy, evaluates the historical response time of all service proxies in that region, and prioritizes assigning the request to the best regional service proxy for that region. The unified data access interface compresses and decompresses the request and response data. The regional service proxy receives and processes the query requests from the unified data access interface, retrieves the data from the local database, and returns the results. The unified data access interface receives the responses from all regions, aggregates the results, and returns them to the client.
7. The data access method according to claim 6, characterized in that, If the regional service agent fails to respond multiple times, it is moved to the fault pool, and its recovery is checked periodically through a heartbeat detection mechanism. If it recovers, it is reinstated into the healthy service pool.
8. The data access method according to claim 6, characterized in that, When a query fails, a retry mechanism is introduced into the unified data access interface and regional service proxy. An exponential backoff strategy is used for retrying, and the retry delay time increases exponentially with the number of retries and is subject to random perturbation.
9. A computer device, characterized in that, It includes one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the programs, when executed by the processors, implement the steps of the data access method as described in any one of claims 6-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the data access method as described in any one of claims 6-8.