> ## 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.

# Simulating Real Users

> Learn how to simulate real user behavior in load testing.

When running load tests, you may want to test different types of load. For example, you may want to stress test your web server or load test your API.

However, the most common scenario is simulating real users for when you experience a traffic spike.

Real user browsing is made up of a few key components:

* Simulated wait times
* Full page loads
* User sessions

## Wait Times

Real users wait between page loads—they consume the content, let animations or videos play, and interact with the page. Because of this, you need to simulate a realistic wait time in your test, which depends on the type of site or content.

Recommended wait times:

* **Slow** - 15 to 60 seconds
* **Casual** - 8 to 20 seconds
* **Standard** - 5 to 9 seconds

You'll notice these are always a range, and LoadForge supports that. Your test will have a `wait_time` variable, which typically looks like this:

```python theme={null}
wait_time = between(5, 9)
```

This instructs LoadForge to wait a random amount between 5 and 9 seconds between actions.

## Loading Static Content

A real user also loads all your static content—images, CSS, JavaScript, etc. However, browsers cache this content, meaning they load it less frequently as users continue browsing.

You want to simulate loading static content first and then focus on dynamic content. Here's an example of a test script that simulates a real user visiting a blog:

```python theme={null}
from locust import HttpUser, task, between

class QuickstartUser(HttpUser):
    wait_time = between(5, 9)

    @task(3)
    def index_page(self):
        self.client.get("/")
        # Load CSS
        self.client.get("/assets/css/app.css?v=5182f1a68d")
        self.client.get("/assets/css/home.css?v=5182f1a68d")
        self.client.get("/public/cards.min.css?v=5182f1a68d")
        # Load JavaScript
        self.client.get("/public/cards.min.js?v=5182f1a68d")
        self.client.get("/assets/js/manifest.js?v=5182f1a68d")
        self.client.get("/assets/js/vendor.js?v=5182f1a68d")
        self.client.get("/assets/js/app.js?v=5182f1a68d")

    # Simulate visiting different pages
    @task(1)
    def visit_pages(self):
        urls = [
            "", "/", "/products/", "/we-care/", "/corporate/", "/products",
            "/1000-screenshots-per-month-for-free/", "/author/gbv/",
            "/loadforge-launches-white-labelling-for-reports/", "/tag/loadforge/",
            "/sponsoring-laravel-io/", "/tag/news/"
        ]
        for url in urls:
            self.client.get(url)
```

In this script:

* The `index_page` task loads the homepage along with its static assets.
* The `visit_pages` task simulates navigating through various pages of the site.
* The `wait_time` ensures that user behavior remains realistic, with a pause between actions.

## Next Steps

Simulating real user behavior helps you create realistic load tests, ensuring that your site remains stable under peak traffic conditions.

<CardGroup cols={2}>
  <Card title="Script Examples" icon="code" href="/examples/overview">
    Browse ready-to-use test scripts for common scenarios
  </Card>

  <Card title="Browser Recording" icon="circle-dot" href="/test-scripts/record-your-browser">
    Record your browser activity and convert it into a load test
  </Card>

  <Card title="Custom Load Shapes" icon="chart-line" href="/test-scripts/custom-shapes">
    Configure ramp-up, spike, and step patterns for your tests
  </Card>

  <Card title="Create a Test" icon="plus" href="/tests/creating-a-test">
    Step-by-step guide to creating your first test
  </Card>
</CardGroup>
