Method, device, equipment and medium for performance optimization of mapping reduction framework
By using cgroup technology to achieve fully fair queue weight dynamic balancing and client write blocking in the mapping reduction framework, the problem of insufficient input/output resource isolation in the mapping reduction framework is solved, thereby improving resource utilization and task completion efficiency.
Patent Information
- Application Number
- CN202311265443.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2043-09-27
AI Technical Summary
The existing mapping specification framework cannot effectively isolate input and output device resources in resource management and task scheduling services, which leads to data skew when input and output resources are saturated, affecting performance.
By using cgroup technology, fully fair queue weight dynamic balancing and client write blocking are achieved, and disk I/O resources of mapping/reduction tasks are dynamically isolated to optimize resource utilization.
It improves resource utilization, avoids waste of input and output resources, ensures that tasks are completed nearly simultaneously in nodes, and solves the data skew problem caused by I/O bottlenecks under high concurrency.
Smart Images

Figure CN119718605B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for performance optimization of a mapping reduction framework. Background Technology
[0002] Mapping reduction frameworks are among the most mature big data computing frameworks currently available. Resource management and task scheduling services are commonly used for resource scheduling and isolation within mapping reduction frameworks. However, these services only support coarse-grained isolation of the CPU and memory, and cannot effectively isolate input / output devices. This leads to widespread data skew when input / output resources become saturated, inevitably resulting in resource contention and preemption. Summary of the Invention
[0003] This invention provides a performance optimization method, apparatus, device, and medium for a mapping / reduction framework. By using cgroup technology to achieve dynamic weight balancing of the fully fair queue and client write blocking, it enables dynamic isolation of disk input / output resources for mapping / reduction tasks, thereby improving resource utilization.
[0004] According to one aspect of the present invention, a performance optimization method for a mapping reduction framework is provided, comprising:
[0005] Balanced processing is performed based on pre-configured node parameters, and mapping / reduction tasks are executed concurrently based on the balanced processing results.
[0006] If the mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, the disk input / output resource weights of the process where the mapping / reduction task is being executed are dynamically balanced using a fully fair queue.
[0007] If the mapping / reduction task reaches the end of the reduction phase, the corresponding distributed file system client write blocking latency is calculated and executed for the process where the mapping / reduction task is being executed.
[0008] Optionally, before performing load balancing based on pre-configured node parameters and concurrently executing mapping / reduction tasks according to the load balancing results, the following steps are also included:
[0009] Set the block scheduling algorithm for disks in the compute node local directory parameters of the resource management and task scheduling services to a fully fair queue.
[0010] Configure the number of CPU cores for mapping and reduction tasks;
[0011] Configure the number of CPU cores that can be allocated to the compute nodes in the resource management and task scheduling services.
[0012] To achieve near-simultaneous completion of all mapping / reduction tasks using the above technical solution, it is necessary to pre-configure the relevant parameters for the device's input / output resource scheduling.
[0013] Optionally, the load balancing process based on pre-configured node parameters includes:
[0014] Based on pre-configured node parameters, perform mapping / reduction task balance detection;
[0015] If disk I / O resources are detected to be saturated while CPU resources are idle, the number of concurrent tasks on the node will be adjusted downwards.
[0016] If disk I / O resources are detected to be idle while CPU resources are saturated, the number of CPU cores for each task is increased.
[0017] If disk I / O resources are detected to be idle while CPU resources are also idle, the number of concurrent tasks on the node is increased.
[0018] By adopting the above technical solution, the pre-configured node parameters can be balanced and optimized according to the saturation of central processing unit resources and disk I / O resources, thereby further improving the overall performance.
[0019] Optionally, the dynamic balancing of disk input / output resource weights for the processes hosting the currently executing mapping / reduction tasks via a fully fair queue includes:
[0020] Read the process ID of the distributed file system data node process where the mapping / reduction task is currently being executed in this node;
[0021] The disk input / output resource weights of the distributed file system data node process corresponding to the process ID are initialized using a fully fair queue.
[0022] Start the listening service to obtain the execution progress of each of the currently executing mapping / reduction tasks, and calculate the average execution progress and total time.
[0023] According to the first formula, calculate and modify the disk input / output resource weights of the processes in which the currently executing mapping / reduction tasks reside.
[0024] By adopting the above technical solution, the disk input / output resource weights of the processes where the mapping / reduction tasks are executed to the end of the mapping phase or the end of the data shuffling and sorting phase are dynamically adjusted through the use of the Completely Fair Queued technique in cgroups. This improves resource utilization, avoids waste of input / output resources, enhances test performance, and ensures that all tasks in the same node occupy the same input / output resource weights.
[0025] Optionally, calculating and modifying the disk input / output resource weights of the processes where each of the currently executing mapping / reduction tasks resides according to the first formula includes:
[0026] Based on the execution progress of the ongoing mapping / reduction task, along with its corresponding average execution progress and total execution time, the first formula is used.
[0027] Math.max(L,Math.min(H,100 / Math.pow(2,d / (ma / t+1)))) calculates the disk input / output resource weights of the process where the mapping / reduction task is located;
[0028] Based on the process ID corresponding to the mapping / reduction task, determine the process in which the mapping / reduction task is located, and reassign the calculated disk input / output resource weights to the process;
[0029] In the first formula, L is the lower limit of weight, H is the upper limit of weight, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time.
[0030] By adopting the above technical solution, the first formula can adaptively adjust the disk input / output resource weights of the process in which the task is located in multiple dimensions such as time and task progress difference, optimize the use of input / output resources, and reduce data skew.
[0031] Optionally, the calculation and execution of the corresponding distributed file system client write blocking latency for the process where the mapping / reduction task is being executed includes:
[0032] Add a write blocking delay parameter to the write context method of the mapping specification framework;
[0033] By accessing the listening service, the execution progress of each of the currently executing mapping / reduction tasks, as well as the corresponding average execution progress and total time, can be obtained, along with the CPU load and disk I / O throughput of this node.
[0034] For a mapping / reduction task that is currently being executed, if the execution progress of the mapping / reduction task is greater than the average execution progress, and the input / output throughput of the disk corresponding to the mapping / reduction task reaches a first threshold, or the CPU load reaches a second threshold, then the distributed file system client write blocking latency is calculated according to the second formula and executed on the process where the mapping / reduction task is located.
[0035] By adopting the above technical solution, the input / output blocking latency of the process where the mapping / reduction task is executed to the end of the reduction phase is dynamically adjusted through cgroup technology, so as to improve the overall resource utilization, balance the task progress, improve test performance, and achieve that all tasks of the node are completed at almost the same time, avoiding the blocking of the overall progress due to the last task.
[0036] Optionally, the step of calculating the distributed file system client write blocking latency according to the second formula and executing it on the process where the mapping / reduction task resides includes:
[0037] Based on the execution progress of the currently executing mapping / reduction task and the corresponding average execution progress and total time, the second formula 100*d / (ma / t+1) is used to calculate the write blocking latency of the distributed file system client, and this is executed on the process where the mapping / reduction task is located.
[0038] In the second formula, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time spent.
[0039] By adopting the above technical solution, the second formula can adaptively adjust the write blocking latency of the distributed file system client based on the actual progress and overall time consumption of the task, so as to ensure that different mapping / reduction tasks can be completed in similar time periods and balance the overall resource utilization.
[0040] According to another aspect of the present invention, a performance optimization apparatus for a mapping reduction framework is provided, comprising:
[0041] The parameter balancing processing module is used to perform balancing processing based on pre-configured node parameters and concurrently execute mapping / reduction tasks according to the balancing processing results.
[0042] The weight adjustment module is used to dynamically balance the disk input / output resource weights of the process in which the mapping / reduction task is being executed through a fully fair queue if the mapping / reduction task has reached the end of the mapping phase or the end of the data shuffling and sorting phase.
[0043] The dynamic delay module is used to calculate and execute the corresponding distributed file system client write blocking delay for the process where the mapping / reduction task is being executed if the mapping / reduction task reaches the end of the reduction phase.
[0044] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0045] At least one processor; and
[0046] A memory communicatively connected to the at least one processor; wherein,
[0047] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the performance optimization method of the mapping reduction framework according to any embodiment of the present invention.
[0048] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the performance optimization method of the mapping reduction framework according to any embodiment of the present invention.
[0049] The technical solution of this invention performs load balancing based on pre-configured node parameters and concurrently executes mapping / reduction tasks according to the load balancing results. If the mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, the disk input / output resource weights of the process containing the currently executing mapping / reduction task are dynamically balanced using a fully fair queue. If the mapping / reduction task reaches the end of the reduction phase, the corresponding distributed file system client write blocking latency is calculated and executed for the process containing the currently executing mapping / reduction task. This solves the data skew problem caused by I / O bottlenecks under high concurrency. By using cgroup technology to achieve dynamic load balancing of fully fair queue weights and dynamic client write blocking, the disk input / output resources of the mapping / reduction task are dynamically isolated, improving resource utilization.
[0050] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is a flowchart of a performance optimization method for a mapping reduction framework provided in Embodiment 1 of the present invention;
[0053] Figure 2 This is a flowchart of a performance optimization method for another mapping reduction framework provided in Embodiment 2 of the present invention;
[0054] Figure 3This is a schematic diagram of a performance optimization device for a mapping reduction framework provided in Embodiment 3 of the present invention;
[0055] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the performance optimization method of the mapping reduction framework of the present invention. Detailed Implementation
[0056] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0057] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0058] Example 1
[0059] Figure 1 This is a flowchart of a performance optimization method for a mapping / reduction framework according to Embodiment 1 of the present invention. This embodiment is applicable to situations where cgroup technology is used to dynamically isolate disk input / output for mapping / reduction tasks in nodes. This method can be executed by a performance optimization device for the mapping / reduction framework, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0060] S110. Perform load balancing based on pre-configured node parameters, and concurrently execute mapping / reduction tasks according to the load balancing results.
[0061] The mapping and reduction framework in this embodiment refers to the MapReduce framework of Hadoop 2 and above based on YARN resource management and task scheduling services. Node parameters refer to parameters related to resource allocation and task scheduling. In this embodiment, in order to achieve near-simultaneous completion of all mapping tasks (i.e., Map tasks) / reduction tasks (i.e., Reduce tasks), it is necessary to pre-configure the relevant parameters for device input / output resource scheduling. Then, based on the utilization saturation of the node's CPU resources and disk input / output resources, the configured parameters are balanced and optimized. Based on the node task concurrency and the number of CPU cores for each task determined after the balancing process, mapping / reduction tasks are executed concurrently.
[0062] In one optional implementation, before performing load balancing based on pre-configured node parameters and concurrently executing mapping / reduction tasks according to the load balancing results, the method further includes: setting the block scheduling algorithm for the disk related to the local directory parameters of the computing nodes in the resource management and task scheduling service to a fully fair queue; configuring the number of CPU cores for the mapping and reduction tasks; and configuring the number of CPU cores that the computing nodes in the resource management and task scheduling service can allocate.
[0063] In this embodiment, the compute node local directory parameter `yarn.nodemanager.local-dirs` in the resource management and task scheduling service specifies the local directory used to store container logs and other data within the compute node service (i.e., the NodeManager in YARN). By setting the disk block scheduling algorithm related to the compute node local directory parameter in the resource management and task scheduling service to Completely Fair Queues (CFLQ), the CFLQ technology in cgroups can be used to dynamically limit disk I / O resources. The parameters `mapreduce.map` and `reduce.cpu.vcores` specify the number of virtual CPU cores required for the mapping and reduction tasks, respectively. To better verify the effectiveness of this embodiment and the relevant scenarios, this parameter can be set to 1. The parameter `yarn.nodemanager.resource.cpu-vcores` sets the number of allocable logical CPU cores for the compute node service in the resource management and task scheduling service. For example, this parameter can be set to 32 logical cores. These parameters play a crucial role in the configuration of Hadoop and the resource management and task scheduling service, directly impacting resource allocation, task scheduling, and overall cluster performance.
[0064] S120. If the mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, the disk input / output resource weights of the process where the mapping / reduction task is being executed are dynamically balanced using a fully fair queue.
[0065] In this embodiment, performance bottlenecks caused by disk I / O imbalance are typically concentrated at the end of the mapping phase, the end of the data shuffling and sorting phase, and the end of the reduction phase. To dynamically limit the device's input / output resources and avoid wasting them, when the mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, a listening service can be activated to monitor the task's execution progress. A fully fair queue can then be used to dynamically balance the disk I / O resource weights of the processes running the mapping / reduction task, ensuring that each task on the same node occupies the same weight of input / output resources.
[0066] Optionally, the disk input / output resource weights of the processes hosting the currently executing mapping / reduction tasks are dynamically balanced using a fully fair queue. This includes: reading the process ID of the distributed file system data node process hosting the currently executing mapping / reduction task in this node; initializing the disk input / output resource weights of the distributed file system data node process corresponding to the process ID using a fully fair queue; starting a listening service to obtain the execution progress of each currently executing mapping / reduction task, and calculating the average execution progress and total time; and calculating and modifying the disk input / output resource weights of each currently executing mapping / reduction task process according to the first formula.
[0067] In this embodiment, when the resource management and task scheduling service computing node is running on this node, if the mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, an independent service process can be started to calculate and dynamically modify the disk input / output resource weights corresponding to the mapping / reduction task. Specifically, the process ID of the distributed file system data node (i.e., HDFSDataNode) process where the mapping / reduction task is currently executing on this node can be read, along with the CPU load and disk input / output throughput of this node. Then, for the distributed file system data node process corresponding to each process ID, the disk input / output resource weight value of the process is increased to a value much greater than the default weight using Completely Fair Queuing (CQL). For example, if the default weight value is 100, the disk input / output resource weight value of the process can be increased to 1000 to prioritize replica copying and avoid computational imbalance during dynamic tuning. Listening is started, and the execution progress of each currently executing mapping / reduction task is monitored every three seconds. The execution progress can be expressed as a percentage. The average execution progress and total time of all currently executing tasks on this node are calculated. According to the pre-designed first formula, the disk input / output resource weights of the processes where each currently executing mapping / reduction task resides are calculated in a coarse-grained manner, and corresponding weight adjustments are made. The first formula dynamically adjusts the weights based on the difference between the task's execution progress and the average execution progress.
[0068] By adopting the above technical solution, the disk input / output resource weights of the processes where the mapping / reduction tasks are executed to the end of the mapping phase or the end of the data shuffling and sorting phase are dynamically adjusted through the use of the Completely Fair Queued technique in cgroups. This improves resource utilization, avoids waste of input / output resources, enhances test performance, and ensures that all tasks in the same node occupy the same input / output resource weights.
[0069] S130. If the mapping / reduction task reaches the end of the reduction phase, calculate and execute the corresponding distributed file system client write blocking latency for the process where the mapping / reduction task is being executed.
[0070] In this embodiment, in order to balance the execution progress of each task, when the mapping / reduction task reaches the end of the reduction phase, the write blocking latency of the distributed file system client can be calculated for the process where the mapping / reduction task is being executed, and the cgroup control process can be used to suspend and resume the write operation after the control process is suspended for the corresponding time.
[0071] Optionally, for the process where the currently executing mapping / reduction task resides, calculate and execute the corresponding distributed file system client write blocking latency, including: adding a write blocking latency parameter to the write context method of the mapping / reduction framework; obtaining the execution progress of each currently executing mapping / reduction task, as well as the corresponding average execution progress and total time, and obtaining the CPU load and disk I / O throughput of this node by accessing the listening service; for the currently executing mapping / reduction task, if the execution progress of the mapping / reduction task is greater than the average execution progress, and the disk I / O throughput corresponding to the mapping / reduction task reaches a first threshold, or the CPU load reaches a second threshold, then calculate the distributed file system client write blocking latency according to the second formula and execute it on the process where the mapping / reduction task resides.
[0072] In this embodiment, the writing of mapping / reduction tasks relies on the Hadoop Distributed File System (Hadoop Distributed File System). Therefore, a write blocking latency parameter needs to be added to the write context method (i.e., the `context.write` method) of the mapping / reduction framework to ensure balanced task execution. After modifying the mapping / reduction framework, before writing to the `DFSOutputStream` in the native write context method, the execution progress of each currently executing mapping / reduction task, the average execution progress `ma` of all tasks, the total execution time `t`, the difference `d` between the execution progress of each mapping / reduction task and the average execution progress `ma`, as well as the CPU load and disk I / O throughput of the local node are obtained by accessing the listening service. Then, for each currently executing mapping / reduction task, if the execution progress of the task is greater than the average execution progress, and the disk I / O throughput of the task reaches a first threshold (e.g., 99%), or the CPU load reaches a second threshold (e.g., 100%), the write blocking latency of the distributed file system client is coarsely calculated according to the second formula. Based on cgroup technology, the process where the mapping / reduction task is located is suspended for a corresponding time before continuing the write operation.
[0073] By adopting the above technical solution, the input / output blocking latency of the process where the mapping / reduction task is executed to the end of the reduction phase is dynamically adjusted through cgroup technology, so as to improve the overall resource utilization, balance the task progress, improve test performance, and achieve that all tasks of the node are completed at almost the same time, avoiding the blocking of the overall progress due to the last task.
[0074] The technical solution of this invention performs load balancing based on pre-configured node parameters and concurrently executes mapping / reduction tasks according to the load balancing results. If a mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, a fully fair queue is used to dynamically balance the disk input / output resource weights of the process where the currently executing mapping / reduction task is located. If a mapping / reduction task reaches the end of the reduction phase, the corresponding distributed file system client write blocking latency is calculated and executed for the process where the currently executing mapping / reduction task is located. This solves the data skew problem caused by I / O bottlenecks under high concurrency. By using cgroup technology to achieve dynamic load balancing of fully fair queue weights and dynamic client write blocking, the disk input / output resources of the mapping / reduction task are dynamically isolated, improving resource utilization.
[0075] Example 2
[0076] Figure 2 This is a flowchart of a performance optimization method for another mapping reduction framework provided by Embodiment 2 of the present invention. Based on the above embodiments, this embodiment further provides specific steps for parameter-based equalization processing, as well as a detailed explanation of the first and second formulas. Figure 2 As shown, the method includes:
[0077] S210. Configure node parameters in advance, perform load balancing based on the pre-configured node parameters, and concurrently execute mapping / reduction tasks according to the load balancing results.
[0078] In this embodiment, to enable all mapping / reduction tasks to complete nearly simultaneously, it is necessary to pre-configure relevant parameters for the device's input / output resource scheduling. For example, this includes configuring the number of CPU cores for each mapping / reduction task and the number of CPU cores available for each computing node in the resource management and task scheduling services. Then, by performing balanced optimization on the configured parameters, the final node task concurrency and the number of CPU cores per task are determined, and mapping / reduction tasks are executed concurrently based on these parameters.
[0079] In one optional implementation, load balancing is performed based on pre-configured node parameters, including: performing mapping / reduction task load balancing detection based on pre-configured node parameters; if disk I / O resources are detected to be saturated while CPU resources are idle, the number of concurrent tasks on the node is adjusted downwards; if disk I / O resources are detected to be idle while CPU resources are saturated, the number of CPU cores per task is adjusted upwards; if disk I / O resources are detected to be idle while CPU resources are idle, the number of concurrent tasks on the node is adjusted upwards.
[0080] By adopting the above technical solution, pre-configured node parameters can be balanced and optimized based on the utilization saturation of CPU and disk I / O resources, thereby further improving overall performance. Specifically, when disk I / O resources are idle while CPU resources are saturated, increasing the number of CPU cores per task actually reduces the number of concurrently running tasks on the node, allowing each task to perform I / O operations faster.
[0081] S220. If the mapping / reduction task has reached the end of the mapping phase or the end of the data shuffling and sorting phase, then read the process ID of the distributed file system data node process where the mapping / reduction task is being executed in this node.
[0082] S230. Initialize the disk input / output resource weights of the distributed file system data node processes corresponding to the process IDs through a fully fair queue.
[0083] S240. Start the listening service to obtain the execution progress of each currently executing mapping / reduction task, and calculate the average execution progress and total time.
[0084] S250. Calculate and modify the disk input / output resource weights of the processes where each currently executing mapping / reduction task resides, according to the first formula.
[0085] In an optional implementation, the disk input / output resource weights of the processes where each currently executing mapping / reduction task resides are calculated and modified according to the first formula, including: calculating the disk input / output resource weights of the processes where the mapping / reduction tasks reside using the first formula Math.max(L,Math.min(H,100 / Math.pow(2,d / (ma / t+1)))) based on the execution progress of the currently executing mapping / reduction tasks and the corresponding average execution progress and total time consumption; determining the process where the mapping / reduction task resides based on the process ID corresponding to the mapping / reduction task, and reassigning the calculated disk input / output resource weights to the process; wherein, in the first formula, L is the lower limit of the weight, H is the upper limit of the weight, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time consumption.
[0086] In this embodiment, the first formula uses an exponential function to dynamically adjust the disk input / output resource weights of the process based on the difference between the task execution progress and the average execution progress, thereby improving input / output resource utilization and reducing data skew. For the first formula, `Math.max(L,...)` sets a lower limit of weight at `L` to ensure the weight is not too low. `Math.min(H....)` sets an upper limit of weight at `H` to ensure the weight is not too high. The part `100 / Math.pow(2,d / (ma / t+1))` uses an exponential descent function to adjust the weight based on the value of `d / (ma / t+1)`, more precisely reflecting the difference between the task execution progress and the average execution progress. If `d` is close to `ma`, meaning the task execution progress is close to the average execution progress, the weight will approach its maximum value `H`.
[0087] By employing the above technical solution, the first formula can adaptively adjust the disk input / output resource weights of the process in which the task resides across multiple dimensions, such as time and task progress difference, rather than relying solely on a single metric. Furthermore, by setting maximum and minimum weight values, it ensures that the weights do not become unreasonable even in extreme cases.
[0088] S260. Add a write blocking delay parameter to the write context method of the mapping specification framework.
[0089] The timing for adding a write blocking delay parameter in the write context method of the mapping / reduction framework is usually before the mapping / reduction task is executed, or after the mapping / reduction task is executed, but before the end of the reduction phase has been reached.
[0090] S270. If the mapping / reduction task reaches the end of the reduction phase, the execution progress of each currently executing mapping / reduction task, as well as the corresponding average execution progress and total time, are obtained by accessing the listening service. The CPU load and disk I / O throughput of this node are also obtained.
[0091] S280. For a mapping / reduction task that is currently being executed, if the execution progress of the mapping / reduction task is greater than the average execution progress, and the input / output throughput of the disk corresponding to the mapping / reduction task reaches the first threshold, or the CPU load reaches the second threshold, then calculate the distributed file system client write blocking latency according to the second formula and execute it on the process where the mapping / reduction task is located.
[0092] In one optional implementation, calculating the distributed file system client write blocking latency according to the second formula and executing it on the process where the mapping / reduction task resides includes: calculating the distributed file system client write blocking latency using the second formula 100*d / (ma / t+1) based on the execution progress of the currently executing mapping / reduction task and the corresponding average execution progress and total time, and executing it on the process where the mapping / reduction task resides; wherein, in the second formula, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time.
[0093] In this embodiment, the second formula calculates the delay using d / (ma / t+1). This ensures that if the current task's execution progress is greater than the average execution progress ma, and disk I / O resources or CPU resources are close to saturation, the task will be appropriately delayed. Furthermore, the higher the task's execution progress, the greater the delay time will be, thus achieving a balancing effect.
[0094] By adopting the above technical solution, the second formula can adaptively adjust the write blocking latency of the distributed file system client based on the actual progress and overall time consumption of the task, so as to ensure that different mapping / reduction tasks can be completed in similar time periods and balance the overall resource utilization.
[0095] The technical solution of this invention performs load balancing based on pre-configured node parameters and concurrently executes mapping / reduction tasks according to the load balancing results. If a mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, a fully fair queue is used to dynamically balance the disk input / output resource weights of the process where the currently executing mapping / reduction task is located. If a mapping / reduction task reaches the end of the reduction phase, the corresponding distributed file system client write blocking latency is calculated and executed for the process where the currently executing mapping / reduction task is located. This solves the data skew problem caused by I / O bottlenecks under high concurrency. By using cgroup technology to achieve dynamic load balancing of fully fair queue weights and dynamic client write blocking, the disk input / output resources of the mapping / reduction task are dynamically isolated, improving resource utilization.
[0096] Example 3
[0097] Figure 3 This is a schematic diagram of a performance optimization device for a mapping reduction framework provided according to Embodiment 3 of the present invention. Figure 3 As shown, the device includes:
[0098] The parameter balancing processing module 310 is used to perform balancing processing based on pre-configured node parameters and concurrently execute mapping / reduction tasks according to the balancing processing results.
[0099] The weight adjustment module 320 is used to dynamically balance the disk input / output resource weights of the process in which the mapping / reduction task is being executed through a fully fair queue if the mapping / reduction task has reached the end of the mapping phase or the end of the data shuffling and sorting phase.
[0100] The dynamic delay module 330 is used to calculate and execute the corresponding distributed file system client write blocking delay for the process where the mapping / reduction task is being executed if the mapping / reduction task has reached the end of the reduction phase.
[0101] The technical solution of this invention performs load balancing based on pre-configured node parameters and concurrently executes mapping / reduction tasks according to the load balancing results. If a mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, a fully fair queue is used to dynamically balance the disk input / output resource weights of the process where the currently executing mapping / reduction task is located. If a mapping / reduction task reaches the end of the reduction phase, the corresponding distributed file system client write blocking latency is calculated and executed for the process where the currently executing mapping / reduction task is located. This solves the data skew problem caused by I / O bottlenecks under high concurrency. By using cgroup technology to achieve dynamic load balancing of fully fair queue weights and dynamic client write blocking, the disk input / output resources of the mapping / reduction task are dynamically isolated, improving resource utilization.
[0102] Optionally, it also includes: a parameter configuration module, used before performing load balancing based on pre-configured node parameters and concurrently executing mapping / reduction tasks according to the load balancing results.
[0103] Set the block scheduling algorithm for disks in the compute node local directory parameters of the resource management and task scheduling services to a fully fair queue;
[0104] Configure the number of CPU cores for mapping and reduction tasks;
[0105] Configure the number of CPU cores that can be allocated to the compute nodes in the resource management and task scheduling services.
[0106] Optionally, the parameter equalization processing module 310 is used for:
[0107] Based on pre-configured node parameters, perform mapping / reduction task balance detection;
[0108] If disk I / O resources are detected to be saturated while CPU resources are idle, the number of concurrent tasks on the node will be adjusted downwards.
[0109] If disk I / O resources are detected to be idle while CPU resources are saturated, the number of CPU cores for each task is increased.
[0110] If disk I / O resources are detected to be idle while CPU resources are also idle, the number of concurrent tasks on the node is increased.
[0111] Optional, the weight adjustment module 320 is used for:
[0112] Read the process ID of the distributed file system data node process where the mapping / reduction task is currently being executed in this node;
[0113] The disk input / output resource weights of the distributed file system data node processes corresponding to the process IDs are initialized using a fully fair queue.
[0114] Start the listening service to obtain the execution progress of each currently executing mapping / reduction task, and calculate the average execution progress and total time.
[0115] Based on the first formula, calculate and modify the disk I / O resource weights of the processes where each currently executing mapping / reduction task resides.
[0116] Optional, the weight adjustment module 320 is used for:
[0117] Based on the execution progress of the currently executing mapping / reduction task and the corresponding average execution progress and total time, the disk input / output resource weight of the process where the mapping / reduction task is located is calculated using the first formula Math.max(L,Math.min(H,100 / Math.pow(2,d / (ma / t+1)))).
[0118] Based on the process ID corresponding to the mapping / reduction task, determine the process in which the mapping / reduction task is located, and reassign the calculated disk input / output resource weights to the process;
[0119] In the first formula, L is the lower limit of weight, H is the upper limit of weight, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time.
[0120] Optional, the dynamic delay module 330 is used for:
[0121] Add a write blocking delay parameter to the write context method of the mapping specification framework;
[0122] By accessing the listening service, the execution progress of each currently executing mapping / reduction task, as well as the corresponding average execution progress and total time, can be obtained, along with the CPU load and disk I / O throughput of this node.
[0123] For a mapping / reduction task that is currently being executed, if the execution progress of the mapping / reduction task is greater than the average execution progress, and the input / output throughput of the disk corresponding to the mapping / reduction task reaches the first threshold, or the CPU load reaches the second threshold, then the distributed file system client write blocking latency is calculated according to the second formula and executed on the process where the mapping / reduction task is located.
[0124] Optional, the dynamic delay module 330 is used for:
[0125] Based on the execution progress of the currently executing mapping / reduction task and the corresponding average execution progress and total time, the second formula 100*d / (ma / t+1) is used to calculate the write blocking latency of the distributed file system client and execute it on the process where the mapping / reduction task is located.
[0126] In the second formula, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time spent.
[0127] The performance optimization apparatus for the mapping reduction framework provided in the embodiments of the present invention can execute the performance optimization method for the mapping reduction framework provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0128] Example 4
[0129] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0130] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0131] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0132] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as performance optimization methods for the mapping reduction framework.
[0133] In some embodiments, the performance optimization method for the mapping reduction framework can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the performance optimization method for the mapping reduction framework described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the performance optimization method for the mapping reduction framework by any other suitable means (e.g., by means of firmware).
[0134] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0135] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0136] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0137] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0138] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0139] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0140] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0141] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A performance optimization method for a mapping reduction framework, characterized in that, include: Balanced processing is performed based on pre-configured node parameters, and mapping / reduction tasks are executed concurrently based on the balanced processing results. If the mapping / reduction task reaches the end of the mapping phase or the end of the data shuffling and sorting phase, the disk input / output resource weights of the process where the mapping / reduction task is being executed are dynamically balanced using a fully fair queue. If the mapping / reduction task reaches the end of the reduction phase, the corresponding distributed file system client write blocking latency is calculated and executed for the process where the mapping / reduction task is being executed. The dynamic balancing of disk input / output resource weights for the process hosting the currently executing mapping / reduction task using a fully fair queue includes: Read the process ID of the distributed file system data node process where the mapping / reduction task is currently being executed in this node; The disk input / output resource weights of the distributed file system data node process corresponding to the process ID are initialized using a fully fair queue. Start the listening service to obtain the execution progress of each of the currently executing mapping / reduction tasks, and calculate the average execution progress and total time. Based on the execution progress of the currently executing mapping / reduction task and the corresponding average execution progress and total time, the disk input / output resource weight of the process where the mapping / reduction task is located is calculated using the first formula Math.max(L,Math.min(H,100 / Math.pow(2,d / (ma / t+1)))). Based on the process ID corresponding to the mapping / reduction task, determine the process in which the mapping / reduction task is located, and reassign the calculated disk input / output resource weights to the process; In the first formula, L is the lower limit of weight, H is the upper limit of weight, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time.
2. The method according to claim 1, characterized in that, Before performing load balancing based on pre-configured node parameters and concurrently executing mapping / reduction tasks according to the load balancing results, the following steps are also included: Set the block scheduling algorithm for disks in the compute node local directory parameters of the resource management and task scheduling services to a fully fair queue; Configure the number of CPU cores for mapping and reduction tasks; Configure the number of CPU cores that can be allocated to the compute nodes in the resource management and task scheduling services.
3. The method according to claim 2, characterized in that, The load balancing process based on pre-configured node parameters includes: Based on pre-configured node parameters, perform mapping / reduction task balance detection; If disk I / O resources are detected to be saturated while CPU resources are idle, the number of concurrent tasks on the node will be adjusted downwards. If disk I / O resources are detected to be idle while CPU resources are saturated, the number of CPU cores for each task is increased. If disk I / O resources are detected to be idle while CPU resources are also idle, the number of concurrent tasks on the node is increased.
4. The method according to claim 1, characterized in that, The calculation and execution of the corresponding distributed file system client write blocking latency for the process where the mapping / reduction task is currently being executed includes: Add a write blocking delay parameter to the write context method of the mapping specification framework; By accessing the listening service, the execution progress of each of the currently executing mapping / reduction tasks, as well as the corresponding average execution progress and total time, can be obtained, along with the CPU load and disk I / O throughput of this node. For a mapping / reduction task that is currently being executed, if the execution progress of the mapping / reduction task is greater than the average execution progress, and the input / output throughput of the disk corresponding to the mapping / reduction task reaches a first threshold, or the CPU load reaches a second threshold, then the distributed file system client write blocking latency is calculated according to the second formula and executed on the process where the mapping / reduction task is located.
5. The method according to claim 4, characterized in that, The step of calculating the distributed file system client write blocking latency according to the second formula and executing it on the process where the mapping / reduction task resides includes: Based on the execution progress of the currently executing mapping / reduction task and the corresponding average execution progress and total time, the second formula 100*d / (ma / t+1) is used to calculate the write blocking latency of the distributed file system client, and this is executed on the process where the mapping / reduction task is located. In the second formula, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time spent.
6. A performance optimization device for a mapping reduction framework, characterized in that, include: The parameter balancing processing module is used to perform balancing processing based on pre-configured node parameters and concurrently execute mapping / reduction tasks according to the balancing processing results. The weight adjustment module is used to dynamically balance the disk input / output resource weights of the process in which the mapping / reduction task is being executed through a fully fair queue if the mapping / reduction task has reached the end of the mapping phase or the end of the data shuffling and sorting phase. The dynamic delay module is used to calculate and execute the corresponding distributed file system client write blocking delay for the process where the mapping / reduction task is being executed if the mapping / reduction task reaches the end of the reduction phase. The weight adjustment module is used for: Read the process ID of the distributed file system data node process where the mapping / reduction task is currently being executed in this node; The disk input / output resource weights of the distributed file system data node process corresponding to the process ID are initialized using a fully fair queue. Start the listening service to obtain the execution progress of each of the currently executing mapping / reduction tasks, and calculate the average execution progress and total time. Based on the execution progress of the currently executing mapping / reduction task and the corresponding average execution progress and total time, the disk input / output resource weight of the process where the mapping / reduction task is located is calculated using the first formula Math.max(L,Math.min(H,100 / Math.pow(2,d / (ma / t+1)))). Based on the process ID corresponding to the mapping / reduction task, determine the process in which the mapping / reduction task is located, and reassign the calculated disk input / output resource weights to the process; In the first formula, L is the lower limit of weight, H is the upper limit of weight, d is the difference between the execution progress of the mapping / reduction task and the average execution progress ma, and t is the total time.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the performance optimization method of the mapping reduction framework according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the performance optimization method of the mapping reduction framework as described in any one of claims 1-5.
Citation Information
Patent Citations
Distributed parallel database resource management method
CN110119405A
Hadoop task scheduling method and device
CN110618865A
