> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/resilience-testing/load-testing/harness-managed-infrastructure.md).

# Harness-Managed Infrastructure

Run load tests on Kubernetes infrastructure that Harness provisions and manages, without installing an agent or connecting your own cluster

{% hint style="info" %}
This feature is in Beta[^1] and requires enablement. [View all early access features.](https://developer.harness.io/release-notes/features.md)

{% @harness-feature-flag-access/request-feature-flag-access module="resilience-testing" pagePath="resilience-testing/load-testing/harness-managed-infrastructure" pageTitle="Harness-Managed%20Infrastructure" featureFlags="%5B%7B%22name%22%3A%22Harness-managed%20infrastructure%20for%20load%20tests%22%2C%22key%22%3A%22CHAOS\_LOAD\_MANAGED\_INFRA\_ENABLED%22%2C%22status%22%3A%22BETA%22%2C%22description%22%3A%22Adds%20a%20Harness-managed%20infrastructure%20option%20to%20the%20Load%20Test%20Studio%2C%20so%20a%20load%20test%20runs%20on%20Kubernetes%20infrastructure%20that%20Harness%20provisions%20and%20manages%20instead%20of%20infrastructure%20you%20connect.%22%7D%5D" %}
{% endhint %}

**Harness-managed infrastructure** runs your load test on Kubernetes infrastructure that Harness provisions, operates, and cleans up for you. You do not install a chaos agent, connect a cluster, or onboard a service before your first run. Select the option when you create a load test, then click **Run**.

***

## What you will learn from this topic

* **When to use it:** How Harness-managed infrastructure compares with self-hosted infrastructure.
* **How to use it:** Create and run a load test on Harness-managed infrastructure.
* **What to expect:** How Harness prepares the infrastructure, what it creates in your project, and when it cleans up.
* **Limits:** The quotas that apply to Harness-managed runs and what to do when a run reaches one.

***

## Before you begin

* **Load Testing enabled:** Load Testing is behind a feature flag (`CHAOS_LOAD_TESTING_ENABLED`). Go to [Get started with Load Testing](https://developer.harness.io/resilience-testing/load-testing/get-started.md) to create your first load test.
* **Harness-managed infrastructure enabled:** The option appears in the Load Test Studio only when it is enabled for your account.
* **Reachable target:** An application endpoint that accepts traffic from a Harness-hosted Kubernetes cluster.

{% hint style="info" %}
**Contact Harness Support**

If **Harness-managed infrastructure** does not appear under **Execution Environment** in the Load Test Studio, contact your account administrator or [Harness Support](mailto:support@harness.io) to enable it for your account.
{% endhint %}

***

## Choose between managed and self-hosted infrastructure

Every load test runs on one of two kinds of infrastructure. You select the kind on the **Overview** tab of the Load Test Studio, under **Execution Environment** > **Infrastructure**.

| Infrastructure                     | Who runs it                                                                    | What you set up first                                             | Best for                                                                                     |
| ---------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **Harness-managed infrastructure** | Harness provisions and manages Kubernetes infrastructure for your project.     | Nothing. Harness prepares the infrastructure on the first run.    | Getting started quickly, and testing endpoints that are reachable from outside your network. |
| **Self-hosted infrastructure**     | You connect a Kubernetes cluster or Linux VM to Harness through a chaos agent. | A chaos infrastructure, an environment, and an onboarded service. | Testing private endpoints, running on Linux VMs, and controlling where the load comes from.  |

Harness-managed infrastructure always runs on Kubernetes, so the Python, JavaScript, and Java engines are all available. Go to [Load testing key concepts](https://developer.harness.io/resilience-testing/load-testing/key-concepts.md#load-test-infrastructure) to compare the Kubernetes and Linux VM target types for self-hosted infrastructure.

{% hint style="info" %}
**Load comes from a Harness-hosted cluster**

On Harness-managed infrastructure, the virtual users run in a Kubernetes cluster that Harness hosts, not inside your network. Test endpoints that the internet can reach. To test an endpoint that is reachable only from your private network, use self-hosted infrastructure.
{% endhint %}

***

## Create a load test on Harness-managed infrastructure

Harness-managed infrastructure is the default for a new load test when it is enabled for your account. The following steps create a test and run it.

{% stepper %}
{% step %}

### Open the Load Test Studio

In your project, go to **Load Tests**, then select the **Load Tests** tab. Click **New Load Test**, then select **Create from scratch**.

You can also select one of the sample tests from the same menu. A sample test starts on Harness-managed infrastructure too.
{% endstep %}

{% step %}

### Select Harness-managed infrastructure

On the **Overview** tab, enter a **Name** for the test. Under **Execution Environment**, select the **Harness-managed infrastructure** card if it is not already selected.

![The Execution Environment section of the Load Test Studio with the Harness-managed infrastructure card selected next to the Self-hosted infrastructure card](https://3217710372-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRmV5EkLS9r45VPaoUnJZ%2Fuploads%2Fgit-blob-fe7244a035ec56b2c83dcccd7c894aed9adefb78%2Fmanaged-infra-studio-infrastructure.png?alt=media)

When Harness-managed infrastructure is selected, the Studio hides the **Target Type**, **Load Test Infrastructure**, and **Services** fields. Harness chooses the infrastructure, and the test does not need an onboarded service.
{% endstep %}

{% step %}

### Select an engine and configure the test

Select a **Load Test Engine**, then click **Next**. On the **Test Configuration** tab, define the workload and the **Load Configuration** exactly as you would for self-hosted infrastructure. Keep the **Users**, **Duration**, and **Worker Count** within the [limits](#limits) for Harness-managed runs.

Go to [Create a Load Test](https://developer.harness.io/resilience-testing/load-testing/create-a-load-test.md) to configure the Python, JavaScript, or Java engine.
{% endstep %}

{% step %}

### Save and run the test

Click **Save**, then click **Run**. Harness opens the run page and starts to prepare the infrastructure.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**The infrastructure choice is fixed after you save**

You cannot switch a saved load test between Harness-managed and self-hosted infrastructure. When you edit the test, the other card is disabled. To run the same workload on the other kind of infrastructure, create a new load test.
{% endhint %}

***

## Watch Harness prepare the infrastructure

Before the load starts, the run page shows a **Preparing infrastructure** panel in place of the charts. A progress ring shows how far preparation has gone, and the panel moves through three steps:

* **Connecting execution agent:** Harness connects the execution agent that runs load tests for your account.
* **Preparing project environment:** Harness creates the environment and infrastructure that your project uses for load tests.
* **Ready to run:** The infrastructure is ready. The load test starts automatically.

![The Preparing infrastructure panel at 48 percent, with Connecting execution agent completed, Preparing project environment in progress, and Ready to run not started](https://3217710372-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRmV5EkLS9r45VPaoUnJZ%2Fuploads%2Fgit-blob-40b788586051c30d5ef5adc1ea858211c0604ed3%2Fmanaged-infra-preparing.png?alt=media)

How long preparation takes depends on whether your project already has infrastructure that is ready:

* **First run, or first run after 24 hours without use:** Preparation takes a few minutes, because Harness sets up the infrastructure for your project.
* **Later runs:** The infrastructure is already ready, so the load test starts almost immediately.

If you click **Stop** while Harness prepares the infrastructure, the run moves to **Stopped**. Harness does not tear down the infrastructure, so the next run can use it.

### Review the run

When preparation finishes, the panel is replaced by the run metrics. The **Load Test Infrastructure** field shows **Harness Chaos Sandbox**, the infrastructure that Harness manages for your project.

![A running load test on Harness-managed infrastructure, with Load Test Infrastructure set to Harness Chaos Sandbox and the Summary and Active Users chart reporting live results](https://3217710372-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRmV5EkLS9r45VPaoUnJZ%2Fuploads%2Fgit-blob-7ea92781250c55a324a82a1210e23f8c0b571c3c%2Fmanaged-infra-run-in-progress.png?alt=media)

From here, the run behaves like any other load test. Go to [Analyze Load Test Results](https://developer.harness.io/resilience-testing/load-testing/analyze-results.md) to read the metrics, endpoint statistics, and threshold outcomes.

When a run fails during preparation, the panel title changes to **Infrastructure preparation failed** and the page shows the error code and message at the top. Go to [Troubleshooting](#troubleshooting) to resolve the error.

***

## What Harness creates in your project

On the first run in a project, Harness creates the resources it needs in that project. Each resource uses the identifier `harness_chaos_sandbox`:

* **Environment:** An environment named **Harness Chaos Sandbox**.
* **Kubernetes connector:** The connector that points at the Harness-hosted cluster.
* **Infrastructure definition:** The infrastructure definition in that environment.
* **Chaos infrastructure:** The infrastructure that load tests run on.

![The project Environments list showing the Harness Chaos Sandbox environment with the identifier harness\_chaos\_sandbox](https://3217710372-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRmV5EkLS9r45VPaoUnJZ%2Fuploads%2Fgit-blob-82f892f0df728c23af594973d2beec0a5deb72fb%2Fmanaged-infra-environment.png?alt=media)

Harness owns these resources. You cannot modify or delete the chaos infrastructure; Harness rejects the change with the message `this infrastructure is managed by Harness and cannot be modified or deleted`. Do not edit or delete the environment, connector, or infrastructure definition either, because Harness-managed runs in the project depend on them.

The **Harness Chaos Sandbox** environment does not appear in the environment pickers for chaos experiments. It exists only to run load tests.

### Idle cleanup

When no load test uses the project's Harness-managed infrastructure for 24 hours, Harness tears the infrastructure down. The **Harness Chaos Sandbox** environment stays in your project. The next run prepares the infrastructure again, which takes a few minutes.

***

## Limits

Harness applies the following limits to Harness-managed infrastructure. When a run reaches a limit, Harness does not start it. The run fails with the error code `E2019: MANAGED_INFRA_LIMIT_REACHED` and a message that names the limit.

| Limit                                         | Default        | What to do when a run reaches it                                                                                                                          |
| --------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Virtual users per run                         | 5,000          | Lower **Users**, then run the test again.                                                                                                                 |
| Run duration                                  | 10,000 seconds | Shorten **Duration**, then run the test again.                                                                                                            |
| Workers per run                               | 20             | Lower **Worker Count**, then run the test again.                                                                                                          |
| Concurrent runs per project                   | 5              | Wait for a run in the project to finish, or stop one.                                                                                                     |
| Concurrent runs per account                   | 20             | Wait for a run in the account to finish, or stop one.                                                                                                     |
| Total workers across an account's active runs | 100            | Wait for a run to finish, or use fewer workers.                                                                                                           |
| Projects per account                          | 10             | Each project that has Harness-managed infrastructure counts toward this limit. A project stops counting after idle cleanup tears down its infrastructure. |
| Infrastructure preparation timeout            | 900 seconds    | A run that is still preparing after 15 minutes fails with `E2021`. Run the test again.                                                                    |
| Idle cleanup                                  | 24 hours       | Not a quota. Harness tears down unused infrastructure after this time.                                                                                    |

Harness also caps overall capacity for Harness-managed infrastructure: up to 50 accounts can use it, and each Harness-hosted cluster serves up to 200 projects. When no cluster has room for your project, the run fails with `E2017`.

{% hint style="success" %}
**Raise a limit for your account**

Harness can raise these limits for an account. Contact [Harness Support](mailto:support@harness.io) with the limit you need and the reason.
{% endhint %}

***

## Limitations

The following scenarios are not supported on Harness-managed infrastructure.

{% hint style="info" %}
**Unsupported scenarios**

* **Linux VM:** Harness-managed infrastructure runs on Kubernetes only.
* **Load test templates:** A load test template does not offer the Harness-managed infrastructure option.
* **Private endpoints:** The virtual users run in a Harness-hosted cluster, so they cannot reach an endpoint that is available only inside your network.
* **Custom image registries:** Image registry settings that you configure at the account, organization, project, or infrastructure level do not apply. Harness uses its own default images.
* **Switching infrastructure:** You cannot change a saved test between Harness-managed and self-hosted infrastructure.
  {% endhint %}

***

## Troubleshooting

<details>

<summary>Harness-managed infrastructure does not appear in the Load Test Studio</summary>

The option appears only when Harness-managed infrastructure is enabled for your account, and only for load tests, not load test templates. If you are creating a test and the card is missing, contact your account administrator or [Harness Support](mailto:support@harness.io) to enable it.

</details>

<details>

<summary>The Self-hosted infrastructure card is disabled when I edit a load test</summary>

A saved load test keeps the infrastructure it was created with. To run the same workload on self-hosted infrastructure, create a new load test and select **Self-hosted infrastructure** on the **Overview** tab.

</details>

<details>

<summary>The first run spends several minutes on Preparing infrastructure</summary>

This is expected on the first run in a project, and on the first run after 24 hours without use. Harness sets up the infrastructure for your project before the load test starts. Later runs start almost immediately. If preparation does not finish within 15 minutes, the run fails with `E2021`.

</details>

<details>

<summary>E2019: MANAGED_INFRA_LIMIT_REACHED</summary>

The run asks for more than a Harness-managed run allows, or the project or account is already at a limit. The message names the limit, for example `this run asks for 6000 virtual users, which is more than the 5000 a managed infrastructure run may use; lower the number of users and try again`. Go to [Limits](#limits) to find the limit and the fix.

![A failed run showing the E2019 MANAGED\_INFRA\_LIMIT\_REACHED error for 6000 virtual users above the 5000 limit, with the Infrastructure preparation failed panel at 0 percent](https://3217710372-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRmV5EkLS9r45VPaoUnJZ%2Fuploads%2Fgit-blob-8e45d695dcb7e503c087d017d625df5d215e3e67%2Fmanaged-infra-preparation-failed.png?alt=media)

</details>

<details>

<summary>E2017: MANAGED_INFRA_UNAVAILABLE</summary>

Harness has no infrastructure available for your project right now, or the project's infrastructure is still being torn down after idle cleanup. Wait a few minutes, then run the test again. If the error continues, contact [Harness Support](mailto:support@harness.io).

</details>

<details>

<summary>E2018: MANAGED_INFRA_DELEGATE_NOT_CONNECTED</summary>

The execution agent for your account is not connected yet. Wait a few minutes, then run the test again.

</details>

<details>

<summary>E2020: MANAGED_INFRA_PROVISIONING_FAILED</summary>

Harness could not provision the infrastructure for your project. Contact [Harness Support](mailto:support@harness.io) with the run ID shown at the top of the run page.

</details>

<details>

<summary>E2021: MANAGED_INFRA_PREPARATION_TIMEOUT</summary>

The infrastructure was not ready within 15 minutes. Run the test again. If the error continues, contact [Harness Support](mailto:support@harness.io).

</details>

***

## Next steps

You can now run load tests without connecting infrastructure of your own.

* [Create a Load Test](https://developer.harness.io/resilience-testing/load-testing/create-a-load-test.md): Configure the Python, JavaScript, or Java engine for your workload.
* [Run in a Pipeline](https://developer.harness.io/resilience-testing/load-testing/run-in-a-pipeline.md): Run a load test as a step in a Harness pipeline.
* [Analyze Load Test Results](https://developer.harness.io/resilience-testing/load-testing/analyze-results.md): Interpret the metrics and threshold outcomes of a run.

{% @harness-feedback/feedback %}

[^1]: Off by default. If you want to try it and share feedback, request access and Harness will turn it on for your account. Beta features can change and may not be ready for production use.
