Intuition is unreliable here

Developers optimise what is interesting rather than what is slow. The distribution of causes is remarkably consistent across applications, and it is rarely the code somebody was worried about.

1. Too many database queries

One query per row in a loop is the single most common cause of a slow page. It looks fine with ten records and collapses at a thousand — which is why volumes belong in a spec before anything is built.

Before optimising anything, count your queries. The answer is usually embarrassing.

2. Missing indexes

A query that was instant on a small table becomes a scan as data grows. The symptom is an application that got gradually slower with no code change — worth checking before anyone proposes a rewrite.

3. Synchronous third-party calls

Every external call inside a request adds its latency and its failures to yours. Most belong in the background, which is precisely when to add a queue.

4. Payload size

Returning far more data than the page uses is invisible on a fast connection and dominant on a slow one — the reason real-user measurement differs from your tests.

Measure the distribution, not the average

Averages hide the requests that are ruining someone’s day. Watch the slow tail, because that is where the customer with the most data lives — and they are usually your biggest account.