Patent Publication Number: US-8997107-B2

Title: Elastic scaling for cloud-hosted batch applications

Description:
BACKGROUND 
     Cloud computing includes an attractive feature of elasticity. Elasticity is the ability to dynamically acquire or release resources based on demand. In other words, applications are allowed to pay only for the resources they use and to make scaling decisions without human intervention. 
     However, achieving efficient auto-scaling poses three key challenges. First, cloud systems find it difficult to quickly respond to increased demand as they incur significant start-up delay (on the order of tens of minutes) to launch new instances. Second, many applications exhibit bursty arrivals and non-uniform task execution times. Third, unexpected delays and provisioning failures due to the distributed execution environment in the cloud can reduce the efficiency of auto-scaling operations. 
     SUMMARY 
     This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter. 
     Embodiments of the elastic scaling cloud-hosted batch application system and method performs automated elastic scaling of the number of compute instances for batch applications in a cloud computing environment. Embodiments of the system and method use the elastic scaling to minimize the job completion time and to minimize the dollar or monetary cost of resources consumed to execute the jobs. Embodiments of the system and method use a workload-driven approach to estimate the volume of work (or work volume) that is to be performed. This is based on task arrivals and job execution times. 
     Embodiments of the system and method use an adaptive controller to adapt the number of compute instances that are used at any given time under varying load and system conditions. This is an automatic system and method for auto-scaling the number of compute instances for cloud-hosted batch jobs. Embodiments of the system and method estimate the work volume as the cumulative sum of remaining execution time of tasks in the system. Given the work volume estimate, the adaptive controller dynamically adapts the number of compute instances to minimize the unified objective of cost and job completion time. 
     Embodiments of the system and method also mitigate startup delays in provisioning compute instances. The future work volume in the near future is predicted and additional compute instances are started gradually before they are needed. In addition, this gradual startup avoids turning on unnecessary compute instances so that the issue of transient load spikes is addressed. Moreover, embodiments of the system and method actively monitor task arrivals and execution times in order to adjust the number of compute instances under dynamic job characteristics and varying system conditions. 
     Embodiments of the system and method also ensure fairness and prioritization among batch applications and concurrently executing jobs. In particular, it is cost effective to share compute instances across multiple jobs because peak demand periods in one job may overlap with troughs in another job. Embodiments of the system and method provide a fair scheduling of job execution. This is achieved for each time interval by performing round-robin scheduling across jobs having the same priority, for each compute instance. Moreover, for each job, embodiments of the system and method determine a number of tasks to be processed based on the task execution times across jobs. A job with a given priority gets scheduled only after all jobs with higher priority have completed. 
     It should be noted that alternative embodiments are possible, and steps and elements discussed herein may be changed, added, or eliminated, depending on the particular embodiment. These alternative embodiments include alternative steps and alternative elements that may be used, and structural changes that may be made, without departing from the scope of the invention. 
    
    
     
       DRAWINGS DESCRIPTION 
       Referring now to the drawings in which like reference numbers represent corresponding parts throughout: 
         FIG. 1  is a block diagram illustrating a general overview of embodiments of the elastic scaling cloud-hosted batch application system and method implemented in a computing environment. 
         FIG. 2  is a flow diagram illustrating the general operation of embodiments of the elastic scaling cloud-hosted batch application system and method shown in  FIG. 1 . 
         FIG. 3  is a flow diagram illustrating the operational details of embodiments of a job controller that is an exemplary embodiment of the set of job controllers shown in  FIG. 1 . 
         FIG. 4  is a flow diagram illustrating the operational details of embodiments of the global controller shown in  FIG. 1 . 
         FIG. 5  is a flow diagram illustrating the general operation of embodiments of an instance controller that is an exemplary embodiment of the instance controllers shown in  FIG. 1 . 
         FIG. 6  is a flow diagram illustrating the detailed operation of embodiments of the instance controller shown in  FIG. 5  to ensure prioritization and fairness. 
         FIG. 7  is a flow diagram illustrating the operational details of embodiments of the central metadata service shown in  FIG. 1 . 
         FIG. 8  illustrates a simplified example of a general-purpose computer system on which various embodiments and elements of the elastic scaling cloud-hosted batch application system and method, as described herein and shown in  FIGS. 1-7 , may be implemented. 
     
    
    
     DETAILED DESCRIPTION 
     In the following description of embodiments of an elastic scaling cloud-hosted batch application system and method reference is made to the accompanying drawings, which form a part thereof, and in which is shown by way of illustration a specific example whereby embodiments of the elastic scaling cloud-hosted batch application system and method may be practiced. It is to be understood that other embodiments may be utilized and structural changes may be made without departing from the scope of the claimed subject matter. 
     I. System Overview 
     Embodiments of the elastic scaling cloud-hosted batch application system and method provide automatic elastic scaling of batch applications hosted on a cloud computing environment.  FIG. 1  is a block diagram illustrating a general overview of embodiments of the elastic scaling cloud-hosted batch application system  100  and method implemented in a cloud computing environment  105 . 
     As shown in  FIG. 1 , embodiments of the elastic scaling cloud-hosted batch application system  100  and method include a queue system  110  residing in the cloud computing environment  105 . The queue system  110  includes a plurality of N number of queues, including a first queue ( 1 ), a second queue ( 2 ), and so forth, up to the Nth queue (N). Associated with each of the plurality of queues is M number of jobs, including a first job ( 1 ) in the first queue ( 1 ), a second job ( 2 ) in the second queue ( 2 ), to the Mth job (M) in the Nth queue (N). It should be noted that the number of jobs M may be equal to or less than the number of queues N, and that each job will have one associated queue. Moreover, in some situations M may be greater than N, such as when multiple jobs are mapped to the same queue. Incoming jobs  115  are input to the queue system  110  as controlled by embodiments of the elastic scaling cloud-hosted batch application system  100  and method. It should be noted that each job includes multiple tasks. Moreover, any of these multiple tasks may be executed at any give time by a compute instance. 
     A central metadata service  120  is in communication with the queue system  110  and receives information from for each job from the queue system  110 . Also in the cloud computing environment  105  is a set of compute instances  125 . The set of compute instances  125  includes L number of compute instances including a first compute instance CI ( 1 ), a second compute instance CI ( 2 ), to an Lth compute instance CI (L). Each compute instance includes an instance controller, such that the first compute instance CI ( 1 ) has a first instance controller IC ( 1 ), the second compute instance CI ( 2 ) has a second instance controller IC ( 2 ), and so on until the Lth compute instance CI (L) has an Lth instance controller IC (L). 
     Metadata  130  is exchanged between the central metadata service  120  and the set of compute instances  125 . This metadata  130  may include job names, the execution time of each job, and the job duration. Moreover, the queue system  110  directly sends jobs in the queues to the set of compute instances  125  for execution. 
     Embodiments of the elastic scaling cloud-hosted batch application system  100  and method include an adaptive controller  135 . The adaptive controller  135  resides on a local computing device  140 . Although the embodiment shown in  FIG. 1  illustrates the adaptive controller  135  residing on the local computing device, it should be noted that in some embodiments the adaptive controller  135  resides on a computing device (not shown) in the cloud computing environment  105 . As shown in  FIG. 1 , the adaptive controller includes a set of job controllers  145  containing a plurality of job controllers. In particular, the set of job controllers  145  contains M number of job controllers, or one job controller for each job. The set of job controllers  145  includes a first job controller JC ( 1 ), a second job controller JC ( 2 ), and so forth to an Mth job controller JC (M). 
     The adaptive controller  130  also includes a global controller  150  in communication with the set of job controllers  145 . A coordinator module  155  monitors the set of job controllers  145  and communicates with the global controller to manage the auto scaling decisions sent by the global controller  150 . The central metadata service  120  is in communication with the adaptive controller  135  and sends information such as job execution time and input rate. The adaptive controller  135  also is in communication with the set of compute instances  125  in order to ascertain the demand for input jobs and adjust the number of compute instances needed to execute the jobs. The arrow between the adaptive controller  135  and the set of compute instances  125  indicates, among other things, that there are decisions, actuation, or both being executed. 
     II. Operational Overview 
       FIG. 2  is a flow diagram illustrating the general operation of embodiments of the elastic scaling cloud-hosted batch application system  100  and method shown in  FIG. 1 . As shown in  FIG. 2 , the operation of embodiments of the elastic scaling cloud-hosted batch application method begins by estimating a work volume to be performed (box  200 ). In some embodiments, this estimation is based on the rate at which jobs to be executed arrive at the queue system  110  and the execution time for each of those jobs. 
     The work volume may be determined in a variety of different ways. One way in which the work volume may be estimated is as a cumulative sum of execution times of jobs remaining to be executed (box  205 ). As noted above, jobs include tasks whose execution time on a compute instance is measured. The work volume is cumulative sum of task execution times remaining to be executed for a job. Then, based on the work volume, embodiments of the method dynamically adapt the number of compute instances that are needed to execute the jobs (box  210 ). This involves increasing the number of compute instances as the work volume increases, and decreasing the number of compute instances as the work volume decreases (box  215 ). 
     Embodiments of the elastic scaling cloud-hosted batch application method seek to simultaneously minimize completion times for each job while also minimizing the monetary cost of the resources used to execute the jobs (box  220 ). In some embodiments, the method actively monitors the rate at which jobs arrive at the queue system  110  and the corresponding execution times for each of those jobs (box  225 ). This is used to adjust the number of compute instances accordingly. 
     Future work volume can be predicted by examining jobs currently in the queue system  105  and the current job processing rate (box  230 ). If the current job processing rate is less than a desired job processing rate (based on the number of jobs currently in the queue system  110 ), then the number of compute instances is gradually increased (box  235 ). This mitigates startup delays of compute instances while ensuring that a temporary spike in work volume does not increase the number of compute instance drastically. 
     To handle multiple jobs, embodiments of the elastic scaling cloud-hosted batch application method perform a round robin scheduling of job execution by shared compute instances across multiple jobs (box  240 ). This involves determining how many tasks are to be processed per job based on the task execution times across the multiple jobs (box  245 ). Moreover, a weight parameter can be defined for specific applications such that one application&#39;s weight parameter is different from another application&#39;s weight parameter (box  250 ). This serves to balance the tradeoff between minimizing completion time and minimizing monetary cost of resources used. It should be noted that the weight parameter does not directly affect a priority of a specific application. Further, in some embodiments of the elastic scaling cloud-hosted batch application method a scaling parameter is used to scale up and scale down the number of compute instances (box  255 ). 
     III. Operational Details 
     The operational details of embodiments of the elastic scaling cloud-hosted batch application system  100  and method will now be discussed. This includes the operation of a job controller  300  (which is an exemplary embodiment of the job controllers contained in the set of job controllers  145 ), the global controller  150 , an instance controller  500  (which is an exemplary embodiment of the instance controllers IC ( 1 ) to IC (L)), and the central metadata service  120 . 
     III.A. Preliminaries 
     Before discussing the details of embodiments of the elastic scaling cloud-hosted batch application system  100  and method, a few preliminaries will be discussed. Embodiments of the system  100  and method focus on hosting batch jobs in the cloud computing environment  105 . Note that in this document the terms “job” and “application” are used interchangeably. Jobs arrive (or are submitted by users) to the cloud system online over time. Job j has a work requirement w j , which is the time it would take to complete the job on a unit speed machine. 
     Each job comprises multiple tasks which are organized in phases and arrive over time. Tasks in a phase depend on the results computed by the tasks in the previous phase and can run in parallel up to a certain degree. A task is defined as an atomic unit of computation with a fixed input, and a task is the finest granularity of parallelization. A phase is defined as a collection of tasks that can run in parallel (such as shuffle and reduce). An outlier is defined as a task that takes longer to finish compared to other tasks in the phase. A workflow is defined as a directed acyclic graph denoting how data flows between phases and a job as an execution of the workflow. 
     A task i has an arrival time a i  and (possibly unknown) processing time p i . Let d i =a i +p i  be the earliest possible completion time of task i. Each task runs on a single compute instance (in other words, a server or a virtual machine) until completion. For simplicity, it is assumed that all instances are homogeneous and preemption of tasks are not considered. Each instance can run a single task at a time and different tasks can run in parallel on different instances. Dynamic resource allocation is performed by activating or shutting down compute instances. To add an instance, it takes T setup  time (in some embodiments between 10-20 minutes) until the instance is available to process tasks. Note that the problem is trivial if T setup =0, since a compute instance can be instantaneously allocated for each incoming task and released upon completion. In other words, each task i arriving at a i  completes at d i . 
     Similarly, it takes T shutdown  time (about 1-2 minutes in some embodiments) to turn off an instance. The instance may become unavailable immediately after receiving a signal to shut down. 
     Embodiments of the elastic scaling cloud-hosted batch application system  100  and method are designed to maximize performance and minimize cost when executing a batch application in the cloud. Regarding performance, the touchstone is to minimize the total job completion time (also called makespan) from the arrival of the first task till the last finishing task in the job in order to maximize performance. Assuming that the arrival of the first task is at time 0, the job completion time is denoted as T. 
     Regarding the cost, the touchstone is to minimize the total dollar (or other monetary unit) cost of computing resources used in executing the job. Cloud providers charge a fixed cost (say C) per compute instance per unit time (such as, for example, 20 cents per instance per hour). Thus, the dollar cost incurred in processing the job is computed as the integral of the number of instances used N(t) at time t from the start till finish of the job. In practice, however, cloud platforms round up the time used by a compute instance to hourly boundaries so the total cost may be higher. 
     Mathematically, the dollar cost, D, is given by the equation:
 
 D=c*∫   t=0   t=T   N ( t ) dt.  
 
     These two benchmarks are combined to in a weighted linear combination to define the optimization goal as,
 
Objective: MIN α*D+(1−α)*T  (1)
 
where,
 
αε[0,1].
 
     Other variants of this formulation such as,
 
Minimize D s.t. T≦T deadline ,
 
and
 
Minimize T s.t. D≦D budget ,
 
and
 
bi-criteria(D,T),
 
are also possible.
 
     Note that there is a tradeoff between the job completion time T and the dollar cost D. Setting the number of instance to one, such that
 
 ∀t:N ( t )=1,
 
minimizes the dollar cost but may significantly delay job completion. On the other hand, setting,
 
 ∀t:N ( t )=∞,
 
(or a large constant) will minimize the job completion time at a high cost. Thus, there is a tradeoff between cost and completion time.
 
III.B. Adaptive Controller
 
     The adaptive controller  135  of embodiments of the elastic scaling cloud-hosted batch application system  100  and method will now be described. An overview of the controller  135  will be presented first, followed by a detailed description of the controller  135  and its associated components. 
     III.B.1. Adaptive Controller Overview 
     In order to solve the optimization problem given in Equation (1), the adaptive controller determines the resource demands for input jobs and adjusts the number of instances N(t) to run their tasks. In other words, the adaptive controller  135  determines whether to launch new instances in case of overload or release some instances in case of excess capacity. 
     Specifically, embodiments of the adaptive controller  135  seek to accomplish the following. First, the adaptive controller  135  adapts compute capacity to balance the tradeoff between cost and performance targets of individual jobs. Second, the adaptive controller  135  should perform auto-scaling in an automated manner under dynamic workloads and cloud system conditions. Finally, the adaptive controller  135  ensures a fair allocation of resources among concurrent jobs. 
     Based on the above, embodiments of the adaptive controller  135  have a three-layer control system that includes the global controller  150 , a job controller per job, and an instance controller for each compute instance (that are also called worker nodes). 
     For each job there is a job controller whose adapts the amount of resources allocated to the job to meet its cost and performance targets. Moreover, each job controller forwards its estimated resource requirements to global controller  150 , which makes global decisions to allocate resources. Each compute instance has an instance controller that arbitrates among multiple queues, one queue per job, and allocates its execution time as determined by the global controller  150 . 
     For each job, its runtime performance metrics (such as task arrivals and execution times) are collected at the central metadata service  120 . The job controller queries this service at periodic intervals to determine the difference between the current resource allocation and resources needed to meet the optimization goal. Then it computes the desired change in the number of compute instances and sends it to the global controller  150  for resource allocation in the next time interval. 
     The global controller  150  aggregates resource requirements across all job controllers and actuates decisions to adapt the total number of compute instances. Further, the global controller  150  adapts the scheduling policy across instance controllers to ensure fairness among concurrent jobs. 
     III.B.2. Job Controller 
       FIG. 3  is a flow diagram illustrating the operational details of embodiments of a job controller  300  that is an exemplary embodiment of the set of job controllers  145  shown in  FIG. 1 . The operation of the job controller  300  begins by determining that a job will be executed (box  305 ). A job controller  300  is associated with each job (box  310 ). 
     Next, the job controller  300  determines an amount of resources allocated to the job (box  315 ). Moreover, the controller  300  determines an optimization goal by find a cost target and a performance target for the job (box  320 ). Resource requirements for the job are estimated by the controller  300  in order to obtain estimated resource requirements (box  325 ). 
     The job controller  300  then queries the central metadata service  120  at periodic intervals to determine a difference between a current resource allocation and the resources needed to meet the optimization goal (box  330 ). A desired change in the number of compute instances then is computed based on the difference (box  335 ). This desired change in the number of compute instances and the estimated resource requirements are then sent to the global controller  150  (box  340 ). 
     In mathematical terms, the job controller  300  determines the number of instances N(t) at any time t, to balance the cost versus performance tradeoff for the submitted job. Note that queuing theory is not applicable to this problem for two reasons. First, the number of compute instances is not fixed. Second, the task arrival rate and service rate can change significantly over time. As a result, the system dynamics would be difficult to model under varying workloads. 
     Under a uniform distribution of task arrival rate and execution times, the compute capacity can be set to match the input load such that queue length remains constant. However, under bursty load patterns, the queue length can vary significantly, thereby affecting both the job completion time and the dollar cost of running compute instances. Because of this, embodiments of the job controller  300  use adaptive resource allocation under dynamic workloads and system conditions. 
     In order to adapt the compute capacity to dynamic workloads, the job controller  300  logically separates the workload into two components: (1) tasks waiting in the queue; and (2) task arrivals over time. In the first case, for transient load bursts resulting in a large number of enqueued tasks, it is desirable to process them at the earliest because this strategy reduces the job completion time without affecting the cost. In the second case, for processing task arrivals over time, it suffices to provision the minimum number of instances needed to handle the input rate. In this way, the cost is reduced but the job completion time remains unaffected. 
     Based on this partitioning, the total compute capacity is divided into two parts to process each load component. The first part is the queue workers number (denoted as NQ t ), which is the number of instances (called “queue workers”) to process the enqueued tasks. The second part is the input workers number (denoted as Nλ t ), which is the number of instances (called “input workers”) to process the task arrival rate λ(t) at time t. It should be noted that this partitioning is logical, so that a compute instance simply selects the next available task from the job queue for processing. Their sum gives the total number of compute instances, given mathematically as,
 
 N ( t )= N   t   =NQ   t   +Nλ   t   (2).
 
     In order to adapt NQ t  and Nλ t , the workload partitioning model is leveraged to combine closed-loop control for steady load patterns (in well-modeled operating regimes) and open-loop control for transient load spikes (in hard-to-model regimes). Specifically, the job controller  300  uses an optimization controller to estimate NQ t  and uses integral gain control theory to adjust Nλ t . 
     Calculating the Queue Workers Number (NQ t ) 
     In order to estimate the number of queue workers, NQ t , at time t, the objective function is modified to treat resource costs in terms of the volume of total processing time of pending tasks, and to omit c as it is a constant factor to convert the execution time into dollar costs. Mathematically, this is given by the equation,
 
MIN  E=α*∫   0   T   N ( t ) dt +(1−α)* T   (3).
 
     The expected additional time ΔT to process |Q t | new enqueued tasks using NQ t  number of instances is equal to the sum of, 
                 Q   t       μ   *     NQ   t         ,         
(where μ is the service rate) and T setup +T shutdown . In other words, the time taken to provision the compute instances.
 
     Therefore, the incremental change in the objective function becomes, 
     
       
         
           
             
               Δ 
               ⁢ 
               
                   
               
               ⁢ 
               E 
             
             = 
             
               
                 α 
                 * 
                 
                   NQ 
                   t 
                 
                 * 
                 
                   ( 
                   
                     
                       
                         Q 
                         t 
                       
                       
                         μ 
                         * 
                         
                           NQ 
                           t 
                         
                       
                     
                     + 
                     
                       T 
                       setup 
                     
                     + 
                     
                       T 
                       shutdown 
                     
                   
                   ) 
                 
               
               + 
               
                 
                   ( 
                   
                     1 
                     - 
                     α 
                   
                   ) 
                 
                 * 
                 
                   
                     ( 
                     
                       
                         
                           Q 
                           t 
                         
                         
                           μ 
                           * 
                           
                             NQ 
                             t 
                           
                         
                       
                       + 
                       
                         T 
                         setup 
                       
                       + 
                       
                         T 
                         shutdown 
                       
                     
                     ) 
                   
                   . 
                 
               
             
           
         
       
     
     Taking the differential, 
                 ⅆ     (     Δ   ⁢           ⁢   E     )         ⅆ     NQ   t         ,         
and setting it to zero, yields a closed form and computationally inexpensive optimal solution to minimize ΔE:
 
                     NQ   t     =             (     1   -   α     )     *     Q   t         α   *   μ   *     (       T   start     +     T   shutdown       )           .             (   4   )               
Note that for scale-in, an NQt instance is allowed to shut down only when it is idle and the job queue is empty.
 
     Calculating the Input Workers Number (Nλ t ) 
     The input workers number, Nλ t , is set so that there is enough computational capacity to handle the input rate given the distribution of observed task execution times. At the beginning of the control interval k starting at time t, the controller  300  takes as input the measured average service rate μ k-1  (defined as the number of tasks processed per second) across running instances during the previous interval and its desired value μ(ref) to process the input rate. 
     The job controller  300  measures the error difference between the current and desired values as, 
               e     k   -   1       =     N   ⁢           ⁢     λ     k   -   1       *         (       μ     k   -   1       -     μ   ⁡     (   ref   )         )       μ   ⁡     (   ref   )         .             
Intuitively, if μ k-1  exceeds μ(ref), then the system is currently over-provisioned (the task processing rate is higher than desired rate) and hence can scale-in the number of compute instances, and vice-versa. Based on the error term, the number of compute instances Nλ t  is calculated using the following control law:
 
 Nλ   t   =Nλ   k   =Nλ   k-1   −G   k   *e   k-1   (5)
 
where G k  denotes the integral gain parameter that determines how aggressive the controller is in correcting the observed error. The value of G k  adapts automatically to varying workload by setting,
 
 G   k =1/α*(1−β* e   −γ*|e     k−1     | ),
 
where,
 
α≧1,0&lt;β≦1,0&lt;γ≦1
 
are tunable constants. Intuitively, when the error is small, G k  provides dampening of the term,
 
G k *e k-1  
 
to avoid oscillations and when the error is large, it modulates the speed of convergence together with change in Nλ t . In comparison to a standard integral controller that has a fixed G value, the job controller  300  self-tunes the gain parameter to balance the tradeoff between convergence, stability and efficiency of the closed-loop control system.
 
     Note that the above control law assumes that Nλ k  is a continuous variable. Therefore, to avoid oscillations due to discretization of Nλ k  values, μ(ret) is mapped into a range [μ l , μ h ] where the controller will actuate Nλ k  only if μ k-1  exceeds μ h  implying over-provisioning or when μ k-1  falls below μ l , implying underprovisioning. 
     In particular, 
                       N   ⁢           ⁢     λ   k       -     N   ⁢           ⁢     λ     k   -   1           =     {               G   k     ⁢   N   ⁢           ⁢     λ     k   -   1       ⁢       (       μ   h     -     μ     k   -   1         )       μ   h                 if   ⁢           ⁢     μ   h       &lt;     μ     k   -   1                     G   k     ⁢   N   ⁢           ⁢     λ     k   -   1       ⁢       (       μ   l     -     μ     k   -   1         )       μ   l                 if   ⁢           ⁢     μ   l       &gt;     μ     k   -   1                 0       otherwise         .               (   6   )               
Note that static value settings of μ h  and μ l  may lead to oscillations when μ h −μ l  is too small, and slow adaptation leading to high resource costs when it is too large. Therefore, μ(ref)=μ h  and proportional thresholding is used to vary the range of μ l .
 
     Mathematically, 
                         μ   l     =       μ   h     *       (         N   ⁢           ⁢     λ     k   -   1         -   1       N   ⁢           ⁢     λ     k   -   1           )     r         ;     r   =   1       ,   2   ,     …   ⁢           .                             
This setting ensures the stability property that when Nλ k  increases by one under μ l &gt;μ k-1 , then the new μ k  will stay below μ h  to avoid oscillations. The term μ h  is set empirically as the inverse of the median quantile on the observed task execution times.
 
     To provide proactive provisioning, the job controller  300  uses an estimate of the input load λ(t) to decide the resource entitlement for the next interval. Specifically, it computes the expected service rate in the next control interval as, 
                     μ   k     =           ∫     t   k       t     k   +   1         ⁢       λ   ⁡     (   t   )       ⁢     ⅆ   t             [       t   k     ,     t     k   +   1         ]     *   N   ⁢           ⁢     λ   t         .             (   7   )               
A standard low-pass filter is used to separate transient spikes from the steady load patterns.
 
III.B.3. Global Controller
 
     Given the collective requests from the set of job controllers  145 , the global controller  150  adapts the number of compute instances to meet their demand. In addition, the global controller  150  actuates these decisions by calling auto-scaling APIs provided by the cloud platforms. In order to run multiple jobs, each job is treated separately as an independent queue that is controlled by its individual job controller  300 . 
       FIG. 4  is a flow diagram illustrating the operational details of embodiments of the global controller  150  shown in  FIG. 1 . The operation of the global controller  150  begins by receiving estimated resource requirements from each job controller  300  in the set of job controllers  145  (box  400 ). The global controller  150  uses this information to determine how to globally allocate the number of compute instances among each of the jobs to be executed (box  410 ). 
     The global controller  150  aggregates the estimated resource requirements across each of job controller  300  in the set of job controllers  145  (box  420 ). The number of compute instances then is adapted based on the aggregate estimated resource requirements (box  430 ). Moreover, the scheduling of jobs is adapted among the number of compute instances in order to ensure fairness among jobs that are being executed concurrently (box  440 ). In addition, the scheduling of jobs in multiple jobs queues served by a single compute instance is adapted to ensure priority and fairness among concurrent jobs in the multiple job queues (box  450 ). As explained below with reference to  FIG. 6 , some jobs may have a higher priority than other jobs, and those jobs with the same priority are treated fairly. 
     At the next interval, the global controller  150  may receive from the job controller  300  a desired change in the number of compute instances (box  460 ). This may be because the number of jobs has increased or decreased, the execution time for jobs has increased or decreased, or any combination of the preceding. Based on this desired change, the global controller  150  determines how to globally allocate the number of compute instances among the jobs to be executed (box  470 ). This automatic adaptation and scaling continue to occur over subsequent time intervals. 
     In mathematical terms, the global controller  150  computes the total number of compute instances N t  as the sum aggregate of queue workers and input workers across jobs. This can be written as, 
     
       
         
           
             
               
                 
                   
                     N 
                     t 
                   
                   = 
                   
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           
                             Job 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             1 
                           
                         
                         Jobn 
                       
                       ⁢ 
                       
                         NQ 
                         t 
                         i 
                       
                     
                     + 
                     
                       N 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           λ 
                           t 
                           i 
                         
                         . 
                       
                     
                   
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
           
         
       
     
     In order to ensure fairness among concurrent jobs, the global controller  150  multiplexes the computing resources across active jobs to reduce costs because the high demand periods in one job may overlap with low demand periods in the other. One challenge is to ensure fairness in allocating computing resources between them. Embodiments of the elastic scaling cloud-hosted batch application system  100  and method provide an effective scheduling policy that partitions the computing capacity evenly among the unfinished jobs. Specifically, at the beginning of the control interval k, the global controller  150  computes the 90th percentile of the task execution times p j  for each job j and then takes their max p max . 
     III.B.4. Instance Controller 
       FIG. 5  is a flow diagram illustrating the general operation of embodiments of an instance controller  500  that is an exemplary embodiment of the instance controllers, IC ( 1 ) to IC (L), shown in  FIG. 1 . Operation of the instance controller  500  begins by inputting a compute instance (box  510 ) and associating one instance controller  500  with the computer instance (box  520 ). This is performed for each compute instance such that each compute instance has one associated instance controller. 
     Next, the instance controller  500  determines a number of queues in the queue system  110  (box  530 ). The instance controller  500  then arbitrates among the queue in the queue system  110  to ensure that each of the queues performs just one job at a time (box  540 ). The instance controller  500  then obtains an execution time from the global controller  150  (box  550 ) and allocates the execution time among the queues (box  560 ). 
     This allocation is performed using a scheduling policy. In some embodiments this scheduling policy is a round-robin scheduling policy. Mathematically, each instance controller  500  performs a round-robin scheduling of job queues and uses the ratio, 
             ⌈       p     m   ⁢           ⁢   ax         p   j       ⌉         
as a measure of the number of tasks to be processed from queue j during that interval. This technique performs within a constant factor of the optimal scheduler in terms of average makespan (or the time duration between job release and completion). This is provided that the interval is long enough. If job queues have different priorities, then an instance controller  500  processes a job queue only after all higher-priority jobs have been completed.
 
       FIG. 6  is a flow diagram illustrating the detailed operation of embodiments of the instance controller  500  shown in  FIG. 5  to ensure prioritization and fairness. Referring to  FIG. 6 , the instance controller  500  inputs a single compute instance having multiple job queues associated with the single compute instance (box  600 ). Next, a one instance controller is assigned or associated with the single compute instance (box  610 ). 
     A priority number for each of the jobs in the multiple job queues then are input (box  620 ). The jobs then are ordered in order of priority based on their priority number (box  630 ). A determination then is made as to whether any jobs have the same priority number, meaning that they have the same priority (box  640 ). If not, then the jobs are executed in order of priority, with the job having the highest priority executed first (box  650 ). In other words, a job with a given priority is executed only if all higher priority jobs have finished execution. For jobs with the same priority, the global controller is used to ensure fairness among these jobs (box  660 ). This fairness approach was set forth above with regard to  FIG. 4 . 
     III.C. Central Metadata Service 
     The central metadata service  120  of embodiments of the elastic scaling cloud-hosted batch application system  100  and method will now be described. In general, the service  120  is designed to store and provide both task and job metadata as well as compute instance metadata. This metadata allows the adaptive controller  135  to make automatic scaling decisions. 
       FIG. 7  is a flow diagram illustrating the operational details of embodiments of the central metadata service  120  shown in  FIG. 1 . Referring to  FIG. 7 , the central metadata service  120  collects runtime performance metrics for each job being executed (box  700 ). In addition, the service  120  collects job arrivals and execution times for each job (box  710 ). 
     The service  120  also keeps track of the job execution times for each queue in the queue system  110  (box  720 ) and the number of queues and jobs that are still in the system (box  730 ). The size of queues is kept track of by the service  120  (box  740 ), as well as the number of processed tasks for each queue (box  750 ). The central metadata service  120  also keeps track of status flags set by the controllers (box  760 ). In some embodiments these status flags are stop flags that are used to signal the compute instances to shut down. 
     III.D. Other Issues 
     Some issues that may arise during implementation and operation of embodiments of the elastic scaling cloud-hosted batch application system  100  and method will now be discussed. 
     III.D.1. Blocking Reconfiguration Operation 
     Specific to the Platform-as-a-Service (PaaS) model in Windows® Azure®, which are registered trademarks of the Microsoft Corporation located in Redmond, Wash., a new reconfiguration operation is blocked until the previous operation has completed. As a result, the controller needs to balance the benefits of making fast reconfiguration decisions and the opportunity cost in not being able to actuate decisions during a significant load fluctuation in the future while a reconfiguration is pending. In other models, however, the reconfiguration operations may be non-blocking as virtual machine (VM) instances can be independently provisioned and released. 
     III.D.2. Scalability 
     The central metadata service  120  and global controller  150  may become a bottleneck in the system with a large number of jobs and computing instances. To improve scalability, embodiments of the elastic scaling cloud-hosted batch application system  100  and method use several existing techniques. One technique is allocating multiple compute instances to serve as the central metadata service  120 , using consistent hashing to load-balance queues and metadata stored among them. Another technique is using an aggregation tree to aggregate requests in which job controllers act as leaves and the global controller  150  acts as the root. 
     III.D.3. Provisioning Delays and Failures 
     At times there is a wide variation in the reconfiguration time arising from actuator lag in virtual machine (VM) provisioning. In order to preserve stability during adjustments, embodiments of the elastic scaling cloud-hosted batch application system  100  and method provide a coordinator module  155  that manages the dependency between the auto-scaling decisions sent by the global controller  150  and their actuation. Specifically, the coordinator module  155  actively monitors the actions of the job controllers contained in the set of job controllers  145 . Moreover, upon failure, the coordinator module  155  retries them. On completion (or after a timeout), the coordinator module  155  sends a notification to the global controller  150 . 
     III.D.4. Pricing Based on Hourly Charging 
     Commercial cloud platforms charge for compute instances by hour (by rounding up their execution time). Thus, for scale-in, it is desirable to shut down an instance only if it is idle and its running time is close to an hourly boundary based on the start time. 
     Embodiments of the elastic scaling cloud-hosted batch application system  100  and method define a shutdown time window (such as, for example, 10 minutes to the hourly boundary but greater than T shutdown ) to decide when to shut down an instance. Embodiments of the elastic scaling cloud-hosted batch application system  100  and method use two Boolean variables per instance. Namely, a stop flag and a delete flag. 
     A stop flag indicates whether a worker is a candidate for deletion. Before picking the next task to process (or periodically), each compute instance checks if its stop flag is set and whether its running time falls within the shutdown window. In that case, the compute instance sets the delete flag marking itself to be shut down. Otherwise, it continues picking up new tasks. The coordinator module  155  can release all instances whose delete flags are set. In case of scale-out, the coordinator module  155  first recycles the instances marked for deletion by simply resetting their flags. 
     Windows® Azure® does not provide a direct control over which instances to shut down. It was observed that the runtime system selects instances in decreasing order of the instance identifications (ID&#39;s) for shutdown. This observation is used to scale-in by setting status flags (such as stop flags) for workers in that order. Other models, however, may allow a specific virtual machine to be terminated. 
     The utility pricing model in Windows® Azure® charges based on clock hour boundaries instead of hourly boundaries as in other models. In particular, a compute instance started, say, at 2:35 pm will be charged for one hour till 3 pm and then subsequently charged on clock hourly boundaries from 3 pm to 4 pm, from 4 pm to 5 pm, and so on. 
     Although this model is clearly more restricted, it simplifies when to actuate the auto-scaling decisions. In particular, the scale-in decisions for all running instances only need to be made about T shutdown  before each clock hour boundary. The scale-out decisions can still be made during the hour at the cost of increasing overhead (due to full hour charging) but this may reduce the job completion time. 
     III.E. Other Embodiments 
     This section discusses alternate embodiments of the elastic scaling cloud-hosted batch application system  100  and method. 
     III.E.1. Balancing Tradeoff Between Cost and Performance 
     The optimization problem considered in this document aims to minimize a weighted combination of cost and completion time. In order to balance the tradeoff between these metrics, some embodiments of the elastic scaling cloud-hosted batch application system  100  and method allow applications to set a weight parameter α in an application-specific manner. The weight parameter is specific to the batch application and is tuned for the batch application to balance the tradeoff between minimizing a completion time and minimizing a monetary cost of resources used to execute the jobs. 
     On one hand, for applications like web search, completion time is relatively more important because even a small fraction of stale results can lead to a significant loss in revenue through a reduction in purchases, search queries, or advertisement click-through rates. On the other hand, for scientific applications, low costs and job completion within a deadline are preferable. Further, a related challenge in these embodiments is how to set the deadlines such that resource costs remain reasonable. 
     III.E.2. Leveraging Offline Job Information 
     In many batch applications the directed acyclic graph (DAG) of job execution is known a priori as it is generated by a compiler. The auto-scaling technique in some embodiments of the elastic scaling cloud-hosted batch application system  100  and method can leverage the compile-time metadata such as the number of tasks in each phase, the communication pattern between mapper and reducer tasks, and the expected task execution times, to infer the resource requirements before executing the job. Thus, by integrating the offline job information with online resource allocation, the adaptive controller  135  should be able to make better auto-scaling decisions. 
     III.E.3. Scale-Out, Scale-In and Scale-Up, Scale-Down 
     Some embodiments of the elastic scaling cloud-hosted batch application system  100  and method include a scale-out/scale-in scaling knob and a scale-in/scale-out for auto-scaling. The scale-out/scale-in scaling knob adjust a scale-out/scale-in parameter that allows the number of compute instances to be increased (scale-out) or decreased (scale-in). The scale-up/scale-down knob adjusts a scale-up/scale-in parameter that serves to adjust the number of resources allocated to a given compute instance. These resources include, for example, CPU, memory, disk, network, and so forth. 
     For compute-intensive applications, the total completion time can be reduced by up to 50% by replacing small VM instances by medium ones, which have relatively two times more central processing unit (CPU) capacity but cost twice as much. Similarly, the completion time can be further reduced if large VM instances are used. Note that in all cases, the dollar costs for consumed resources would be roughly the same. The difference may arise due to pricing based on discrete per-hour charging intervals. 
     IV. Exemplary Operating Environment 
     Embodiments of the elastic scaling cloud-hosted batch application system  100  and method described herein are operational within numerous types of general purpose or special purpose computing system environments or configurations.  FIG. 8  illustrates a simplified example of a general-purpose computer system on which various embodiments and elements of the elastic scaling cloud-hosted batch application system and method, as described herein and shown in  FIGS. 1-7 , may be implemented. It should be noted that any boxes that are represented by broken or dashed lines in  FIG. 8  represent alternate embodiments of the simplified computing device, and that any or all of these alternate embodiments, as described below, may be used in combination with other alternate embodiments that are described throughout this document. 
     For example,  FIG. 8  shows a general system diagram showing a simplified computing device  10 . Such computing devices can be typically be found in devices having at least some minimum computational capability, including, but not limited to, personal computers, server computers, hand-held computing devices, laptop or mobile computers, communications devices such as cell phones and PDA&#39;s, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, audio or video media players, etc. 
     To allow a device to implement embodiments of the elastic scaling cloud-hosted batch application system  100  and method described herein, the device should have a sufficient computational capability and system memory to enable basic computational operations. In particular, as illustrated by  FIG. 8 , the computational capability is generally illustrated by one or more processing unit(s)  12 , and may also include one or more GPUs  14 , either or both in communication with system memory  16 . Note that the processing unit(s)  12  of the general computing device of may be specialized microprocessors, such as a DSP, a VLIW, or other micro-controller, or can be conventional CPUs having one or more processing cores, including specialized GPU-based cores in a multi-core CPU. 
     In addition, the simplified computing device of  FIG. 8  may also include other components, such as, for example, a communications interface  18 . The simplified computing device of  FIG. 8  may also include one or more conventional computer input devices  20  (e.g., pointing devices, keyboards, audio input devices, video input devices, haptic input devices, devices for receiving wired or wireless data transmissions, etc.). The simplified computing device of  FIG. 8  may also include other optional components, such as, for example, one or more conventional computer output devices  22  (e.g., display device(s)  24 , audio output devices, video output devices, devices for transmitting wired or wireless data transmissions, etc.). Note that typical communications interfaces  18 , input devices  20 , output devices  22 , and storage devices  26  for general-purpose computers are well known to those skilled in the art, and will not be described in detail herein. 
     The simplified computing device of  FIG. 8  may also include a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer  10  via storage devices  26  and includes both volatile and nonvolatile media that is either removable  28  and/or non-removable  30 , for storage of information such as computer-readable or computer-executable instructions, data structures, program modules, or other data. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes, but is not limited to, computer or machine readable media or storage devices such as DVD&#39;s, CD&#39;s, floppy disks, tape drives, hard drives, optical drives, solid state memory devices, RAM, ROM, EEPROM, flash memory or other memory technology, magnetic cassettes, magnetic tapes, magnetic disk storage, or other magnetic storage devices, or any other device which can be used to store the desired information and which can be accessed by one or more computing devices. 
     Retention of information such as computer-readable or computer-executable instructions, data structures, program modules, etc., can also be accomplished by using any of a variety of the aforementioned communication media to encode one or more modulated data signals or carrier waves, or other transport mechanisms or communications protocols, and includes any wired or wireless information delivery mechanism. Note that the terms “modulated data signal” or “carrier wave” generally refer to a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. For example, communication media includes wired media such as a wired network or direct-wired connection carrying one or more modulated data signals, and wireless media such as acoustic, RF, infrared, laser, and other wireless media for transmitting and/or receiving one or more modulated data signals or carrier waves. Combinations of the any of the above should also be included within the scope of communication media. 
     Further, software, programs, and/or computer program products embodying the some or all of the various embodiments of the elastic scaling cloud-hosted batch application system  100  and method described herein, or portions thereof, may be stored, received, transmitted, or read from any desired combination of computer or machine readable media or storage devices and communication media in the form of computer executable instructions or other data structures. 
     Finally, embodiments of the elastic scaling cloud-hosted batch application system  100  and method described herein may be further described in the general context of computer-executable instructions, such as program modules, being executed by a computing device. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. The embodiments described herein may also be practiced in distributed computing environments where tasks are performed by one or more remote processing devices, or within a cloud of one or more devices, that are linked through one or more communications networks. In a distributed computing environment, program modules may be located in both local and remote computer storage media including media storage devices. Still further, the aforementioned instructions may be implemented, in part or in whole, as hardware logic circuits, which may or may not include a processor. 
     Moreover, although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.