# Load and Performance Testing: A Comprehensive Solution for High Traffic Simulation

The **Load and Performance Testing** feature in **ratl.ai** enables users to automatically generate and execute load tests to evaluate an API’s ability to handle high traffic. By leveraging AI, you can simulate real-world scenarios, measure performance under load, and optimize your API accordingly.

This feature supports various load generation formats, including **cURL commands or postman collection**, and can create tailored load tests to ensure API performance under stress.

<figure><img src="/files/oJZV6zD13rz0wN7NRODY" alt=""><figcaption></figcaption></figure>

### Key Benefits

* **Automated Load Test Generation**: Automatically generate load tests based on cURL commands.
* **Customizable Load Conditions**: Configure concurrent users, request rates, and test durations.
* **Execution Tracking**: Monitor performance metrics such as response times, throughput, and error rates.
* **Detailed Results Analysis**: Gain insights into how your API performs under different traffic loads.
* **Optimization Support**: Identify bottlenecks and make improvements to enhance API performance.

### Preconditions

Before using the Load and Performance Testing feature, make sure:

* The API endpoint is defined and accessible via a specific **cURL command or Postman exported collection**.
* You have access to **ratl.ai** and the appropriate permissions to generate and run load tests.

### How to Use the Load and Performance Testing Feature

#### 1. Upload API Specification

<figure><img src="/files/gQb3NixVBiK30WOSR0O8" alt=""><figcaption></figcaption></figure>

* Navigate to the **Load and Performance** page.
* Click on **Add Simulations**.
* Provide the API specification using one of the following options:
  * Paste a **cURL command**.
  * Upload a **Postman Collection** (Postman collections must be **v2.1.0**, **v2.0.0**, or **v1.0.0** and are limited to **10 APIs**).
* Select a **Load Generator** (currently supporting **Gatling** and **JMeter,** with future support for Locust and K6).
* Review the pool injector's resource allocation:
  * **Ratl Cloud Load Injectors:**
    * Seamless load injectors hosted on Ratl’s in-house cloud infrastructure.
    * Offers a pay-as-you-go pricing model, calculated based on the load testing specifications or executions.
    * No need to manage any infrastructure—ideal for quick, scalable load testing setups.
  * **On-Premise Kubernetes Load Injectors:**
    * Users can integrate their own Kubernetes clusters to serve as load injectors.
    * Currently supports Kubernetes clusters, with Azure, GCP, and AWS support coming soon.
    * This option allows the Ratl injector pod instances to run directly within your infrastructure, reducing costs by leveraging your own resources.
    * For detailed steps on integrating Ratl with your Kubernetes cluster, refer to our guide: [Integrate Ratl with Kubernetes Clusters](broken://pages/oa0XskrCEgbVlYaOnehE).
* Configure the injector configs with the following parameters:
  * **Number of Users**: Define how many concurrent users will be simulated during the test.
  * **Max Duration**: Set the maximum duration (in minutes) for the test.
* Once configured, click **Next** to proceed for code review.

> **Tip**: Ensure the API specifications are correctly formatted to avoid errors in test generation and Users cannot exceed the predefined limits of **10 instances** or **4 CPU cores** and **4 GB of memory**.&#x20;
>
> For higher requirements, users can contact the admin to request an upgrade.

***

#### 2. Code Review

<figure><img src="/files/hKpS5g1OtMJ0khuOhIMe" alt=""><figcaption></figcaption></figure>

1. Navigate to the **Code Editor** after the load test scripts are generated.
2. Review the automatically generated load test scripts.
3. Use the **prompt** or the **code editor** to modify the scripts, if necessary.
4. Ensure that there are no issues in the script, as any errors will result in **compilation failure** and prevent the simulation from starting.
5. Review the script carefully, knowing that it is **autosaved**. You can return to the **Simulations Listing** page at any time to view or edit the code.
6. Once the code has been reviewed and confirmed, click **Start Simulation** to proceed.

> **Note**: The complexity of the **cURL command** or **Postman collection** may impact the load test script generation time.

***

#### 3. Execute Load Tests

<figure><img src="/files/EQfYqWVkGuogL5zoazMr" alt=""><figcaption></figcaption></figure>

1. Once the simulation is started, you can either **wait for the simulation to complete** or navigate back to the **Simulations Listing** page.
2. If needed, you can **stop the simulation** at any time during execution.
3. Check the status of instances in the **Simulation Flow** screen, which will update based on the resources you configured (e.g., number of pods, CPU, memory).
4. Access the **logs** to monitor the simulation's progress in real-time.
5. Once all instances have completed, the **Generate Report** button will become enabled. You will not be able to generate a report until the simulation is fully completed.
6. After the simulation is complete, click on **Generate Report** to proceed to the analysis phase.

> **Note**: Please be aware that you are limited to 20 simulation runs per day. If you reach this limit and require more executions, you will need to wait until the following day or contact an administrator about upgrading your quota. This daily cap applies to every user, regardless of subscription plan.

***

#### 5. Analyze Results

<figure><img src="/files/uSrMDpnspBUviNj9Yla7" alt=""><figcaption></figcaption></figure>

1. Review the results after the simulation execution to evaluate how the API performed under the load.
2. Analyze key metrics such as **response times**, **throughput**, **error rates**, and **resource utilization** to assess the API's behavior.
3. Use the detailed performance report to identify any bottlenecks or areas for optimization.
4. Share the generated report with stakeholders for further review and insights.

> **Pro Tip**: You can share the results to generate comprehensive reports for stakeholders, making it easier to communicate findings and recommendations.

***

#### 6. Debugging and Optimization

* For any performance bottlenecks or failures, use the provided **logs** and **performance metrics** to investigate the cause.
* Make necessary changes to the API or adjust the load test configuration to optimize performance.

***

#### 7. Re-run Load Tests

* Re-run the load tests to validate that the changes have improved performance.
* **ratl.ai** will generate a new report, confirming the improvements or highlighting any persistent issues.

### Postconditions

* Your API’s performance under high load is thoroughly tested and evaluated.
* All bottlenecks or performance issues are identified and addressed.
* Detailed performance reports are generated and can be exported for future reference.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ratl.ai/guide/features/load-and-performance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
