Create a Queue-based Server Array

Since, server usage is billed on an hourly basis, it's more cost effective to keep a worker instance running for a full hour before it's allowed to be terminated.  By default, worker instances will be available to grab tasks from the input queue until its 55th minute of operation.  If a server has been running for 55 minutes and is currently not processing a work unit, it will be terminated.   This process maximizes the usage time of all worker instances while minimizing overall usage costs.  It prevents you from paying for worker instances that sit idle for a full hour and do not process any work. 

There are two types of queue-based server arrays.

Based on the amount of jobs in the queue

To create a server array, go to Manage -> Arrays and click on the New button.

04-server_arrays_new_jobs.gif

Provide the following information:

  • Nickname - provide a Nickname for the server array.
  • Array type - select Queue-based as the type of server array.  (The secondary configuration options will change accordingly.)
  • Server template - select the template that will be used to create the worker instances in the server array.
  • SSH key - select the SSH key that will be used by all worker instances in the server array.
  • Security Group - select the security group that will be used by all worker instances in the server array.
  • Deployment - select a deployment for the server array.  (A deployment can have more than one server array.)
  • Default min count - the minimum number of worker instances that must be operational in the server array.  You can set this value to zero to avoid idle server usage costs.  But, if you have time-sensitive tasks that need to be processed immediately, you might want to use a value of at least one worker instance.  Default = 1
  • Default max count - the maximum number of worker instances that can be operational at any given time in the server array. Default = 20
  • Elasticity function - defines how the server array should grow/shrink. Select sqs_queue_size
  • Elasticity params - defines the elasticity parameters that will be used to determine when a server array should be resized.
    • Items per instance - defines the ratio of worker instances per items in the queue.  Ex: If there are 50 items in the queue and "Items per instance" is set to 10, the server array will resize to 5 worker instances.
  • Indicator - select the input SQS queue that contains all of the job tasks.
  • Audit - (optional) select the audit SQS queue that will store audit entries.

 

Example 1

If there are 100 jobs in the queue and there are already 8 servers running, the server array will only add 2 additional worker instances. 

Items per instance: 10
Default max count: 20

Example 2

If there are 1000 jobs in the queue and there are already 10 servers running, the server array will only add 10  additional worker instances, because the maximum server count is set to 20 worker instances.

Items per instance: 10
Default max count: 20

 

 

Based on the amount of time a job is in the queue

To create a server array, go to Manage -> Arrays and click on the New button.

03-server_arrays_new_time.gif

Provide the following information:

  • Nickname - provide a Nickname for the server array.
  • Array type - select Queue-based as the type of server array.  (The secondary configuration options will change accordingly.)
  • Server template - select the template that will be used to create the worker instances in the server array.
  • SSH key - select the SSH key that will be used by all worker instances in the server array.
  • Security Group - select the security group that will be used by all worker instances in the server array.
  • Deployment - select a deployment for the server array.  (A deployment can have more than one server array.)
  • Default min count - the minimum number of worker instances that must be operational in the server array. You can set this value to zero to avoid idle server usage costs.  But, if you have time-sensitive tasks that need to be processed immediately, you might want to use a value of at least one worker instance.  Default = 1
  • Default max count - the maximum number of worker instances that can be operational at any given time in the server array. Default = 20
  • Elasticity function - defines how the server array should grow/shrink. Select sqs_item_age
  • Elasticity params - defines the elasticity parameters that will be used to determine when a server array should be resized.
    • Max age - defines the threshold (in seconds) before a resize action occurs on the server array. (i.e. If an item's age is greater than or equal to the "max age," a new instance will be launched.) An item's age is determined by the Algorithm variable (max_10 or avg_10).
    • Regexp - each job task receives a timestamp when it's added to the queue.  The timestamp is used to determine an item's "age" in the queue.  The Regexp (regular expression) defines how a job task's timestamp should be read.  Messages must include a timestamp that follows the same syntax that you define in the Regexp field.  It needs to contain a parenthesized sub-expression that, when matched, can be parsed as a date/time.
      • Copy and paste /created_at=(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d UTC)/ into the field to follow the RightGrid setup.
      • Example: Sept 14, 2008 at 2:50:30pm would be written as,
                       /created_at=(\2\0\0\8-\0\9-\1\4 \1\4:\5\0:\3\0 UTC)/
    • Algorithm -  defines how an item's age will be determined, either by the average age or max (oldest) age.  Default: "avg_10"
      • max_10 -  the maximum age of 10 items in the queue.  It will look for the oldest item in the sample.
      • avg_10 - the average age of 10 items in the queue.
    • Resize by - the number of instances that should be added/removed from a server array when a resize action occurs. Default = 1.
    • Resize calm time - the time (in minutes) that must pass before another action can be taken on the server array.  This variable helps prevent an array from being resized too frequently. Default = 5.
  • Indicator - select the input SQS queue that contains all of the job tasks.
  • Audit - (optional) select the audit SQS queue that will store audit entries.

 

Example 1

Currently, only one worker instance is running.  A set of jobs was just added to the SQS input queue.  Based on the elasticity parameters below, the server array will add 2 additional servers once an item (out of a sample of 10) has been in the SQS input queue for 30 seconds or longer.  After 2 new servers have been launched, the server array must wait 10 minutes before it's allowed to resize again.

Max age: 30
Algorithm: max_10
Resize by: 2
Resize calm time: 10 min

Example 2

Currently, there are 5 worker instances running.   Based on the elasticity parameters below, the server array will add an additional server if the average age of 10 items in the SQS input queue is equal or greater to 2 minutes.  After a new server is launched, the server array must wait 5 minutes before it's allowed to resize again.

Max age: 120
Algorithm: avg_10
Resize by: 1
Resize calm time: 5 min

Tag page
You must login to post a comment.