GCP locations configuration

Private Locations on your GCP account.

Instance specifications

We recommend that you use for your own load generator instances with at least 4 cores.

As Gatling load tests tend to be CPU bound, we recommend using instances of the “Compute Optimized” family.

As a result, we recommend using c3-highcpu-4 instances or larger.

You might want to tune the Xmx JVM options to half of the physical memory. See jvm-options configuration below. If you don’t, the JVM will use a max heap size of 1/4th of the physical memory.

Permissions

GCP private locations require the control plane to have GCP access rights configured in order to instantiate virtual machines.

GCP private locations require the control plane to have credentials configured in order to instantiate virtual machines and associated resources.

Access rights can be set through a service account associated with your control plane.

Check GCP and Gatling documentation pages for more details:

System requirements

GCP private locations rely on some dependencies.

So when using a custom image, make sure following are available:

Control plane configuration file

control-plane {
  # Control plane token
  token = "cpt_example_c7oze5djp3u14a5xqjanh..."
  # Control plane token with an environment variable
  token = ${?CONTROL_PLANE_TOKEN}
  # Control plane description (optional)
  description = "my control plane description"
  # Locations configurations
  locations = [
    {
      # Private location ID, must be prefixed by prl_, only consist of numbers 0-9, 
      # lowercase letters a-z, and underscores, with a max length of 30 characters
      id = "prl_private_location_example"
      # Private location description (optional)
      description = "Private Location on GCP"
      # Private location type
      type = "gcp"
      # GCP location name, as listed by GCP CLI:
      # gcloud compute zones list
      zone = "europe-west3-a"
      # Instance template (alternative to machine)
      # instance-template = "example-template"
      # Machine configuration (alternative to instance template)
      machine {
        # Virtual machine type, as listed by GCP CLI:
        # gcloud compute machine-types list --filter="zone:( europe-west3-a )"
        type = "c3-highcpu-4"
        # Configure load generators instances as preemptible or not. (optional, default: false)
        # preemptible = true
        # Certified image configuration
        image {
          type = "certified"
          java = "latest" # Possible values : 11, 17, 21 or latest
        }
        # Storage configuration
        disk {
          # Disk size in Gb (mininum 20Gb)
          sizeGb = 20
        }
        # Network interface (optional)
        network-interface {
          # Network name on your project (optional)
          # Not needed if subnetwork is configured
          # network = "gatling-network"
          # Subnetwork name on your project (optional)
          # subnetwork = "gatling-subnetwork-europe-west3"
          # Associate external IP to instance (optional, default to true)
          # See Cloud NAT when set to false
          # with-external-ip = true
        }
      }
      # GCP project id as returned by GCP CLI:
      # gcloud projects list
      project = "my-project-id"
      # Java configuration (the following configuration properties are optional)
      # System properties (optional)
      system-properties {
        "java.net.preferIPv6Addresses" = "true"
      }
      # Overwrite JAVA_HOME definition (optional)
      # java-home = "/usr/lib/jvm/zulu"
      # JVM Options (optional)
      # Default ones, that can be overridden with precedence:
      # [
      #   "-XX:MaxInlineLevel=20", 
      #   "-XX:MaxTrivialSize=12", 
      #   "-XX:+IgnoreUnrecognizedVMOptions", 
      #   "--add-opens=java.base/java.nio=ALL-UNNAMED", 
      #   "--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"
      # ]
      #  Based on your instance configuration, you may want to update Xmx and Xms values.
      # jvm-options = ["-Xmx4G", "-Xms512M"]
    }
  ]
}

Internet access for your Load Generators instances

Cloud NAT (Network Address Translation) lets certain resources in Google Cloud create outbound connections to the internet or to other Virtual Private Cloud (VPC) networks. Cloud NAT supports address translation for established inbound response packets only. It does not allow unsolicited inbound connections.

More info on Cloud NAT overview.

Instances with no external IP

An instance without an external IP cannot access to internet without a Cloud NAT configured on the network, for the region. Load generators must have access to some outbound domains in order to run (see Private locations introduction).

In the GCP management console, open the Cloud NAT (or search for “Cloud NAT” in the search bar).

Set the Gateway:

  • name
  • region base on your location zone
  • create a router

Gateway configuration
Router configuration

Set static IPs

Cloud NAT gateway can be configured with static IP addresses. See limits of concurrent connections with Cloud NAT on Cloud NAT port reservation and make sure to provide enough static IP addresses based on the load you need to generate.

Static IP configuration

Edit this page on GitHub