Using the Load Tester

In this section, we show you how to execute a load test on Run the DirectX Sample. You need two clusters to run the sample: One cluster runs the Genvid stack and the other executes the load test. Note that the load tester can also be run locally for development purpose.

See The AWS Cloud Environment for information about running your game in the cloud.


If you deploy your Run the DirectX Sample in The Azure Cloud Environment, it is recommended to deploy your cluster with the SDK-{version}/basic/azurerm_basic_cluster_alb_ssl module. The basic/azurerm_basic_cluster_alb_ssl module supports load balancing, DNS, and SSL certificates.

This application sends metrics to statsd. You can use the TICK Stack Metrics to collect and see them.

Before You Begin

Although you can run the application locally for testing, we assume that you will run the load test on the cloud. We will use the Run the DirectX Sample for this demonstration. See Building the DirectX Sample for the Cloud for more information on how to deploy this sample on the Cloud.

Edit the Configuration File

If you’re doing load testing, you have likely set up your system to have a public entry point, either through a load balancer or a similar configuration. You can setup your client to use the right configuration either by modifying the Configuration file, or if you are using a more complex login protocol, by modifying the basic_session function in the app/src/cube_client.ts source file. For example, in the cube sample, we have the following code:

  // Starts the connection to the services
  start() {
    fetch("/api/public/channels/join", {
      method: "POST",
      .then((data) => data.json())
      .then((res) => {
        if ( === "Error") {
          genvid.error(`Failed getting stream info: ${res.message}. Retrying in ${this.fiboStartIterator.get()} seconds...`);
          setTimeout(() => {
          }, this.fiboStartIterator.get() * 1000);
        } else {
      .catch((error) => genvid.error(`Can't get the stream info: ${error}`));

which fetch the URL /api/public/channels/join on the web server. In the cube_client.ts, we are using the value of the custom.loadtester.join_url configuration key, which is set by default to point to a localhost. It should instead point to the public URL of your join call.

Create the Test Cluster

The first step is to create a cluster to run your test clients. Although you could run the sample on the same cluster as your game, we recommend to do it in a different cluster, even on a different region. There will be additional costs associated with the load test activity but your results may be more representative of an actual game experience.

We will use the basic_cluster cluster module for this but will only use the server and internal instances.

  1. Go to Bastion UI and create a cluster using the basic/basic_cluster module. Let call it loadtest for this demonstration.

  2. Click the infrastructure link. (You can keep the default settings for now.)

  3. Click on the Settings menu.

# Set the instance_game_count, instance_encoding_count and instance_public_count to 0.

# Select a bigger instance for instance_internal_type, like t2.large and increase instance_internal_count

if needed, depending on how many load tester instances you want to run.

  1. Click on the Commands menu.

  2. Click Plan Apply, and if the result is good, Apply, and wait until it is done.

Initialize the Load-Test Cluster

It is now time to configure the test cluster. First, just initialize the cluster:

genvid-sdk -c loadtest setup

Note that you don’t need to run the genvid-sdk load-config-sdk command on this cluster since it will not run the SDK, only the loadtester client. Next, you can build and load the load tester client.

py prepare                   # Install the genvid.js library and run npm install
py build-cloud
py -c loadtest upload-images --update-config
py -c loadtest load


It is also recommended that you install a metric aggregation stack to collect the metrics on both clusters. You can use TICK Stack Metrics as a starting point:

py -c testcluster load

Run the Load-Test

You run the load tester by running this command:

genvid-sdk -c loadtest start

All jobs will be started but if you look at the Cluster UI’s Jobs screen, you will see that the loadtester job is dead. This is because its tasks count is 0. You can augment it manually from the UI or run the follow command:

genvid-sdk -c loadtest set-taskgroup-count --step 1 --interval 5 loadtester 3

The --step is the number of new tasks to spawn at a time, the --interval is the interval in seconds between each step. After that came the task name (loadtester) and the target count. See the genvid-sdk tool for more information.


The number of loadtester you can run depends on the resources available on your clusters. If you can start more, try adding more internal instances to your loadtest cluster, or use bigger instances.