Skip to content

Amazon EC2 for Load Generation

Sayantam Dey edited this page Aug 28, 2017 · 1 revision

Introduction

This guide will walk you through the steps for setting up a basic EC2 cluster for load generation. You will also find information on setting up multiple clusters. You must be signed up for an Amazon Account to follow this guide, keep your AWS access and secret keys handy.

Add the keys to the configuration file along with cluster information:

Hailstorm.application.config do |config|
  config.clusters(:amazon_cloud) do |cluster|
    cluster.access_key      = 'AKIAJND7YTD66QBBY3FA'
    cluster.secret_key      = 'B+{Kr;<^Cxt:(Z*4>Bc4#z%r7Kdd9&J(?cwa}{7@' # this is just a sample
    cluster.region          = 'us-east-1'
  end
end

With the configuration above, we have added our cluster to the performance application.

Currently, known regions are: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, eu-west-2, ap-northeast-1, ap-southeast-1, ap-southeast-2, ap-northeast-2, ap-south-1, sa-east-1.

Optional Configuration

Other useful options.

Adding more Clusters

You can add more clusters by adding config.clusters blocks and modifying the cluster properties. For example, the following configuration uses 2 clusters and generates load simulataenously from different regions:

Hailstorm.application.config do |config|

  config.clusters(:amazon_cloud) do |cluster|
    cluster.access_key      = 'AGIAJNC7YTD65RBBY3FA'
    cluster.secret_key      = 'B+{Kr;<^Cxt:(Z*4>Bc4#z%r7Kdd9&J(?cwa}{7@' # this is just a sample
    cluster.region          = 'us-east-1'
  end

  config.clusters(:amazon_cloud) do |cluster|
    cluster.access_key      = 'AMIAJNC7YTD65QBBT3FA'
    cluster.secret_key      = 'B+{Kr;<^Cxt:(Z*4>Bc4#z%r7Kdd9&J(?cwa}{7@' # this is just a sample
    cluster.region          = 'us-west-1'
  end
end

Disable a Cluster

If you wish to disable a cluster temporarily, you can do using the active property. Set it to false to deactivate the cluster. This cluster will not be used for load generation activities.

Hailstorm.application.config do |config|
  config.clusters(:amazon_cloud) do |cluster|
    cluster.access_key      = 'ALIAJND7YTD65QBBY3FA'
    cluster.secret_key      = 'B+{Kr;<^Cxt:(Z*4>Bc4#z%r7Kdd9&J(?cwa}{7@' # this is just a sample
    cluster.region          = 'us-west-1'
    cluster.active          = false # can be either true or false
  end
end

Specify Instance Type

The default instance type used by the application is m3.small. You can use a different instance type by using the instance_type property:

Hailstorm.application.config do |config|
  config.clusters(:amazon_cloud) do |cluster|
    cluster.access_key      = 'AKIAJNC7YTD65QBBY3FA'
    cluster.secret_key      = 'B+{Kr;<^Cxt:(Z*4>Bc4#z%r7Kdd9&J(?cwa}{7@' # this is just a sample
    cluster.region          = 'us-west-1'
    cluster.instance_type   = 'c1.xlarge'
  end
end

All instance types except HVM cluster compute instances are supported. Hailstorm tries to guess a suitable number of threads per instance based on instance_type.

Override Number of Threads per Instance

You can override the maximum number of threads per instance using the cluster.max_threads_per_agent property. If you want Hailstorm to generate more threads than this, Hailstorm will create more instances and distribute the load evenly.

Hailstorm.application.config do |config|
  config.clusters(:amazon_cloud) do |cluster|
    cluster.access_key  = 'AKIAJOJXFXNVQTJR7NQA'
    cluster.secret_key  = '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'
    cluster.region      = 'us-east-1'
    cluster.max_threads_per_agent = 25
  end
end

Explicit Availability Zone

You can configure an explicit availability cluster.zone by using the zone property. This is however not recommended since the application queries for an available zone and sets it automatically.

Explicit SSH Identity/Key Pair

If for some reason, you'd wish to use an existing key pair configured externally in EC2, you can use the cluster.ssh_identity property. Set this to the key pair name. You additionally need to ensure the private key file is present in the config directory and file name matches the pattern - $key_pair_$region.pem. This is not recommended; you should let the application create and download the key-pair automatically.