Skip to content
Back to skills

Report Performance

ASecurity

Measure an app's main journeys at production volume and produce the performance report (mxcli report performance): seed an app-shaped volume dated around today, instrument the runtime and Postgres, run each step warm several times, and compare before and after a fix with flame charts and query plans. Use when asked whether the app will be fast with real data, to find N+1 queries, or to prove a performance fix.

  • 143 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 22, 2026
ai-agentsgobashsqlnodedatabaseperformance

Works with

  • cli

Security analysis

A100/100

Scanned November 22, 2026

npx -y skills add mendixlabs/mxcli --skill report-performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Report Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Report Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mendixlabs-report-performance/badge)](https://www.skillsdirectory.com/skills/mendixlabs-report-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: report-performance
description: "Measure an app's main journeys at production volume and produce the performance report (mxcli report performance): seed an app-shaped volume dated around today, instrument the runtime and Postgres, run each step warm several times, and compare before and after a fix with flame charts and query plans. Use when asked whether the app will be fast with real data, to find N+1 queries, or to prove a performance fix."
---
<!-- skill-index: generated by scripts/skill-index.py; make check-skill-index -->
## Find it fast

`sed -n '<from>,<to>p' SKILL.md` one section rather than reading the file;
`./mxcli syntax <topic>` answers *how do I write this* for a fraction of either.

| lines | section |
|---|---|
| 32-54 | 1. Seed (backup first) |
| 55-69 | 2. Instrument (and write down what you change) |
| 70-87 | 3. Measure |
| 88-116 | 4. Before and after — fairly |
| 117-122 | 5. Restore |
| 123-145 | Reading it |
| 146-149 | Related |

<!-- /skill-index -->
# Performance Report

`mxcli report performance` turns a measured run into a page: per journey step the
browser, server and database time and query count (median of warm runs), a flame
chart, the most frequent statements, Postgres plans with their JIT cost, N+1 shapes
in the model, and — with `--baseline` — before and after.

The command measures and renders. It does **not** change your database: seeding,
instrumenting and restoring are the protocol below, and every step is a check.

## 1. Seed (backup first)

```bash
pg_dump -Fc -h 127.0.0.1 -U mendix app > before-seed.dump
```

Generate the volume by SQL, per entity count, with the runtime's id formula and the
sequences advanced past the seeded range. Ids are `short_id << 48 | seq << 7 | bits`
where `short_id` is the entity's short id from `mendixsystem$entityidentifier`:

```text
-- 1M orders for entity short_id 12, dated around today
INSERT INTO shop$order (id, createddate, status)
SELECT (12::bigint << 48) | (g << 7) | 1, now() - (random() * interval '365 days'), 'Open'
FROM generate_series(1000001, 2000000) g;
-- then move the entity's sequence past 2000000 so the runtime does not collide
```

**Seed dates relative to now.** A seed dated from a fixed roster day put many
decisions in the future and made a "revertible" list ~120× too long — a wrong
conclusion until checked. After seeding, compare two or three date-filtered counts
with what production would show.

## 2. Instrument (and write down what you change)

```bash
mxcli run --local -p app.mpr --trace-otlp http://127.0.0.1:4318
```

Postgres: `pg_stat_statements` and `auto_explain` (`log_format = json`,
`log_analyze = on`, `log_buffers = on`, `log_min_duration = 20ms`).

- `ALTER SYSTEM SET shared_preload_libraries = 'a,b'` stores **one** quoted name and
  Postgres then refuses to start. Write it unquoted per name:
  `ALTER SYSTEM SET shared_preload_libraries = pg_stat_statements, auto_explain;`
- Record each change in the journey log so the page lists it:
  `{"meta":true,"database":"1.2M orders, seeded 2026-11-12","notes":["auto_explain on (restored)"]}`

## 3. Measure

The journey script (Playwright or other) runs each step several times and appends
one line per step and run to `$MXCLI_JOURNEY_LOG`. A step lasts from the action
until its last `/xas/` request has answered and nothing new starts for ~0.6 s:

```json
{"journey":"Marketplace","step":"open","run":2,"start":"…","end":"…","browserMs":812}
```

```bash
mxcli report performance -p app.mpr --journeys-cmd "node perf/journeys.mjs" \
  --plans /var/log/postgresql/postgresql.log --format json -o perf/after.json
```

Restart the app before measuring, keep run 0 as warm-up (it is not counted), and use
five runs.

## 4. Before and after — fairly

The "before" is the **committed model on the same seed**: revert the change, restart,
measure; then re-apply, restart, measure. Never reuse an older run.

```bash
mxcli report performance --journeys before.jsonl --spans before-spans.jsonl -f json -o perf/before.json
mxcli report performance -p app.mpr --journeys after.jsonl --spans after-spans.jsonl \
  --baseline perf/before.json -o perf/report.html
```

Each median shows the min–max of its warm runs: a change inside that spread is
run-to-run noise, not an effect of the fix — say so rather than claim it.

Write what was found and done as findings, so the page groups the steps by them:

```yaml
items:
  "finding:F1": {name: "Housekeeping held a 10-minute transaction", status: fixed,
                 note: "deleted in batches of 500; checkout no longer blocks"}
  "step:Guest orders a pizza / 6 place order and pay": {finding: F1}
```

Each finding becomes a card with its steps' before → after — server and DB time, with
a change inside the run-to-run spread marked as such — and a finding no step names
says so. Status is `fixed`, `open`, or a decision not to change it (`accepted`,
`intended`, `by design`); `scope: background` marks work no journey step runs (a
scheduled job, a traffic generator).

## 5. Restore

Drop the seeded rows (or restore `before-seed.dump`), reset `shared_preload_libraries`
and the auto_explain settings, restart Postgres. The page lists what was changed; it
cannot check that you restored it.

## Reading it

- **A step's numbers are its own requests.** The report counts the traces rooted in an
  HTTP request to the app that start inside the step's window. Background work in the
  same window — queued tasks, scheduled events, the task queue's polling — is listed apart
  ("Background work ran during some steps"), not added to server or database time. Before
  this, a simulator's 1.5 s queued tick made one step read 4.9 s instead of 0.3 s. If the
  page warns that no span carries HTTP request attributes, the collector did not record
  the runtime's request spans, and every span in the window is counted again.

- **JIT can dominate a "slow query".** 171 of 197 ms was JIT compiling a plan whose
  scan took 28 ms. The plans table flags JIT ≥ 30% of the time: raise
  `jit_above_cost` or disable JIT, rather than add an index.
- **Two N+1 shapes no index fixes:** a microflow data source that returns its whole
  list (the runtime checks read access per returned object: 1,257 objects became
  1,257 queries), and a retrieve by association inside a loop (about five queries
  per row). Both are listed from the model; confirm in a step's query count.
- **Access rules steer the plan.** A status index can go unused because the
  access-rule subquery drives from an association, and a Mendix index cannot include
  an association. Name that in the finding instead of suggesting another index.
- **auto_explain logs parameterised SQL** with "Query Parameters" apart; bind them
  before re-running `EXPLAIN (ANALYZE, BUFFERS)` by hand.

## Related

- `analyze-runtime` — logs, metrics and traces in general; `demo-data` — seeding by MDL
  for small volumes; `run-local` — the flags.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.