Patent Publication Number: US-9405592-B2

Title: Workload balancing to handle skews for big data analytics

Description:
BACKGROUND 
     After over two-decades of electronic data automation and the improved ability for capturing data from a variety of communication channels and media, even small enterprises find that the enterprise is processing terabytes of data with regularity. Moreover, mining, analysis, and processing of that data have become extremely complex. The average consumer expects electronic transactions to occur flawlessly and with near instant speed. The enterprise that cannot meet expectations of the consumer is quickly out of business in today&#39;s highly competitive environment. 
     Updating, mining, analyzing, reporting, and accessing the enterprise information can still become problematic because of the sheer volume of this information and because often the information is dispersed over a variety of different file systems, databases, and applications. 
     In response, the industry has recently embraced a data platform referred to as Apache Hadoop™ (Hadoop™). Hadoop™ is an Open Source software architecture that supports data-intensive distributed applications. It enables applications to work with thousands of network nodes and petabytes (1000 terabytes) of data. Hadoop™ provides interoperability between disparate file systems, fault tolerance, and High Availability (HA) for data processing. The architecture is modular and expandable with the whole database development community supporting, enhancing, and dynamically growing the platform. 
     The big data analysis on Hadoop™ Distributed File System (DFS) is usually divided into a number of worker tasks, which are executed in a distributed fashion on the nodes of the cluster. 
     These worker tasks in Hadoop™ MapReduce™ are executing map and reduce tasks. There are typically a large number of worker tasks, far more than the cluster can execute parallel. In a typical MapReduce™ workload the number of map tasks may be orders of magnitude larger than the number of nodes, and while the number of reduce tasks is usually lower, it will still usually be equal to the number of nodes or a small multiple of that. Each worker task is responsible for processing a part of the job&#39;s data. Map tasks process a part of the input split into data portions, and reduce tasks process a partition of the intermediate data. 
     If worker tasks do not take the same amount of time to execute as remaining tasks, this is called a skewed scenario. 
     There are number of reasons why skew can occur between worker tasks. Data skew means that not all tasks process the same amount of data. Those tasks that process more input data will likely take longer to execute. Data skew can occur due to the properties of the input data, but also for example, due to a poor choice and use of partitioning functions. Processing skew occurs when not all records in the data take the same amount of time to process. So, even if the tasks process the same amount of data and records, there can still be a large discrepancy in their execution times. This may occur due to the computing resources in the cluster, which are actually heterogeneous, with some nodes having faster processors, more network bandwidth, more memory, or faster disks than others. These nodes will be able to process data faster than the others, and run the same tasks faster. 
     The end result of these factors is that there can be a large variation between the execution time of the worker tasks. When this occurs, some worker tasks may hold up the execution time of the entire job, either because other worker tasks cannot proceed until they are finished or because they are simply the last worker task in a job. 
     The applications experience performance degradation due to skews on Hadoop™ DFS. The resources are not fully utilized and performances of big data analytics become delayed. This will impact data warehouse system performance for unified data architectures as other systems tasks become delayed due to delay of data synchronization from Hadoop™ to other systems. 
     SUMMARY 
     In various embodiments, methods and a system for workload balancing to handle skews for big data analytics are provided. According to an embodiment, a method for workload balancing to handle skews for big data analytics is provided. 
     Specifically, a partition total for partitions of data are identified and each partition is assigned to one of a plurality of reducers based on a cost analysis for a cost associated with that reducer processing a proposed assignment of that partition in view of existing partitions already assigned to that reducer. Moreover, at least one partition remains unassigned to any of the reducers. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  is a diagram of a method for handling data and processing skews using static and dynamic partition assignments, according to an example embodiment. 
         FIGS. 2A-2D  are diagrams depicting sample scenarios for partition assignments to two tasks, according to an example embodiment. 
         FIG. 3  is a diagram of another method for workload balancing to handle skews for big data analytics, according to an example embodiment. 
         FIG. 4  is a diagram of still another method for workload balancing to handle skews for handle big data analytics, according to an example embodiment. 
         FIG. 5  is a diagram of a skew handling system, according to an example embodiment. 
     
    
    
     DETAILED DESCRIPTION 
     The methods and system herein combine different techniques of static and dynamic partitioning to deal with this data and processing skews in map reduce applications. The static partitioning is enhanced with a parallel cost-based hashing technique to reduce the data skews and dynamic partitioning is enhanced for allocation of processors to operations in order to reduce task start-up time and improve task load balancing. 
     Conventionally, a map phase may reduce systems generate (key, value) pairs from the input data. A cluster is the subset of all (key, value) pairs, sharing the same key. Standard systems, such as Hadoop™ and others, use hashing to distribute the clusters to the reducers. Each reducer gets approximately the same number of clusters. For skewed data, this approach is not good enough since clusters may vary considerably in size. With nonlinear reducers, the problem is even worse. The nonlinear reduce function is evaluated for each cluster and even sets of clusters with the same overall number of tuples can have very different execution times. Processing a small number of large clusters takes much longer than processing many small clusters. 
     The methods and system provided herein teach a cost-based model addition to existing static partitioning that takes into account non-linear reducer functions and skewed data distributions. Instead of considering only the size of the data partition (set of clusters) that is assigned to each reducer, an estimate of execution cost for the data partition is also considered. 
     The input data that requires processing is split into a fixed number of partitions. The number of partitions selected is larger than the number of reducers and the goal is to distribute the partitions, such that the execution times for all reducers are similar. 
     With MapReduce™ functions during the map phase the framework splits input data set into a number of partitions and assigns each partition to a map task. The framework also distributes the many map tasks across the cluster of nodes on which it operates. Each map task consumes key/value pairs from its assigned partition and produces a set of intermediate key/value pairs. 
     Following the map phase the framework sorts the intermediate data set by key and produces a set of key/value tuples so that all the values associated with a particular key appear together. Conventionally, but unlike what is proposed herein, it also partitions the set of tuples into a number of partitions equal to the number of reduce tasks. 
     In the reduce phase, each reduce task consumes the fragment of the tuples assigned to it. For each such tuple, each reduce task invokes a user-defined reduce function that transmutes the tuple into an output key/value pair (K,V). Once again, the framework distributes the many reduce tasks across the cluster of nodes and deals with shipping the appropriate fragment of intermediate data to each reduce task. 
     It is within this context that various embodiments of the invention are now discussed with reference to the  FIGS. 1-5 . 
       FIG. 1  is a diagram of a method for handling data and processing skews using static and dynamic partition assignments, according to an example embodiment. The method is implemented as executable instructions within a non-transitory computer-readable storage medium that execute on one or more processors, the processors specifically configured to execute the method. Moreover, the executable instructions are programmed within a non-transitory computer-readable storage medium and/or memory. The method is also operational over a network; the network is wired, wireless, or a combination of wired and wireless. 
     The method creates more partitions than there are reducers in a map reduce system. This provides a high degree of freedom for balancing the workload on the reducers to deal with skew conditions. The method chooses q&gt;s, in contrast to current map reduce systems where q=s. The range of q is obviously bounded by the number of reducer s, on the lower end, and the number of clusters, |K|, on the upper end. With q&lt;s, some reducers would not obtain any input will be moved to an unassigned pool. With q&gt;|K|, some partitions will remain empty. 
     The number of partitions, q, influences the quality of the obtained load balancing. The higher q, the more possibilities the controller has to balance the load. To avoid excessive management, overhead grows with q, so more monitoring data is collected and processed. The method picks the most expensive partition, which is not yet assigned to a reducer and assigns it to the reducer, which has smallest total load. 
     The load of a reducer is the sum of the costs for all partitions assigned to that reducer. We repeat these steps until all partitions have been assigned either to a reducer task or to an unassigned pool. 
     
       
         
           
               
               
             
               
                   
                   
               
             
            
               
                   
                 Input: W: {1, 2, 3 . . , q} 
               
               
                   
                 Output: R: a set of partition bundles 
               
               
                   
                 Unassigned Pool: UP 
               
               
                   
                 R=0 
               
               
                   
                 P = {1, 2, 3 . . , q} 
               
               
                   
                 While P &lt;&gt; 0 do 
               
               
                   
                 P ← P \ {q} 
               
               
                   
                  If |R| &lt; s then 
               
               
                   
                  R ← RU {{q}} 
               
               
                   
                  Else If |R| &gt;= s then 
               
               
                   
                  UP ← P \ {q} 
               
               
                   
                 End while 
               
               
                   
                 Return R 
               
               
                   
                   
               
            
           
         
       
     
     Once partitions are assigned to reducer tasks and to the unassigned pool, the reducer tasks are in control (dynamic partitioning) to reassign partitions to other reducers, to acquire another partition from the unassigned pool, and/or to reassign partitions back to the unassigned pool. 
       FIGS. 2A-2D  are diagrams depicting sample scenarios for partition assignments to two tasks using static and dynamic partitioning, according to an example embodiment. These diagrams are presented for purposes of illustration and comprehension of the methods and system discussed herein. As it is to be understood that there can be q partitions and s reducers (the two reducers are identified as “Reduce Worker Task  1  and  2  in the  FIGS. 2A-2D . 
     The dynamic partition works by having a pool of unassigned partitions from which tasks select partitions. Tasks are assigned partitions from the unassigned pool or when the unassigned pool is depleted a task can be assigned partitions from other tasks to work on. 
       FIG. 2A  depicts partitions  1 - 10 , partitions  1 - 4  are assigned to Reducer Worker Task  1 , partitions  5 - 8  are assigned to Reducer Worker task  2 , and partitions  9 - 10  are as of yet unassigned in the example scenario and are in an Unassigned Partitions Pool. 
     The initial assignments are achieved using the technique discussed above with the  FIG. 1 ; a cost-based static partitioning assignment with partitions  9 - 10  left for dynamic assignment. 
       FIG. 2B  depicts assignment of partition  9  from the Unassigned Partitions Pool to Reduce Worker Task  1 , in the example scenario. Reduce Worker Task  1  makes the decision to dynamically acquire partition  9 . 
       FIG. 2C  depicts assignment of partition  10  from the Unassigned Partitions Pool to Reduce Worker Task  2 , in the example scenario. Reduce Worker Task  1  makes the decision to dynamically acquire partition  10 . 
       FIG. 2D  depicts a task-to-task assignment of partitions  9  and  10  from Reduce Worker Task  1  to Reduce Worker Task  2 .  FIG. 2D  also depicts tasks reassignments of partitions  1 - 10  back to the Unassigned Partitions Pool. The Reduce Worker Tasks  1  and  2  make the decisions to transfer between one another and to reassign partitions back to the Unassigned Partition Pool. 
     As a result, the partitions are more uniformly assigned and reassigned based on cost-based static partitioning with load balancing, at run time, and using dynamic partitioning to achieve non-skewed distributions for purposes of finishing the jobs more quickly and efficiently. 
     Prior attempts to address data and processing skews have used specialized backup tasks or sampling approaches. Yet, such approaches only partially solve issues related to data and processing skewing. 
     The methods and systems discussed herein more completely address data and processing skews than prior attempts have. Both the data skew and the processing skew are solved by using a cost-based static partitioning assignment to tasks with unassigned partitions, which are dynamically addressed at run time by the tasks (the tasks choose to reassign to other tasks, select from the unassigned pool, and/or reassign back to the unassigned pool). 
       FIG. 3  is a diagram of another method  300  for workload balancing to handle skews for big data analytics, according to an example embodiment. The method  300  is implemented as executable instructions (one or more software modules referred to herein as “workload balancer”) within a non-transitory computer-readable storage medium that execute on one or more processors, the processors specifically configured to execute the workload balancer. Moreover, the workload balancer is programmed within a non-transitory computer-readable storage medium and/or memory. The workload balancer is also operational over a network; the network is wired, wireless, or a combination of wired and wireless. 
     The processing perspective of the workload balancer is from that which was discussed above where a cost-based static partitioning assignment is made to reducer tasks and to an unassigned pool from which the tasks can later select from. 
     Initially, a block of data is obtained for processing, such as from a distributed file system associated with processing data on behalf of one or more operations of distributed database management system or data warehouse. The block of data can be associated with processing query results, importing data, exporting data, and others. 
     At  310 , the workload balancer identifies a partition total for partitions of the block of data. The partition total is a total number of partitions that the block of data is split into. The reducers process different ones of the partitions. 
     According to an embodiment, at  311 , the workload balancer resolves or determines the partition total to be greater than a total number of reducers. This was discussed above with reference to the  FIG. 1 . 
     In an embodiment of  311  and at  312 , the workload balancer splits the block of data into each of the partitions; again, each of the partitions representing a different portion from the block of data. It is noted that each partition may or may not have the same amount of data (same size). 
     At  320 , the workload balancer assigns each partition to one of the reducers. This is done based on a cost estimate (analysis) for a cost associated with processing a particular partition that is being assigned. The cost analysis can include a variety of factors, such as the size of the partition that is being assigned, the complexity of the data for the partition, and the like. The assignment is also done based on the existing assigned partitions to the reducers. This ensures load balancing across the reducers based on cost estimates. 
     In an embodiment, at  321 , the workload balancer iterates the partitions (for a partition total number of times) to make the assignments of sets of the partitions to the reducers. 
     In an embodiment of  321  and at  322 , the workload balancer, during each iteration, selects a particular partition having a highest current cost relative to cost for all existing unassigned partitions and assigns that particular partition to a particular reducer having a lowest current processing load relative to all the available reducers. 
     In an embodiment of  322  and at  323 , the workload balancer resolves each reducer&#39;s current processing load (for this iteration) as a sum of the costs associated with processing that reducer&#39;s already assigned partitions. 
     At  330 , the workload balancer maintains at least one partition as being unassigned. This was discussed above with reference to the  FIGS. 1-2 . The partitions are assigned initially ( 320 ) in a load balanced fashion and at least one partition remains unassigned for dynamically allocation or acquisition by the reducers (discussed above with reference to the  FIGS. 1-2  and more below with reference to the  FIGS. 4-5 ). 
     According to an embodiment, at  340 , the workload balancer validates after assigning the assigned partitions to the reducers that each cost estimate for each reducer is within a range of remaining cost estimates for remaining reducers. This ensures that the assignments are sufficiently balanced across the reducers before dynamic adjustments are made during partition processing by each of the reducers (discussed below with reference to the  FIG. 4 ). 
       FIG. 4  is a diagram of still another method  400  for workload balancing to handle skews for handle big data analytics, according to an example embodiment. The method  400  is implemented as executable instructions (one or more software modules, hereinafter “reducer task”) within a non-transitory computer-readable storage medium that execute on one or more processors, the processors specifically configured to execute the reducer task. Moreover, the reducer task is programmed within a non-transitory computer-readable storage medium and/or memory. The reducer task is also operational over a network; the network is wired, wireless, or a combination of wired and wireless. 
     The processing perspective of the reducer task is from that of a reducer task during operation on assigned partitions. The reducer task was initially assigned partitions of data to work on from the workload balancer of the  FIG. 3 , and the reducer task dynamically makes decisions when to reassign a partition to another reducer task, reassign a partition back to an unassigned pool, and select a partition to work on from the unassigned pool. 
     It is noted that multiple instances of the reducer task are simultaneously in operation and can be referred to herein as: another reducer task, another instance of the reducer task, and the like. 
     At  410 , the reducer task receives a set of partitions of data to process. The partitions received were assigned based on a cost analysis by the workload balancer of the  FIG. 3 . 
     At  420 , the reducer task begins processing the set of partitions performing the functions it is configured to perform on the data associated with its set of partitions. 
     At  430 , the reducer task determines, while processing the set of partitions or when finished processing at least some of the partitions whether to perform one or more of: acquire a new partition from an unassigned pool, send one of the partitions to a different reducer (different instance of the reducer task operating on a different set of partitions), send one of the partitions back to the unassigned partition pool, and accept an assigned partition from the different reducer. 
     In an embodiment, at  431 , the reducer task selects the new partition based on a cost associated with processing the new partition and based on a current processing load for the reducer task. 
     In an embodiment of  431  and at  432 , the reducer task resolves the current processing load based on a sum of costs associated with unprocessed partitions from the set that the reducer task is processing. 
     In an embodiment, at  433 , the reducer task identifies one partition from the set that is unprocessed to send to the different reducer based on a cost assigned to that one partition and a current processing load for the reducer task. 
     In an embodiment of  433  and at  434 , the reducer task also identifies the one partition based on a current total processing load of the different reducer. 
     In an embodiment, at  435 , the reducer task decides to send the one partition back to the unassigned partition pool based on a cost assigned to that one partition and a current processing load for the reducer task. 
     In an embodiment, at  436 , the reducer task accepts the assigned partition from the different reducer based on a cost assigned to that assigned partition and a current processing load for the reducer. 
     In an embodiment, at  437 , the reducer task makes the determination after the set of partitions has been processed. 
     It is now understood how the unassigned partition pool and the reducer task along with remaining instances of the reducer task cooperate dynamically at run time to make partition assignments to more efficiently process the data. This improves processing throughput and is particularly noticeable in large-scale data processing environments. 
       FIG. 5  is a diagram of a skew handling system  500 , according to an example embodiment. The skew handling system  500  is implemented as one or more software and hardware components. The software components may be referred to as modules and are executable instructions within a non-transitory computer-readable storage medium that execute on one or more processors of the skew handling system  500 , the processors specifically configured to execute the software components. Moreover, the software components are programmed within a non-transitory computer-readable storage medium and/or memory. The skew handling system  500  is also operational over a network; the network is wired, wireless, or a combination of wired and wireless. 
     In an embodiment, the skew handling system  500  implements the techniques discussed above with the  FIGS. 1 and 2A-2D . 
     In an embodiment, the skew handling system  500  implemented the techniques discussed above with the  FIGS. 3-4 . 
     The skew handling system  500  includes at least one processor  501  associated with at least one device and a workload balancer  502 . 
     The workload balancer  502  is adapted and configured to: execute on the at least one processor  501  of the at least one device, assign partitions of data to reducers  503  based on a cost analysis, and retain at least one partition in an unassigned partition pool. 
     Each reducer  503  is adapted and configured to (while processing that reducer&#39;s assigned partitions) decide whether to: dynamically offload one or more of those partitions to a different reducer  503 , dynamically offload one or more of those partitions to the unassigned partition pool, dynamically select a new partition from the unassigned partition pool, and dynamically accept a different partition from the different reducer  503 . 
     According to an embodiment, the partitions of data are associated with a distributed file system. 
     In an embodiment, the data is associated with a query of a database management system. 
     In an embodiment, the workload balancer  502  is further adapted and configured to split the data into partitions. 
     In an embodiment, the workload balancer  502  is further adapted and configured to create a total number of the partitions to ensure that the total number of partitions is greater than a total number of the reducers  503 . 
     The above description is illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reviewing the above description. The scope of embodiments should therefore be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.