about_SMA_Runbook_Worker_Deployment

about_SMA_Runbook_Worker_Deployment

TOPIC
    about_SMA_Runbook_Worker_Deployment

SHORT DESCRIPTION
    Provides an overview of runbook worker deployments in Microsoft System
    Center 2012 R2 Service Management Automation.

LONG DESCRIPTION
    A deployment of runbook workers defines the runbook workers that are
    configured to pick up and process jobs. Service Management Automation
    uses static queue partitions to load balance work among runbook workers.
    Because of this, queues are never changed on the fly to respond to worker
    additions or workers going offline. If a worker in the current deployment
    goes offline, it is still allocated jobs but cannot process them. 
    Similarly, if a new worker is started but is not specifically defined in
    the current runbook worker deployment, it does not pick up any jobs
    because it is not being assigned any jobs.

    Updating a runbook worker deployment can be useful for a variety of
    reasons, such as scaling out the number of workers to handle increased
    runbook job load, scaling in the number of workers to consolidate
    resources when load is not an issue, or removing a worker from the
    deployment that needs maintenance or has gone offline.


  Changing the runbook worker deployment

      To change the runbook workers in the current deployment, use the 
      New-SmaRunbookWorkerDeployment cmdlet after you have stopped all 
      runbook worker services (rbsvc) in the current deployment. To get 
      the current runbook workers in the deployment, use the 
      Get-SmaRunbookWorkerDeployment cmdlet. You can use the results
      to determine which hosts need the runbook worker service stopped. 
      For example:

        Get-SmaRunbookWorkerDeployment -WebServiceEndpoint "https://localhost"

      After the runbook worker service (rbsvc) for each runbook worker in the
      current deployment is stopped, use the New-SmaRunbookWorkerDeployment 
      cmdlet to replace the existing deployment with a new one. For example:

New-SmaRunbookWorkerDeployment -WebServiceEndpoint "https://localhost" -ComputerName "SMAComputer01"

      After you run New-SmaRunbookWorkerDeployment, start the rbsvc service
      for the runbook workers in the new deployment.

      New-SmaRunbookWorkerDeployment completely replaces the existing 
      deployment; it does not add or remove computers from it. For example,
      if you add one runbook worker to the deployment, you need to add all
      current runbook workers in the deployment as well as the new runbook
      worker, specified by the ComputerName parameter. The following example
      demonstrates how to add the computer names for all of the runbook
      workers:

        $webService = "https://localhost"
        $workers = (Get-SmaRunbookWorkerDeployment -WebServiceEndpoint $webService).ComputerName
        if($workers -isnot [system.array]) {$workers = @($workers)}
        $workers += "<host name of worker to add to deployment>"
        New-SmaRunbookWorkerDeployment -WebServiceEndpoint $webService -ComputerName $workers

      Service Management Automation does not check to ensure runbook workers
      in the existing deployment are offline before 
      New-SmaRunbookWorkerDeployment is run. Therefore, you need to ensure
      that all runbook worker hosts in the existing deployment have the 
      runbook worker service (rbsvc) in a stopped state. 

      Changing the runbook worker deployment while the rbsvc service is 
      running for any runbook worker in the existing deployment can lead
      to runbook jobs being run multiple times, and jobs may be corrupted.
      Placing a runbook worker virtual machine in suspended mode is not
      sufficient because a worker decides which queue partition from which
      to pick up jobs only right after the rbsvc service is started. After
      a suspended worker virtual machine with the rbsvc service running is
      resumed, the runbook worker continues to pick up jobs from a partition
      that another runbook worker may now be serving, which could lead to
      runbook jobs running multiple times, and jobs may be corrupted.

      If the only change you want to make to the runbook worker deployment
      is to replace a runbook worker in the deployment with an identical
      copy, you do not need to use New-SmaRunbookWorkerDeployment. However,
      you must ensure that the following conditions are true:

        -- The runbook worker you are replacing has been removed. You must
           ensure that the replaced worker cannot be brought back online 
           while the replacement worker is running.

        -- The new runbook worker has the same hostname as the worker
           that it is replacing.

      If these conditions are not true, you must perform the full procedure
      outlined above to change the deployment.


  Configuring drain time

      You can configure Service Management Automation so that stopping the
      runbook worker service (rbsvc) on a host allows for a drain time of
      up to 20 minutes. During this time, the runbook worker will not pick
      up any new runbook jobs from its queue partition, but existing runbook
      jobs already running on the worker will be given an amount of time to
      suspend or complete, to prevent job interruption. Any jobs still 
      running after the drain time has passed are stopped, but will be
      restarted if the rbsvc service for the runbook worker is started,
      or if a new runbook worker deployment is created. The rbsvc service
      stops after the drain time has elapsed, or when the worker has no more
      running jobs, whichever occurs first.

      You can change the drain time by using the Set-SmaAdminConfiguration
      cmdlet. For example:

        Set-SmaAdminConfiguration -DrainTimeInSeconds 600


SEE ALSO
    New-SmaRunbookWorkerDeployment
    Get-SmaRunbookWorkerDeployment
    Set-SmaAdminConfiguration