> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-dispatch/reference/performance.md).

# Performance

What actually runs, how often, and what deliberately does not run at all.

Mango Dispatch sits at **0.00 ms** for a player who is doing nothing dispatch-related, because there is nothing running on their client in that state.

### What runs on the client

| Loop             | How often                          | When                                                                         |
| ---------------- | ---------------------------------- | ---------------------------------------------------------------------------- |
| Unit state check | Every 30 seconds                   | Always. One event to the server, no work if nothing changed                  |
| Window refresh   | Every `refreshSeconds` (default 5) | **Only while the quick call window is open.** The thread ends when it closes |

There is no per-frame loop anywhere in this resource. No `Wait(0)`, no draw loop, no position reporting, no marker or entity scanning. The alert cards and window are HTML, so they cost the NUI a repaint and nothing more.

{% hint style="info" %}
Distances are computed client-side, once per call, when a card or the window is rendered - which is why the server never needs to know where anyone is.
{% endhint %}

### What runs on the server

| Loop               | How often        | Does                                                  |
| ------------------ | ---------------- | ----------------------------------------------------- |
| Auto-resolve sweep | Every 60 seconds | Closes open calls older than `autoResolveMinutes`     |
| Purge              | Every 5 minutes  | Drops calls older than `historyMinutes` out of memory |

Both walk the call table, which is bounded by `historyMinutes` - at any realistic call volume that is tens of rows.

### Memory, not database

There are **no queries**, because there is no database. A call is a Lua table; the whole board is two tables plus a counter. That is a deliberate trade:

<table data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>You get</strong></td><td>No SQL to import, no migrations, no write load on a busy board, and instant reads.</td></tr><tr><td><strong>You give up</strong></td><td>Call history across restarts. Every open call is closed when the resource stops.</td></tr></tbody></table>

If you need permanent call history, listen to `mango_dispatch:callCreated` and `mango_dispatch:callResolved` and write your own rows - see [Events](/mango5m-docs/resources/mango-dispatch/developer-guide/events.md).

### Caches

| Cache             | Lifetime    |
| ----------------- | ----------- |
| Player identifier | The session |
| Player job        | 5 seconds   |

The job cache is what keeps `IsUnit` cheap when a call is broadcast to a full server - a burst of alerts costs one framework lookup per player, not one per alert.

### NUI focus

Taken in exactly one place: `/dispatchhud`. Alerts, the call window and toasts never take focus, never capture the mouse, and never block movement or shooting.

### Rate limits

| Path                | Limit                                                   |
| ------------------- | ------------------------------------------------------- |
| `/911`              | `call911.cooldownSeconds`, default 15, per identifier   |
| Client `CreateCall` | `clientCall.cooldownSeconds`, default 5, per identifier |
| Server `CreateCall` | None - the server is trusted                            |
