Why did AppMecca say my app is overloading the database?¶
Apps on AppMecca share one database server per environment. Each app has its own database, but they all run on the same machine, so one app's heavy queries can slow everyone else's. AppMecca watches for this and tells you when your app is the cause, with the figures that show it.
These reports cover the shared server only. An app whose database is on your group's own database server is not watched, because no other group's app can be slowed by it.
AppMecca flags; it never throttles. Nothing about your app is slowed, stopped or moved. The notice is for you to act on.
When you are told¶
You hear about it only when both are true for a sustained period (15 minutes by default):
- the database server is under pressure (its CPU is high, 70 % or more by default), and
- your app branch's database is doing at least half of all the server's database work.
A busy app on a quiet server is never flagged, and nor is a short spike.
Where you see it¶
- The app page. A Database load card on your app's page in the dashboard: "This app is using N% of the shared database's work while the server is under pressure, since
- Email. If your platform operator has turned owner emails on, your group's owners and administrators get one email per episode, at most one every 6 hours per app branch. The email has the headline figures and a link to the app page; it never contains query text.
The card appears only when there is something to show. No card means either that nothing has been flagged in the last 90 days, or that AppMecca has no recent measurement for your app; it does not by itself mean "all clear". If the card says the figures are unavailable, the dashboard could not read them just then; the rest of the page is unaffected.
What the figures mean¶
| Figure | Meaning |
|---|---|
| Share (mean, peak) | Your database's part of the time the whole server spent running queries, including waiting on locks and disk. It is not CPU |
| Server CPU | The database server's average CPU over the period |
| Top statements | Your app's most expensive queries over the period (or, if none were recorded for the period, since the server's statistics were last reset), with their calls, mean time and total time. Values are replaced by placeholders ($1), so no data from your tables is shown |
You see only your own app's figures, never another app's. If the card says statement text is not available, the server is not collecting it yet; the share figures still stand.
What you can do¶
- Look at the top statements. A query with a very high call count or total time is usually the cause: add an index, cache the result, batch the calls, or fix an N+1 loop.
- Check for a job that runs more often or for longer than intended (a cron, a worker loop, a backfill).
- Check your connection use. Many connections or a large pool add load even when idle.
- If your group uses AppMecca Meerkat and your operator has enabled it, the card and the email may offer to start a short traced measurement period in Meerkat, to see which requests cause the load. Only a group owner or administrator can start one, and only when the group's performance tracing is on.
The episode closes by itself once your app's share or the server's CPU has been below the thresholds for the same sustained period.
See also¶
- Database Operations -- Your app's database, its connection limits and backups