---
title: "Load-test before launch"
description: "Find out what your backend handles before launch: which paths to load, a deployment made for the test, a k6 script, the limits that refuse first, and how to read the results."
canonical_url: "https://nuxt-backend.dev/docs/develop/testing/load"
---
# Load-test before launch

> Find out what your backend handles before launch: which paths to load, a deployment made for the test, a k6 script, the limits that refuse first, and how to read the results.

Version: nuxt-backend 0.6.x · Tab: Develop · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

Load the paths people will use most, on a deployment made for the test, and watch where it slows down or refuses.

- **What powers it natively:** Convex runs each function in its own transaction and scales it up to your plan's concurrency limits. [k6](https://grafana.com/docs/k6/latest/) drives the load.
- **What the package adds:** rate limits on every flow that sends mail, spends money or acts on someone else. Under load they refuse first, on purpose, with the code `rate_limited`.

## Pick what to load

<table>
<thead>
  <tr>
    <th>
      Load
    </th>
    
    <th>
      Leave out
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      The pages people open most, server-rendered
    </td>
    
    <td>
      Sign-in codes: each one is an email, and the code limits refuse a flood by design
    </td>
  </tr>
  
  <tr>
    <td>
      The queries those pages read
    </td>
    
    <td>
      Checkout: Polar's sandbox is not built for load
    </td>
  </tr>
  
  <tr>
    <td>
      The one or two mutations on your busiest path
    </td>
    
    <td>
      Anything that sends email: test sends count against your Resend quota
    </td>
  </tr>
  
  <tr>
    <td>
      A job queue's enqueue, if your app has one
    </td>
    
    <td>
      Production, ever
    </td>
  </tr>
</tbody>
</table>

Most apps break at one write that many people make at once, such as a shared counter, rather than at a read.

## Pick a deployment

Use a Convex project made for the test, on the same Convex plan as production: concurrency limits are per deployment and set by plan. A [staging app](https://nuxt-backend.dev/docs/ship/deploy/staging) works, since it runs in production mode on the providers' test modes. Seed it with as many rows as production will hold: a query that reads a full table is fast on ten rows.

Every call counts toward your plan's monthly function calls (checked on 2026-10-25 on [Convex's limits page](https://docs.convex.dev/production/state/limits)):

<table>
<thead>
  <tr>
    <th>
      Plan
    </th>
    
    <th>
      Concurrent queries
    </th>
    
    <th>
      Concurrent mutations
    </th>
    
    <th>
      Function calls included per month
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Free, Starter
    </td>
    
    <td>
      16
    </td>
    
    <td>
      16
    </td>
    
    <td>
      1,000,000
    </td>
  </tr>
  
  <tr>
    <td>
      Professional
    </td>
    
    <td>
      256
    </td>
    
    <td>
      256
    </td>
    
    <td>
      25,000,000
    </td>
  </tr>
</tbody>
</table>

A five-minute run of 50 virtual users, each making one query a second, is about 15,000 calls.

## Write the load

Install [k6](https://grafana.com/docs/k6/latest/set-up/install-k6/), then write a script that opens a page and reads a query over Convex's HTTP API:

```js [load/pricing.js]
import http from 'k6/http'
import { check, sleep } from 'k6'

export const options = {
  stages: [
    { duration: '1m', target: 50 }, // ramp up to 50 virtual users
    { duration: '3m', target: 50 }, // hold
    { duration: '1m', target: 0 }, // ramp down
  ],
  thresholds: {
    http_req_failed: ['rate<0.01'],
    http_req_duration: ['p(95)<500'],
  },
}

const SITE = __ENV.SITE_URL // the app's origin
const BACKEND = __ENV.BACKEND_URL // https://<deployment>.convex.cloud

export default function () {
  const page = http.get(`${SITE}/pricing`)
  check(page, { 'the page answers': r => r.status === 200 })

  const query = http.post(`${BACKEND}/api/query`, JSON.stringify({
    path: 'billing:getPricing',
    args: {},
    format: 'json',
  }), { headers: { 'Content-Type': 'application/json' } })
  check(query, { 'the query succeeds': r => r.json('status') === 'success' })

  sleep(1)
}
```

```bash
k6 run -e SITE_URL=https://staging.example.com -e BACKEND_URL=https://your-deployment.convex.cloud load/pricing.js
```

[Convex's HTTP API](https://docs.convex.dev/http-api/) takes any public function by its path: `POST /api/query`, `/api/mutation` or `/api/action`, with `{ path, args, format }`. It answers `{ status: 'success', value }` or `{ status: 'error', errorMessage, errorData }`.

## Load the signed-in paths

A function behind a tier (`authed`, `workspace`, …) needs a signed-in caller, and a caller signs in with a sign-in code. Drive those paths with browsers that sign in once and then repeat the path: Playwright workers using the sign-in helper from [Run end-to-end tests](https://nuxt-backend.dev/docs/develop/testing/e2e#sign-in-from-a-test), or k6's browser module. A few dozen browsers, each with an account of its own, show contention on your writes, which is where load breaks first.

The end-to-end helper reads codes from the dev inbox, which serves dev deployments only. Run the signed-in load on a cloud dev deployment of the test project.

## Read the results

- **k6** prints each threshold as passed or failed, with the latency percentiles. A failed threshold exits with a non-zero code, so the run can gate a release.
- **The Convex dashboard** shows each function's calls, errors and latency. Its insights name the mutations that retried on write conflicts and the functions that read too many documents.
- **Refusals with rate_limited** are the package's limits at work. Raise one only for a real launch need, such as the deployment-wide ceiling on sign-in codes ([Tune rate limits](https://nuxt-backend.dev/docs/ship/security/rate-limits)).

## What refuses first

<table>
<thead>
  <tr>
    <th>
      Limit
    </th>
    
    <th>
      What you see
    </th>
    
    <th>
      Where to look
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      The package's rate limits
    </td>
    
    <td>
      <code>
        rate_limited
      </code>
      
       from the function, a wait on the page
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/backend/limits#rate-limits">
        Limits and retention
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      Write conflicts on one document
    </td>
    
    <td>
      Mutations retried, then slow or failed
    </td>
    
    <td>
      Convex dashboard insights: split the hot document
    </td>
  </tr>
  
  <tr>
    <td>
      A query reading too much
    </td>
    
    <td>
      Errors past 32,000 documents scanned in one transaction
    </td>
    
    <td>
      Add an index, or paginate
    </td>
  </tr>
  
  <tr>
    <td>
      Concurrency
    </td>
    
    <td>
      Calls wait their turn, and latency climbs
    </td>
    
    <td>
      Your plan's concurrency limits
    </td>
  </tr>
  
  <tr>
    <td>
      One second of function time
    </td>
    
    <td>
      A query or mutation timing out
    </td>
    
    <td>
      Move slow work into an action or a scheduled function
    </td>
  </tr>
</tbody>
</table>

## Related

- [Limits and retention](https://nuxt-backend.dev/docs/reference/backend/limits): every rate limit the package sets, read from the code.
- [Tune rate limits](https://nuxt-backend.dev/docs/ship/security/rate-limits): raise the ceilings a launch needs.
- [Deploy a demo or staging app](https://nuxt-backend.dev/docs/ship/deploy/staging): a deployment for the test.
- [Production checklist](https://nuxt-backend.dev/docs/ship/checklist): what to check before launch.
- [Convex's limits](https://docs.convex.dev/production/state/limits): every platform limit, by plan.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
