Share this page

# 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.

In this topic:

## Prerequisites

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

  docker pull performancetesting/opentext_onelg_rhel:<tag version number>

## 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:

  docker 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();
    }

## 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:

   docker 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:

   docker 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.

## Build Ubuntu Docker image to run TruClient 2.0

To run TruClient 2.0 scripts on Docker on-premises load generators, you must install the Chrome or Edge browser manually, and then build your own customized Ubuntu OneLG image using the Dockerfile sample below.

To build an Ubuntu Docker image to run TruClient 2.0:

1. Create a new folder, and within it create a file named dockerfile.

2. Copy the following text to the dockerfile file:

   Copy code

       FROM performancetesting/opentext_onelg_ubuntu:<tag version number>
       USER root
       RUN apt-get update \
       && apt install wget -y \
       && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
       && apt install fonts-liberation libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcurl3-gnutls libdrm2 libgbm1 libgtk-3-0 libpango-1.0-0 libu2f-udev libvulkan1 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 xdg-utils -y \
       && dpkg -i google-chrome-stable_current_amd64.deb \
       && rm google-chrome-stable_current_amd64.deb \
       && apt update \
       && apt upgrade -y \
       && apt --fix-broken install \
       && apt install software-properties-common apt-transport-https curl ca-certificates -y \
       && curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /usr/share/keyrings/microsoft-edge.gpg > /dev/null \
       && echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-edge.gpg] https://packages.microsoft.com/repos/edge stable main' | tee /etc/apt/sources.list.d/microsoft-edge.list \
       && apt update \
       && apt install microsoft-edge-stable

3. Save the file.

4. In the FROM line, replace <tag version number> with the appropriate Ubuntu One LG image tag, for example, 26.3.

5. Run the following command:

   `sudo docker build -t <custom image name>`

Note: If the Chrome installation needs a dependency, add libasound2t64 in line 6 as follows:

`&& apt install fonts-liberation libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcurl3-gnutls libdrm2 libgbm1 libgtk-3-0 libpango-1.0-0 libu2f-udev libvulkan1 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 xdg-utils libasound2t64 -y \`

## After running the load generator containers

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

## 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.

## See also

- Install a load generator
- Prepare for installation

https://admhelp.microfocus.com Professional Performance Engineering,VuGen 8942
Tips to improve your search results... OpenText™ Professional Performance Engineering Help Center OpenText™ Professional Performance Engineering Help 26.1-26.3 All View Local Help Center View Online Help Center Version: