Dockerized Load Generators

This section describes how to install and run load generators on a Linux platform using Docker.

Note:  

  • Load generators are only supported on Linux-based Docker containers.

  • Dockerized load generators are not supported when monitoring over a firewall.

Benefits of dockerized load generators

Docker is a platform that allows you to develop, ship, and run applications via a container. Docker uses a standard container format that lets developers prepare applications inside containers, while system administrators and other teams, such as Quality Assurance engineers, run the container in order to deploy the application. For details regarding Docker, see https://docs.docker.com.

Using dockerized load generators:

  • Enables you to automate the testing process by provisioning and de-provisioning load generators on demand, and seamlessly add them to performance tests using the REST API.

  • Saves having to rely on (and manage) load generators defined in the lab, and the need to reserve load generators in advance.

Back to top

Automatically add dockerized load generators to tests using the REST API

  1. Prerequisites

    Make sure Docker is installed on a Linux environment, and that iptables is running on your system.

  2. Obtain the Dockerfile image

    Locate the base load generator image. Use the image provided on the DVD (in the InsData folder of the ISO file) or obtain one from the Docker hub.

    1. Create Docker containers

      Create a Docker container for each load generator you want to add to the test by running the following command (make sure you select an initial port number for each load generator):

      docker run -id -p <host_port>:54345 performancetesting/load_generator

      Example:

      using (var client = new SshClient(dockerHost, dockerHostUserName, dockerHostPasswd))
      {
        client.Connect();
        for (int i =0; i > numOfContainers; i++)
        {
      	string command = "docker run -id -p " + lgInitialPort + i) + "54345 performancetesting/load_generator";
      	var terminal = client.RunCommand(command);
      	if (terminal.ExistStatus != 0)
      	{
      	throw new Exception("Failed to create new Docker container");
      	}
      	Console.WriteLine("Docker LG with external port" + lgInitialPort + i + "created.");
        }
        //var output terminal.Result;
        client.Disconnect();
      }

      Note: If you do not have internet access from the load generator machine, you can download the Load Generator image from the HPE Performance Center installation DVD by clicking Download Docker Image.

  3. Add Dockerized load generators to the Performance Center Hosts list

    1. Authenticate the user to the Performance Center Administration REST API by sending an HTTP GET request to the following URL:

      http://<Performance Center server>/Admin/rest/authentication-point/authenticate

      Example: GET /Admin/rest/authentication-point/authenticate

      For API details, see Authenticate in the Performance Center Administration REST API Guide.

    2. Add a load generator to each Docker container using the Get Hosts API, and configure the host settings as follows:

      • For host name, enter the physical name of the host followed by _dkr_<lgInitialPort>, where <lgInitialPort> is the initial port that is mapped to the Docker container (see step 2).

        Example: myHost_dkr_10110

      • Add the container as a Unix installation, with LoadGenerator purpose.

        Request example:

      For API details, see Add Host in the Performance Center Administration REST API Guide.

      The Dockerized load generators are added the Hosts list.

  4. Run the performance test

    1. Prerequisites

      Make sure you have created a performance test, and configured it to use non-specific (automatch) load generators. You can also use specific load generators, but then you need to update your test to use those load generators (this can be done using tests/{ID} in the Performance Center REST API Guide).

      You can create a test either from the Performance Center Administration REST API (see tests in the Performance Center REST API Guide), or manually from the Performance Center user interface (see How to Design a Performance Test).

    2. Run the performance test from the Performance Center REST API (see Start a Test Run in the Performance Center REST API Guide).

  5. Gather results

    When the performance test has finished running, collate (and analyze) performance test data using the REST API. For API details, see collate and analyze in the Performance Center REST API Guide.

  6. Remove the load generators from the test - optional

    Note: Make sure you collate the results for any load generators you intend to remove from the test before you delete them.

    1. Remove the load generators from the test using the hosts/{hostID} API. For API details, see hosts/{hostID} in the Performance Center Administration REST API Guide.

    2. Delete all Docker containers by running the following command:

      "docker rm -f $(docker ps -a -q)";

Back to top

Manually add a dockerized load generator to a test

  1. Prerequisites

    Before you can add a dockerized load generator, the load generator image must be installed as a Docker container. For details, see the HPE Performance Center Installation Guide.

  2. In Performance Center Administration, select Management > Hosts.

  3. Select the Hosts tab, and then click Create New Host.

  4. Configure the host settings as follows:

    • Host Name. Enter the physical name of the host followed by _dkr_<port_number>, where <port_number> is the port that is mapped to the Docker container.

      Example: myHost_dkr_10110

    • Purpose. Select Load Generator only.

    • Installation. Select Unix Load Generator.

  5. Click Save to add the host to the Hosts grid.

Back to top

Notes and Limitations

If Security-Enhanced Linux (SELinux) is enabled on your Linux operating system, it can prevent Docker containers from loading the required load generator libraries.

Workaround: Contact your IT department to configure SELinux so that it will still be effective while letting the load generators load the required libraries for them to operate.

Back to top