Deploy Dockerized load generators on Linux

This section describes how to run a Dockerized load generator on a Linux distribution.

For supported protocols on Dockerized load generators, see Supported Protocols.

Prerequisites

Note: The Ubuntu image for the OneLG load generator replaces the previous Ubuntu load generator docker image.

For information on OneLG, seeLoad generators.

  • Install Docker on the target machine, along with its dependencies, and set up the target machine environment as required. Currently, only the 64-bit version is supported. For installation details, see the Docker online documentation.

  • Obtain the predefined load generator Docker image. Two images are available for Linux: Ubuntu and RHEL.

    Pull the image from the from the relevant page, accessible from the performance testing page (https://hub.docker.com/u/performancetesting) in the Docker hub.

    Use one of the following commands and appropriate <tag version number>, for example, 24.1:

    Ubuntu

    docker pull performancetesting/opentext_onelg_ubuntu:<tag version number>

    RHEL

    podman pull performancetesting/opentext_onelg_rhel:<tag version number>

Back to top

Run a Dockerized load generator using the predefined image

Use the ready-to-use image to run a load generator on Docker for Linux. If you need customization for your container, for example, for proxy servers, see Run a Dockerized load generator using a custom image.

To run the Ubuntu OneLG image, the appropriate environment variable must be included in the run command: ONELG_FLAVOR=1

In addition, you can use the following environment variables to enable JMeter and Gatling on the load generator, if required:

  • ENABLE_JMETER
  • ENABLE_GATLING

To run a Dockerized load generator:

Run the load generator container using the appropriate command for Ubuntu or RHEL (to enable Gatling or JMeter, include the bold variables).

Check that the <host_port> on the Linux machine is available and allows incoming requests. You specify this port on the Controller side when connecting to this load generator.

  • Ubuntu:

    docker run -id -p <host_port>:54345 -e "ONELG_FLAVOR=1" -e "ENABLE_GATLING=1" -e "ENABLE_JMETER=1" --net=host performancetesting/opentext_onelg_ubuntu:<tag version number>

  • RHEL:

    podman run -id -p <host_port>:54345 -e "ENABLE_GATLING=1" -e "ENABLE_JMETER=1" performancetesting/opentext_onelg_rhel:<tag version number>

Example using SSH

The following gives a simple C# code example for running multiple load generator containers using SSH. There are container orchestrator tools which do the same, for example, Kubernetes, OpenShift, Docker Swarm.

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 -e "ONELG_FLAVOR=1" --net=host performancetesting/opentext_onelg_ubuntu:<tag version number>";
	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.");
  }
   client.Disconnect();
}

Back to top

Run a Dockerized load generator using a custom image

If your environment requires customized settings for running the container, for example for proxy servers, you can follow the procedure below to create a Dockerfile to build a custom image.

Alternatively, you can do the following: Start the container; once it is running, set up the load generator environment variables, then start the load generator manually inside the container.

To create a Dockerfile to run a custom Dockerized load generator:

  1. Create a new folder, and within it create a file named dockerfile. Paste the FROM line, plus the required customization lines, into the file, using the appropriate OpenText Professional Performance Engineering version for the <tag version number>.

    For example, for Ubuntu:

    FROM performancetesting/opentext_onelg_ubuntu:<tag version number>
    ENV http_proxy http://my_proxy_name:port

    Note: The above customization example is for a proxy. It defines an environment variable for the proxy server host and port in the target image.

  2. Save dockerfile.

  3. Open a command line at the dockerfile folder path and run the following command, using the name you want for your custom image:

    Linux-Ubuntu:

    docker build -t <custom image name> .

    RHEL:

    podman build -t <custom image name> .

  4. Create a container for each load generator you want to use, by running the following command:

    Ubuntu:

    docker run -id -p <host_port>:54345 -e "ONELG_FLAVOR=1" --net=host <custom image name>

    RHEL:

    podman run -id -p <host_port>:54345 <custom image name>

    If the custom image in step 3 was built with a tag then include it in the command, for example:

    docker run -id -p <host_port>:54345 -e "ONELG_FLAVOR=1" --net=host <custom image name>:<tag version number>

    Note: Check that the <host_port> on the Linux machine is available and allows incoming requests. You specify this port on the Controller side when connecting to this load generator.

Back to top

After running the load generator containers

Add the load generators containers to scenarios. For details, see Configure Dockerized load generators.

Back to top

Tips and guidelines

  • Dockerized load generators that are run from the predefined image are not supported when running over a firewall. (Workaround for advanced users: You can develop your own Docker image with MI Listener support.)

  • Use docker ps to list the containers that are running.

  • To stop the load generator service:

    • Use docker stop <load generator container name or ID> if you want to reuse the same load generator.

    • Use docker rm -f <load generator container name or ID> in order to remove the load generator container.

  • The Dockerfile container has an ENTRYPOINT section. The container first runs the commands in ENTRYPOINT. It sets up the environment and then starts the load generator. The command uses a While loop to wait for input, in order to keep the container from exiting. This behavior prevents you from accessing the container while it is running. Make sure to add -i while starting the container; otherwise the While loop will consume an excessive amount of CPU.

  • If you need entry into the container, add an argument such as --entrypoint=/bin/bash when starting the container. After entering the container, set the load generator environments and start the load generator . You can then switch to the host using CTRL+p and CTRL+q while keeping the container running in the background. To access the container again, use the docker attach container_id command.

  • To access the host network directly, use --net=host in place of -p <host_port>:54345. We recommend you use this flag if the AUT generates a lot of network activity.

Back to top

See also: