Power grid operation data analysis method and system based on big data

By dividing and allocating power grid operation data blocks according to computing node performance and optimizing the creation of data analysis containers, the data skew problem is solved, significantly improving the efficiency of power grid operation data analysis and shortening task execution time.

CN118568060AInactive Publication Date: 2024-08-30SHANGHAI LANWEN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410956870.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-08-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Big data technology causes uneven distribution of computing node resources due to data skew in power grid operation data analysis, affecting overall computing efficiency and prolonging task execution time.

Method used

By splitting the power grid running data file into multiple data blocks according to the performance of the computing node, and creating a data analysis container on the computing node according to the data block size and performance difference, the data block allocation and grouping are optimized to ensure that each MapTask processing time is close and reduced Data copy and IO operations.

Benefits of technology

It improves the data processing speed, reduces the impact of data skew, significantly reduces the execution time of MapReduce tasks, and improves the efficiency of power grid operation data analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568060A
    Figure CN118568060A
Patent Text Reader

Abstract

The invention relates to the field of big data, in particular to a power grid operation data analysis method and system based on big data, and the method specifically comprises the steps: obtaining a power grid operation data file, and obtaining the size of a data block of each calculation node and the minimum value of the size of the data block in all calculation nodes based on the performance of the calculation nodes in a cluster; segmenting the file into a plurality of data blocks according to the sizes of the data blocks of all the computing nodes, and distributing the data blocks to the computing nodes; screening out the data blocks of which the actual data volume is smaller than the minimum value from the data blocks of each file, grouping the screened data blocks, and determining computing nodes corresponding to the data blocks in groups based on the data block groups; and creating at least one data analysis container at the computing node according to the data slicing and grouping conditions of the computing node, and running a data analysis program in the container.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data, and in particular to a power grid operation data analysis method and system based on big data. Background Art

[0002] A lot of data is generated during the operation of the power grid, including power generation data, transmission and distribution data, user data, control data, etc. For example, the power generation of each power station, the operating status of power generation equipment, fuel consumption, emission indicators, etc., and the power consumption and electricity usage habits of households, industries, and commercial users. By analyzing the power grid operation data, it is possible to more accurately predict power demand, optimize power generation and transmission plans, thereby improving the operating efficiency of the power system and reducing energy waste. In addition, real-time monitoring and analysis of power grid operation data can detect potential faults early, conduct early warnings and handle them, reduce the frequency and impact of faults, and ensure the safe and stable operation of the power grid. In addition, it can also provide data support for decision-making.

[0003] Faced with the large amount of data generated every day, big data technology can quickly process and analyze massive data through distributed storage and parallel computing. However, data skew causes some nodes to process much more data than other nodes, resulting in uneven resource allocation. As a result, some nodes will become bottlenecks, seriously affecting the overall computing efficiency and prolonging the execution time of the task. Summary of the invention

[0004] In order to solve the above problems, the present invention provides a method for analyzing power grid operation data based on big data, the method comprising the following steps: Obtaining a power grid operation data file, obtaining a data block size of each computing node and a minimum value of the data block sizes of all computing nodes based on the performance of the computing nodes in the cluster, dividing the file into multiple data blocks according to the data block sizes of all computing nodes and allocating the data blocks to the computing nodes; Filter out data blocks of each file whose actual data volume is smaller than the minimum value, group the filtered data blocks, and determine computing nodes corresponding to the data blocks in the group based on the data block grouping; At least one data analysis container is created on the computing node according to the data slicing and grouping conditions of the computing node, and a data analysis program is run in the container.

[0005] Preferably, the data block size of each computing node is obtained based on the performance of the computing nodes in the cluster, specifically: The score of the computing node is calculated based on the CPU processing performance, memory read and write speed and size, and disk IO performance, and the data block size is determined according to the score.

[0006] Preferably, the grouping of the filtered data blocks is specifically as follows: Sort the data blocks according to the actual data volume of the filtered data blocks to obtain a sorted queue; Starting from the first data block after sorting, select at least one data block from the remaining data blocks after sorting so that the sum of the actual data volume of all selected data blocks and the first data block is closest to the data slice of the computing node where the first data block is located, and use the computing node where the first data block is located as the computing node of the group where the first data block is located, delete the first data block and all selected data blocks from the sorting queue, and re-sort the data blocks according to the actual data volume in the data blocks to obtain a sorting queue; repeat the above process until the sorting queue is empty.

[0007] Preferably, the step of creating at least one data analysis container on a computing node according to data slicing and grouping conditions of the computing node is as follows: For each computing node, calculate the sum of the number of data slices of the file in the computing node and the number of groups corresponding to the computing node; Create the MapTask container with the sum number.

[0008] Preferably, the data analysis program is a Map phase program of a Hadoop task.

[0009] On the other hand, the present invention provides a power grid operation data analysis system based on big data, the system comprising the following modules: A file segmentation module is used to obtain a power grid operation data file, obtain a data block size of each computing node and a minimum value of the data block size of all computing nodes based on the performance of the computing nodes in the cluster, and segment the file into multiple data blocks according to the data block size of all computing nodes and allocate the data blocks to the computing nodes; A node allocation module, used for screening out data blocks of each file whose actual data volume is less than the minimum value, grouping the screened data blocks, and determining computing nodes corresponding to the data blocks in the group based on the data block grouping; The execution module is used to create at least one data analysis container in the computing node according to the data slicing and grouping conditions of the computing node, and run the data analysis program in the container.

[0010] Preferably, the data block size of each computing node is obtained based on the performance of the computing nodes in the cluster, specifically: The score of the computing node is calculated based on the CPU processing performance, memory read and write speed and size, and disk IO performance, and the data block size is determined according to the score.

[0011] Preferably, the grouping of the filtered data blocks is specifically as follows: Sort the data blocks according to the actual data volume of the filtered data blocks to obtain a sorted queue; Starting from the first data block after sorting, select at least one data block from the remaining data blocks after sorting so that the sum of the actual data volume of all selected data blocks and the first data block is closest to the data slice of the computing node where the first data block is located, and use the computing node where the first data block is located as the computing node of the group where the first data block is located, delete the first data block and all selected data blocks from the sorting queue, and re-sort the data blocks according to the actual data volume in the data blocks to obtain a sorting queue; repeat the above process until the sorting queue is empty.

[0012] Preferably, the step of creating at least one data analysis container on a computing node according to data slicing and grouping conditions of the computing node is as follows: For each computing node, calculate the sum of the number of data slices of the file in the computing node and the number of groups corresponding to the computing node; Create the MapTask container with the sum number.

[0013] Preferably, the data analysis program is a Map phase program of a Hadoop task.

[0014] Finally, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method described above is implemented.

[0015] Faced with the large amount of power grid operation data generated every day, improving the data processing speed has become the key, especially in fault monitoring, etc. Based on this, the present invention adopts different data block sizes for different computing nodes, and adopts larger data blocks for computing nodes with good performance, so that a MapTask can process more data. For computing nodes with poor performance, smaller data blocks are used, so that the MapTask processing time of each computing node is close; in addition, for the part of each file that does not occupy a full data block at the end, the data blocks are grouped and allocated to the node where the data block with the largest actual data volume is located in a manner of one computing node corresponding to multiple data blocks. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a flow chart of Embodiment 1; Figure 2 This is a detailed diagram of MapReduce execution before the present invention is adopted; Figure 3 This is a detailed diagram of MapReduce execution after adopting the present invention; Figure 4 This is a structural diagram of the second embodiment. DETAILED DESCRIPTION

[0017] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] In the first embodiment, the present invention provides a method for analyzing power grid operation data based on big data, such as Figure 1 As shown, the method comprises the following steps: S1, obtaining a power grid operation data file, obtaining a data block size of each computing node and a minimum value of the data block size of all computing nodes based on the performance of the computing nodes in the cluster, dividing the file into multiple data blocks according to the data block sizes of all computing nodes and assigning the data blocks to the computing nodes; In the operation of the power grid, various data will be generated, including but not limited to the voltage, current, reactive power, active power of each transmission line, transformer load, current, temperature, user power consumption, power consumption period, power generation and emission of power stations, etc. A large amount of operation data will be generated every day. The analysis of these data can not only intelligently control the dispatch of the power grid, but also help to provide data support. The power grid operation data files come from different places, and the data volume is also different. The transformer data of the substation is larger than the data volume of the transformer at the load end, and the power grid operation data file includes the power grid operation data. Due to the different computing performances of different computing nodes in the cluster, some computing nodes have large memory capacity, stronger CPU performance, and faster disk IO speed. In this case, a larger data block can improve the locality of the data block, reduce the copying of files in different computing nodes, and can reduce IO operations and improve data reading and writing efficiency. The data block size of each computing node is obtained based on the performance of the computing nodes in the cluster. In one embodiment, the CPU performance is quantified, and the computing node performance is determined according to the quantified CPU performance, memory size, and disk read and write speed, and then the data block size is determined according to the performance. A data block is the smallest unit for storing files in HDFS (Hadoop Distributed File System), which is also the smallest unit for file division. If the data block size is 128M, even if a file is 1K, it will be allocated a data block.

[0020] In another embodiment, the data block size of each computing node is obtained based on the performance of the computing nodes in the cluster, specifically: the score of the computing node is calculated according to the CPU processing performance, memory read and write speed and size, and disk IO performance, and the data block size is determined according to the score. In a more specific embodiment, the CPU processing performance is represented by the number of CPU cores and threads. The larger the number of cores and threads, the higher the CPU processing performance. There are many ways to calculate the score of the computing node based on the CPU processing performance, memory read and write speed and size, and disk IO performance, that is, disk read and write speed, including but not limited to weighted summation. After obtaining the score, the data block size is determined according to the score. The higher the score, the larger the data block size. In a more specific embodiment, the data block size is an integer multiple of 64M. After obtaining the data block size of all computing nodes, the power grid operation data file is divided into multiple data blocks and assigned to the computing nodes. Since the data block size is an integer multiple of 64M, each file has multiple ways of segmentation. For example, all computing nodes have three data block sizes of 64M, 128M, and 192M. For a file of size 652M, it can be divided into three data blocks of 192M and two data blocks of 64M, or it can be divided into two data blocks of 192M, two data blocks of 128M, and one data block of 64M. The specific segmentation method is limited by the number of computing nodes corresponding to different data blocks and the storage capacity of the computing nodes. That is, if there are more computing nodes corresponding to the same data block size and the corresponding computing nodes have larger free storage, then more data blocks of this data block size will be segmented, otherwise fewer. The above process is for each file. Of course, there are other ways of splitting and allocating to computing nodes, such as random splitting and random allocation, or balanced splitting and balanced allocation, etc. The random splitting and random allocation is to randomly split the file into data blocks of different data block sizes, and then randomly allocate them to computing nodes; the balanced splitting and balanced allocation is to split the file into data blocks of similar number for each data block size, and then evenly allocate them to computing nodes. Taking the above data as an example, the method of splitting into 2 192M, 2 128M and 1 64M data blocks is more balanced than 3 192M and 2 64M data blocks, which can avoid overloading a certain computing node. In order to reduce the waste of storage resources, when splitting, the last data block is the minimum value of all data block sizes. For example, after the previous split, there are 4M left, then it will be allocated to the 64M data block. If there are 68M left, it will be split into two 64M data blocks.

[0021] In one embodiment, the file is divided into multiple data blocks according to the data block size of all computing nodes. Specifically, the file size is determined before division. If the file size is an integer multiple of the minimum value, the file is divided into multiple data blocks according to the data block size of all computing nodes and allocated to the computing nodes; otherwise, the file is divided into multiple data blocks according to the data block size of all computing nodes and allocated to the computing nodes, and the size of the last data block is the minimum value.

[0022] S2, filtering out data blocks of each file whose actual data volume is smaller than the minimum value, grouping the filtered data blocks, and determining computing nodes corresponding to the data blocks in the group based on the data block grouping; After the data blocks of the file are allocated to the computing nodes through S1, since the last part of some files is not completely equal to the minimum value, there will be an idle part in the data block, that is, there is no actual data of the file. When processing this part of the data block, if it corresponds to a data slice, it will lead to a waste of resources. This is because a data slice corresponds to a MapTask. If there is little data in a data slice, a MapTask will still be created. If the data block is smaller than the data slice size, the data block will be obtained from the local node or other computing nodes until the size of all the acquired data blocks is the same as the data slice size. In many cases, the actual data of the last data block of the file does not completely occupy the database size. For example, if a file is 8M and the minimum value of the data block is 128M, a 128M data block will be allocated to this file, but the actual amount of data in the data block is 8M. In one embodiment, the data blocks whose actual data in the data blocks of each file is less than the minimum value are specifically: obtaining the last data block of each file, judging whether the space occupied by the actual data in the last data block is less than the data block size, and if so, taking the last data block as the filtered data block. In one embodiment, the data slice size corresponding to a node is positively correlated with the data block size. If a computing node has better performance, the data block is larger and the corresponding data slice is also larger. Due to the better performance, the processing speed is faster. In a more specific embodiment, the data slice size (split size) corresponding to a node is the same as the data block size (block size). In another embodiment, the data slice size corresponding to a node is an integer multiple of the node data block size. Among them, the data blocks of each computing node are not exactly the same.

[0023] In order to allow a MapTask to process as much file data as possible and to maintain the balance of calculation and prevent data skew, in one embodiment, the filtered data blocks are grouped as follows: Sort the data blocks according to the actual data volume of the filtered data blocks to obtain a sorted queue; Starting from the first data block after sorting, select at least one data block from the remaining data blocks after sorting so that the sum of the actual data volume of all selected data blocks and the first data block is closest to the data slice of the computing node where the first data block is located, and use the computing node where the first data block is located as the computing node of the group where the first data block is located, delete the first data block and all selected data blocks from the sorting queue, and re-sort the data blocks according to the actual data volume in the data blocks to obtain a sorting queue; repeat the above process until the sorting queue is empty.

[0024] After obtaining the filtered data blocks, the data blocks are sorted according to the actual data volume in the data blocks to obtain a sorted queue, wherein the actual data volume in the data blocks refers to the amount of data in the power grid operation data file stored in the data blocks. For example, if the size of a data block is 128M and the size of a power grid operation data file is 2M, then the actual data volume in the data block is 2M.

[0025] Starting from the first data block in the sorting queue, at least one data block is selected from the remaining data blocks in the sorting queue, that is, the second data block, so that the sum of the actual data amount in the selected data block and the actual data amount of the first data block is closest to the data slice size of the computing node where the first data block is located, and the computing node where the first data block is located is used as the computing node of the group where the first data block is located. For example, the sorting queue is {(Block2, 52M), (Block5, 31M), (Block4, 11M), (Block1, 5M), (Block3, 2M)}, the first data block is Block2, assuming that the computing node where Block2 is located is 8, and its corresponding data slice is 64M, then the actual data amount of Block2 and Block4 is 63M, which is closest to 64M, so Block2 and Block4 are grouped together, and the node where Block2 is located is used as the computing node of the group. Block2 and Block4 are deleted from the sorting queue. The new sorting queue is {(Block5, 31M), (Block1, 5M), (Block3, 2M)}. At this time, Block5 is used as the first data block. Repeat the above process. Assuming that the data slice of Block5 is also 64M, Block5, Block1, and Block3 are grouped together.

[0026] Through the above process, not only can the data replication between different nodes be minimized, but it also helps to ensure that the actual amount of data processed by each MapTask is basically the same, thereby reducing the impact of data skew. Figure 2 , 3The following table shows the execution time of tasks before and after using the solution of the present invention in the same Hadoop cluster when submitting the same analysis program. Figure 2 , 3 It can be seen that the present invention can significantly reduce MapTime, specifically, from 2 minutes and 18 seconds to 1 minute and 36 seconds.

[0027] S3, creating at least one data analysis container on the computing node according to the data slicing and grouping conditions of the computing node, and running a data analysis program in the container.

[0028] After obtaining the data blocks and data block groups, the computing node creates a data analysis container for each data block that is not in the group, and creates a data analysis container for the group according to the node where the group is located. The data analysis container created for the group will analyze the data of all data blocks in the group. Specifically, the creation of at least one data analysis container on the computing node according to the data slicing and grouping of the computing node is as follows:

[0029] For each computing node, the sum of the number of data slices of the file on the computing node and the number of groups corresponding to the computing node is calculated; and MapTask containers of the sum number are created.

[0030] Preferably, the data analysis program is a Map phase program of a Hadoop task.

[0031] In the second embodiment, the present invention provides a power grid operation data analysis system based on big data, such as Figure 4 As shown, the system includes the following modules: A file segmentation module is used to obtain a power grid operation data file, obtain a data block size of each computing node and a minimum value of the data block size of all computing nodes based on the performance of the computing nodes in the cluster, and segment the file into multiple data blocks according to the data block size of all computing nodes and allocate the data blocks to the computing nodes; A node allocation module, used for screening out data blocks of each file whose actual data volume is less than the minimum value, grouping the screened data blocks, and determining computing nodes corresponding to the data blocks in the group based on the data block grouping; The execution module is used to create at least one data analysis container in the computing node according to the data slicing and grouping conditions of the computing node, and run the data analysis program in the container.

[0032] Preferably, the data block size of each computing node is obtained based on the performance of the computing nodes in the cluster, specifically: The score of the computing node is calculated based on the CPU processing performance, memory read and write speed and size, and disk IO performance, and the data block size is determined according to the score.

[0033] Preferably, the grouping of the filtered data blocks is specifically as follows: Sort the data blocks according to the actual data volume of the filtered data blocks to obtain a sorted queue; Starting from the first data block after sorting, select at least one data block from the remaining data blocks after sorting so that the sum of the actual data volume of all selected data blocks and the first data block is closest to the data slice of the computing node where the first data block is located, and use the computing node where the first data block is located as the computing node of the group where the first data block is located, delete the first data block and all selected data blocks from the sorting queue, and re-sort the data blocks according to the actual data volume in the data blocks to obtain a sorting queue; repeat the above process until the sorting queue is empty.

[0034] Preferably, the step of creating at least one data analysis container on a computing node according to data slicing and grouping conditions of the computing node is as follows: For each computing node, calculate the sum of the number of data slices of the file in the computing node and the number of groups corresponding to the computing node; Create the MapTask container with the sum number.

[0035] Preferably, the data analysis program is a Map phase program of a Hadoop task.

[0036] In a third embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described in the first embodiment is implemented.

[0037] Through the description of the above implementation methods, technicians in this field can clearly understand that each implementation method can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0038] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it, and other embodiments may also be used. Although the present invention has been described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for analyzing power grid operation data based on big data, characterized in that: The method comprises the following steps: Obtaining a power grid operation data file, obtaining a data block size of each computing node and a minimum value of the data block sizes of all computing nodes based on the performance of the computing nodes in the cluster, dividing the file into multiple data blocks according to the data block sizes of all computing nodes and allocating the data blocks to the computing nodes; Filter out data blocks of each file whose actual data volume is smaller than the minimum value, group the filtered data blocks, and determine computing nodes corresponding to the data blocks in the group based on the data block grouping; At least one data analysis container is created on the computing node according to the data slicing and grouping conditions of the computing node, and a data analysis program is run in the container.

2. The method according to claim 1, characterized in that The data block size of each computing node is obtained based on the performance of the computing nodes in the cluster, specifically: The score of the computing node is calculated based on the CPU processing performance, memory read and write speed and size, and disk IO performance, and the data block size is determined according to the score.

3. The method according to claim 1, characterized in that The filtered data blocks are grouped as follows: Sort the data blocks according to the actual data volume of the filtered data blocks to obtain a sorted queue; Starting from the first data block after sorting, select at least one data block from the remaining data blocks after sorting so that the sum of the actual data volume of all selected data blocks and the first data block is closest to the data slice of the computing node where the first data block is located, and use the computing node where the first data block is located as the computing node of the group where the first data block is located, delete the first data block and all selected data blocks from the sorting queue, and re-sort the data blocks according to the actual data volume in the data blocks to obtain a sorting queue; repeat the above process until the sorting queue is empty.

4. The method according to claim 3, characterized in that The step of creating at least one data analysis container on a computing node according to the data slicing and grouping of the computing node is as follows: For each computing node, calculate the sum of the number of data slices of the file in the computing node and the number of groups corresponding to the computing node; Create the MapTask container with the sum number.

5. The method according to claim 1, characterized in that The data analysis program is a Map phase program of a Hadoop task.

6. A power grid operation data analysis system based on big data, characterized in that: The system includes the following modules: A file segmentation module is used to obtain a power grid operation data file, obtain a data block size of each computing node and a minimum value of the data block size of all computing nodes based on the performance of the computing nodes in the cluster, and segment the file into multiple data blocks according to the data block size of all computing nodes and allocate the data blocks to the computing nodes; A node allocation module, used for screening out data blocks of each file whose actual data volume is less than the minimum value, grouping the screened data blocks, and determining computing nodes corresponding to the data blocks in the group based on the data block grouping; The execution module is used to create at least one data analysis container in the computing node according to the data slicing and grouping conditions of the computing node, and run the data analysis program in the container.

7. The system according to claim 6, characterized in that The data block size of each computing node is obtained based on the performance of the computing nodes in the cluster, specifically: The score of the computing node is calculated based on the CPU processing performance, memory read and write speed and size, and disk IO performance, and the data block size is determined according to the score.

8. The system according to claim 6, characterized in that The filtered data blocks are grouped as follows: Sort the data blocks according to the actual data volume of the filtered data blocks to obtain a sorted queue; Starting from the first data block after sorting, select at least one data block from the remaining data blocks after sorting so that the sum of the actual data volume of all selected data blocks and the first data block is closest to the data slice of the computing node where the first data block is located, and use the computing node where the first data block is located as the computing node of the group where the first data block is located, delete the first data block and all selected data blocks from the sorting queue, and re-sort the data blocks according to the actual data volume in the data blocks to obtain a sorting queue; repeat the above process until the sorting queue is empty.

9. The system according to claim 8, characterized in that The step of creating at least one data analysis container on a computing node according to the data slicing and grouping of the computing node is as follows: For each computing node, calculate the sum of the number of data slices of the file in the computing node and the number of groups corresponding to the computing node; Create the MapTask container with the sum number.

10. A computer storage device, wherein a computer program is stored on the storage device, characterized in that: When the computer program is executed by a processor, the computer program implements the method according to any one of claims 1 to 5.