# Fix website load problems with an AI agent: test, fix, prove

[Insights](https://www.supervisor.com/insights)

How an AI agent finds and fixes what limits your website under load: baseline, logs, one change, the same test again. With a real ticket shop that went from 60 to 400 buyers.

[Download as Markdown](https://www.supervisor.com/insight/fix-load-problems-with-an-ai-agent.md)

A load test tells you that your site stops at 60 users. The work starts there: finding out why, fixing it, and showing that the fix helped. An AI agent with access to your server and code can do that work the way a performance engineer does. Supervisor runs the browsers and measures, and you approve each change.

This guide goes through the loop with a real case: a ticket shop that went [from about 60 to about 400 simultaneous buyers](https://www.supervisor.com/use-cases/ticket-shop-load-test) with two changes.

## The loop: one change at a time

1.  **Baseline.** Real browsers add users until the site slows down.
2.  **Cause.** The agent reads the slow requests from the test and the server’s own logs for the same minutes.
3.  **One change.** It proposes a fix, you approve it, and it is recorded.
4.  **The same test again.** Keep the change if it helped, revert it if not.
5.  **Repeat** until the target holds.

One change between tests is the rule that makes it work. With two you don’t know which one helped.

## What you need

*   **An AI agent that can reach your server and code:** Claude Code, Cursor, Codex or another MCP client, with SSH or your hosting provider’s tools.
*   **Supervisor connected to it** through [Autotune](https://www.supervisor.com/autotune#connect).
*   **A verified site.** Load tests send real traffic, so you show that the site is yours with a DNS record or a file. The agent tells you exactly what to add.

Then say the goal:

> “Use Supervisor to find out how many users example.com can handle. The goal is 300.”

The built-in [autotune prompt](https://www.supervisor.com/docs/connect-your-agent#the-autotune-prompt) tells the agent how to go on. Choose a quiet time, and tell whoever watches your alerts.

## 1\. Write down the limits before the first test

Before any load, the agent notes the current settings: database connections, web server workers, memory, caches. It saves time later, because a limit that is far from full is not the cause.

## 2\. Run the baseline

The test starts with 4 users and adds more every 10 seconds. It stops when pages take longer than 3 seconds on average or 20% of the browsers fail. The agent gets the number of users handled, the slowest pages and requests, and charts.

**In the ticket shop:** about 60 of 300. Beyond that, pages took 6 to 10 seconds.

## 3\. Find the cause, not the suspect

This is where the agent earns its keep. It looks at the same minutes from both sides:

*   **From the test:** which endpoints made the browsers wait, and whether the time went to the server or to the browser.
*   **From the server:** the slow query log, error logs, worker and connection counts, CPU, memory and disk.

Every test request carries an `X-Supervisor-Run` header, so the agent can find it in the access log.

| What the test shows | Where the agent looks | A usual fix |
| --- | --- | --- |
| Long server wait on a few endpoints | Slow query log, query plans | An index, or one query instead of many |
| Long wait on everything, CPU idle | Worker and connection pools | A pool size, or what holds the connections |
| Long wait on everything, CPU full | Profiler, cache hit rate | Page or object cache |
| Server fast, page slow | Browser time, third-party scripts | Remove, replace or delay a script |
| Errors that begin at a certain count | Firewall and rate limits, error log | A limit, or a setting for the test traffic |
| Static files slow | Web server, bandwidth | A CDN in front of them |

**In the ticket shop** the obvious suspect was the limit of 50 web server workers. It was raised to 200, and the next test showed no change. The slow query log had the real cause: queries against one table took 10 to 16 seconds under load and held their connections open.

## 4\. Make one change

The agent shows the change, what it expects from it and how to undo it. When you approve, it makes the change and records it with the test.

**In the ticket shop** the first change that mattered was one index:

```
ALTER TABLE ticket
ADD INDEX idx_ticket_session (session_id),
ALGORITHM=INPLACE, LOCK=NONE;
ANALYZE TABLE ticket;
```

## 5\. Run the same test again

Same number of users, same pages. The agent compares the two runs and tells you the verdict: better, worse or no difference.

**In the ticket shop** the slow queries were gone, and the next problem came into view: an icon library that made pages load slowly, and sometimes not at all, under load. Two icons were replaced with the shop’s own and the library was removed. The final test handled about 400 buyers with an average page load of about 1.5 seconds.

A request-level test would not have found the second one, because it never loads the library. [Why real browsers](https://www.supervisor.com/insight/we-load-test-the-wrong-way) explains the difference.

## 6\. Find the new ceiling, and keep it

When the target holds, the agent runs once more with more users, so you know how much room there is. Then it can schedule the same test every month, and you get an email if the site gets slower.

## How the work was done in the case

The ticket shop was an early trial of what became Autotune. An AI agent was given the server’s logs and the test data and proposed the fixes. People ran the tests and applied the changes. Today the agent starts the test and reads the result itself, and you approve each change. The customer is not named.

## What you decide

*   **When to test.** The agent asks before it starts load.
*   **Each change.** Nothing is changed on the server without your approval, and Supervisor itself never touches it.
*   **When it’s enough.** Sometimes what is left is a bigger server or a rewrite. The agent says so, with the numbers.

Give the agent the access it needs and no more: read access to logs and metrics first, and the right to change settings when you get to a fix. Keep a backup before database changes.

## Questions

**What does it cost?** A test costs 1 credit per 10 users, credits are sold from €15 for 10, and the price is known before the test starts. The agent’s own use is billed by its provider. A 300-user test is 30 credits. Prices exclude VAT; all are on the [pricing page](https://www.supervisor.com/pricing).

**Is it safe to test production?** A test stops by itself when pages slow down or browsers fail, and you can stop it at once. Use a quiet time, and leave payments and email out with excluded paths or test accounts.

**Can it fix a site on Shopify or another hosted platform?** It can fix what you control: the theme, apps, scripts and images. The server is the platform’s.

**What if I don’t use an agent?** Run the test in the web app and fix by the report, or have Supervisor’s people [plan, run and analyse it](https://www.supervisor.com/pricing#quote).

More on planning a test: [how to load test a website](https://www.supervisor.com/insight/how-to-load-test-a-website). More on the half-managed way of working: [Autotune](https://www.supervisor.com/autotune#managed).

## Related content
- [How to load test a website: test types, user numbers and a step-by-step plan](https://www.supervisor.com/insight/how-to-load-test-a-website)
- [Fix accessibility issues with an AI agent: find, fix, verify](https://www.supervisor.com/insight/fix-accessibility-issues-with-an-ai-agent)
- [We load test the wrong way: why JMeter-style load tests miss the real bottlenecks](https://www.supervisor.com/insight/we-load-test-the-wrong-way)
- [Website performance monitoring: what to measure, how often and which alerts to set](https://www.supervisor.com/insight/website-performance-monitoring)
- [GEO Optimization & Accessibility: Unified SEO Strategy for AI & Humans](https://www.supervisor.com/insight/geo-optimization-and-accessibility-built-on-the-same-foundation)
- [How often should you do an accessibility audit? What Finland's authority has held](https://www.supervisor.com/insight/accessibility-audit-is-not-a-one-off)
