> ## Documentation Index
> Fetch the complete documentation index at: https://docs.loadforge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Analysis

> How LoadForge's AI provides automatic analysis and test recommendations.

LoadForge's **AI-powered analysis** provides **automatic insights** into your test runs, helping you quickly identify performance issues, optimize test scripts, and detect bottlenecks.

The **AI Analysis** section includes three key components:

> [accordion] Performance Analysis
>
> This component provides a high-level summary of key findings from your test run, including:
>
> * **Key Issues:** Notable slow endpoints, high error rates, or other problem areas
> * **Response Time Insights:** Breakdown of performance trends, including slowest P95 and P99 times
> * **Recommendations:** Suggested optimizations based on detected inefficiencies
> * **Error Analysis:** Common errors (5xx, timeouts, etc.), their frequency, and possible causes
>
> ![AI Performance Analysis](https://mintlify.s3.us-west-1.amazonaws.com/loadforge/images/ai-analysis.png)
>
> AI Performance Analysis Example
>
> > [!TIP]
> >
> > Use the Performance Analysis to quickly identify whether failures were due to scaling limitations, slow database queries, or high server load.

> [accordion] Test Script Suggestions
>
> This component provides AI-powered recommendations for refining your **Locustfile test script**, including:
>
> * **Adjusting wait times** to better simulate real users
> * **Adding multiple request types** to make load tests more realistic
> * **Tweaking spawn rates** to avoid unrealistic traffic spikes
> * **Enhancing validation** to check response status codes and data integrity
>
> ```python Example Script Improvement theme={null}
> # Before: Simple test with fixed wait time
> @task
> def index_page(self):
>     self.client.get("/")
>
> # After: Enhanced test with variable wait and validation
> @task
> def index_page(self):
>     with self.client.get("/", catch_response=True) as response:
>         if response.status_code != 200:
>             response.failure(f"Got status {response.status_code}")
> ```
>
> > [!TIP]
> >
> > If your test results seem inconsistent, the AI might suggest adjusting your spawn rate to create a more gradual load increase.

> [accordion] Bottleneck Detection
>
> This component identifies likely sources of slowdowns based on:
>
> * **Your website's tech stack** (e.g., PHP, Node.js, Python, database type)
>
> * **Server infrastructure** (e.g., Nginx, Apache, cloud-based hosting)
>
> * **Common scaling issues** related to API calls, caching strategies, or database queries
>
> > [!WARNING]
> >
> > Pay special attention to endpoints with high variance between P50 and P95 response times, as these often indicate database query issues or inefficient caching.
>
> > [!TIP]
> >
> > The bottleneck detection can help you prioritize optimization efforts by focusing on the components that will provide the greatest performance improvements.

## Why Use AI Analysis?

LoadForge’s AI saves time by:

* **Automatically analyzing performance data.**
* **Highlighting critical issues immediately.**
* **Suggesting targeted improvements** for both test scripts and server performance.
* **Providing insights tailored to your site’s architecture.**

By leveraging AI-powered insights, you can fine-tune your load tests and optimize your application’s performance with minimal manual effort.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.