More servers buy you time. They rarely buy you speed for long.
When an application slows down as it grows, the instinct is to give it more: bigger instances, more of them, a larger database tier. Sometimes that helps for a while. Then the curve catches up, because the thing that was slow is still slow, it is just being done on more expensive hardware. The cloud bill goes up, the slowdown comes back, and the next conversation is about going bigger again.
Where the time actually goes
In the slow applications I have worked on, the cause has almost never been spread evenly across the system. It is concentrated. One or two modules are doing heavy work in a place where they hold everything else up, and the rest of the application is waiting on them.
The usual suspects:
- Heavy work on the main request path. Generating documents, reports or exports while the user waits, inside the same process that serves every other user. One of the most common bottlenecks I find is document generation running on the main application's threads. Every large report a user requests ties up capacity that every other user needed.
- Queries that were fine at launch. A query that ran in milliseconds against a few thousand rows can take seconds against a few million. Missing indexes, queries inside loops, fetching everything to show ten rows.
- Chatty calls between services. Dozens of small round trips where one would do, each paying the network cost.
- Work repeated on every request. Data that changes once a day, recalculated every time someone loads a page.
- Synchronous calls to slow things. Waiting on a third-party API or an external system inline, when the result could be queued, cached or fetched in the background.
None of those is solved by more hardware. All of them are solved by changing where and when the work happens.
The fix is usually architectural, and usually small
The pattern that works, again and again: identify the one or two modules that are bottlenecking the system, pull them out of the main application, and give them their own place to run.
Take the document generation case. Instead of building the document while the user waits, the application puts a request on a queue and returns immediately. A separate background worker picks it up, builds the document, and stores it where the user can collect it, or notifies them when it is ready. The main application stops doing heavy lifting it was never designed for, and everyone else's requests stop waiting behind it.
That is a targeted change to one module, not a rewrite. It is also exactly the kind of thing more servers cannot fix, because the problem is not capacity, it is design.
The same approach applies to the other suspects. Move slow external calls to background jobs. Cache what does not change. Fix the five worst queries before touching the other five hundred. Split out a service only where the separation genuinely removes a bottleneck.
How to find the bottleneck
You do not need a big performance program to start. You need someone who knows where to look and has access to:
- The monitoring. Which requests are slow, and when. Slowness that tracks with particular features or times of day points straight at the culprit.
- The database. The slowest queries and the ones that run most often. They are frequently the same few.
- The code paths behind the slow requests. What actually happens between the request arriving and the response leaving.
- The cloud bill. Spend that climbs faster than usage is a symptom of the same design problem.
Most of the time, the answer is visible within days. Fixing it takes longer, but you are no longer guessing.
When it is not one module
Occasionally the problem really is everywhere: the architecture was not built for the load it carries now, or the platform underneath it is past its useful life. That is a different conversation, and I cover it in should we rebuild our application or fix the one we have.
But start by assuming it is one or two things, because it usually is, and because finding them is cheap compared with what the next hardware upgrade will cost. That is the work behind before you rebuild, and it usually pays for itself in the cloud bill alone.
More in the platform engineering library.