> For the complete documentation index, see [llms.txt](https://docs.madrix.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.madrix.dev/br/solucao-de-problemas/performance-e-lentidao.md).

# Performance e lentidão

### Quando usar

* UI lenta para carregar listas e formulários.
* Timeouts em APIs.
* Lentidão só em um ambiente (ex: Prod).

### Checklist rápido (2 min)

1. Compare Dev vs Staging vs Prod.
2. Teste com um usuário “limpo” (sem muitos dados).
3. Isole: é UI, API, ou banco?

### Diagnóstico

#### 1) É client-side ou server-side?

* Client-side: CPU alta no browser, render pesado.
* Server-side: requests lentos no Network, time-to-first-byte alto.

#### 2) Dados e queries

* Listas sem paginação tendem a degradar rápido.
* Filtros e ordenações podem exigir índices.

#### 3) Integrações

* Chamadas para serviços externos travam a request principal?
* Timeouts estão configurados?

### Como resolver (padrões)

* **Listas lentas**: paginação, filtros obrigatórios, reduzir colunas.
* **API lenta**: revisar endpoints críticos e queries.
* **Banco**: índices, evitar N+1, revisar migrations recentes.

### Quando escalar

* SLA afetado em Staging/Prod.
* Degradação abrupta após release.
* Timeouts frequentes e repetíveis.

Antes de escalar, junte estas evidências. Isso reduz muito o ping-pong.

* Projeto e ambiente (Dev/Staging/Prod).
* Horário do erro (com timezone).
* Passos para reproduzir (curto e determinístico).
* Mensagem de erro completa (sem prints cortados).
* Screenshot da tela (se aplicável).
* Console do browser (erros e warnings relevantes).
* Aba **Network** (request que falhou + status + payload, se não houver dados sensíveis).

{% hint style="info" %}
Se existir um `requestId`, `traceId` ou link de execução, inclua também.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.madrix.dev/br/solucao-de-problemas/performance-e-lentidao.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
