← ALL FIELD GUIDESCAJS / ENGINEERING NOTES

FIELD GUIDE / 17 November 2026

Before you add more servers, find the bottleneck

How to investigate a slow application, find the performance bottleneck and decide whether server scaling will help.

START READING
BY CAMERON STEPHEN8 MIN READPERFORMANCE / BACKEND / INFRASTRUCTURE
The question

What is actually limiting your application?

The approach

Follow the slow request and measure where time is spent.

The decision

Add capacity when it addresses the constraint you have found.

A slow application can frustrate customers and interrupt the work people rely on it to do. When pages take longer to respond, adding another server can seem like a sensible first step, particularly if more people are using the system than before.

Sometimes more capacity is exactly what is needed. But just because an application takes longer to respond does not mean its servers need more resources. A request might be waiting for a database query or for a response from another service. Adding servers will not necessarily make either of those things faster and could put more pressure on a system that is already struggling.

I like to start by looking at what has changed and where the application is getting held up. A few useful measurements can help you decide what to fix and avoid paying for extra capacity that may not help.

Start with what people are experiencing

Before looking at graphs, I would want to understand what slow actually means to the people using the application. Is every page taking longer, or is it one particular action? Does it happen throughout the day, or only when the system is busy? Has it been getting worse over several weeks, or did someone notice a sudden change after a release?

Those details can help narrow down where to look. If one report is slow but the rest of the application is working normally, the cause may be specific to the work that report does. If lots of unrelated pages are affected at the same time, it makes sense to look at something they share, such as a database, a network connection or the application servers themselves.

It helps to ask for a recent example. Knowing roughly when it happened, which page was involved and what the person was trying to do gives you somewhere to start looking in the logs. It is also useful to know whether other people had the same problem. You don't need to record personal details to investigate it.

Follow the request through the system

Once you have an example, look at the path that request takes. A page that appears to be a single action to the person using it might involve the application, several database queries and a call to another service. Any one of those steps could be responsible for the wait.

If you have tracing set up, you can follow a request through the services involved and see how long each part took. Application logs, database query statistics and resource dashboards can help too. If you don't have those tools, adding timing around a suspected operation in a test environment can still give you somewhere to start.

I'd look at several requests rather than relying on one example. A page that is occasionally slow might have a different problem from one that keeps everyone waiting. Comparing response times, or latency, during slow periods with those at quieter times can help show what has changed.

Resource usage is part of that picture, but a busy resource is not necessarily the cause of a slowdown. High CPU alongside rising response times and workers that are all occupied can point towards a shortage of processing capacity. A server with low CPU might instead be waiting for a slow database query or an external API.

Other clues include requests waiting for a database connection, database locks holding up queries, or a growing queue of background jobs. Memory pressure can slow things down too. Each is worth investigating, but I'd want to see how it relates to the requests people are having trouble with before settling on a cause.

An example of where the time can go

Imagine an internal application that has a page showing a list of customer orders. The page worked well when it was first built, but over time the business has added more orders and people have started to notice that it takes longer to load. During the busiest part of the day, some users refresh the page because they are not sure whether it is still working.

The team considers adding another application server. First, they look at the time spent on a slow request. As an example, let's say it breaks down like this:

  • Total response time: 1,800 milliseconds, or 1.8 seconds.
  • Database query: 1,400 milliseconds.
  • Application processing: 250 milliseconds.
  • Other overhead: 150 milliseconds.

Most of the wait is in the database query. Another application server could handle more requests at once, but it would not make that query finish sooner. It might even allow more requests to reach the database while it is already busy.

The team inspects the query timings and its execution plan, which shows how the database intends to find the requested data. They find that the query fetches far more orders than the page needs, and the application then sorts and filters them before showing the first page of results.

The team tests a revised query that lets the database handle the filtering, sorting and pagination, returning only the orders needed for the page. They also check whether an index would help with the filters and ordering. Using representative data and realistic traffic, they compare response times and database load with the original query, while checking that other operations aren't affected. They can then decide whether to release the change and keep an eye on those measurements afterwards.

The right database optimisation depends on the application. An index can speed up a query, but it takes up storage and needs maintaining when data changes. Pagination can reduce the amount of data returned, although the team still needs to make sure it behaves sensibly as records are added or updated. Testing the effects on other important work helps avoid improving one page at the expense of another.

When adding capacity makes sense

There are plenty of situations where more capacity is the right answer. If application servers are consistently using most of their available CPU, requests are waiting for available workers, and the database and other dependencies have room to cope, adding another instance may give the application the headroom it needs. A larger server might also be appropriate, depending on the workload and how the application is deployed.

Before making the change, check whether the application can actually use the extra capacity. If it runs across several instances, for example, each one needs access to the information it requires to handle a request. Sessions stored only in the memory of one instance can cause problems if a later request reaches another. Background jobs also need to be handled carefully so that adding an instance does not cause the same work to be picked up twice.

It is worth thinking about what happens further down the chain too. More application instances may open more database connections or send more requests to an external service. If one of those dependencies is close to its limit, increasing capacity in one place can move the problem somewhere else.

Scaling can still be the right choice. Knowing what the workload needs and watching the rest of the system after a change helps you make it with more confidence.

Check the result

Whatever you change, try to compare the result with the original problem. If people were waiting for a particular page, look at how long that page takes under similar conditions. If jobs were building up during the day, check the size of the queue and how long jobs wait before they start. A lower CPU graph is welcome, but it does not tell you on its own whether the experience has improved.

Averages can also hide a poor experience for some users. The p95 response time is the time at or below which 95% of measured requests complete. Looking at it alongside typical response times can show whether slower requests have improved too.

Real workloads change, so the comparison will not always be perfect. A quiet afternoon is not a fair comparison with the busiest morning of the week. Where possible, look at the same kind of traffic and enough examples to see whether the improvement lasts. Keep an eye on errors and on the services your change depends on as well.

Sometimes the first change helps, but the application still isn't as responsive as you'd like. Improving one slow step can reveal another, which gives you somewhere to look next.

Questions to ask before adding servers

When a system is slowing down, these are the questions I would want to work through with the team:

  • What are people experiencing, and when does it happen?
  • Is the problem limited to one action or shared across the application?
  • What has changed in traffic, data, infrastructure or recent releases?
  • Where does a slow request spend most of its time?
  • Which resource or dependency is under pressure during the slow period?
  • Would another server relieve that pressure, and can the rest of the system handle the extra work?
  • How will we measure whether the change helped?

You don't need perfect monitoring to get started. A recent example and a few useful measurements can tell you a lot, and checking the result helps you understand whether you've made things better. Ultimately, that's what matters to the people relying on the application each day.

Dealing with a slow application or trying to work out where to improve performance? I'm always happy to talk through an engineering challenge.

THE CONVERSATION CONTINUES

Let's connect.

Have a thought on this article, or an engineering challenge on your mind? I'd be glad to hear from you.

CONTINUE THE CONVERSATIONLinkedIn.

KEEP EXPLORING / CAJS

Think.
Build.

Practical writing on backend systems, platform design and the decisions that make software easier to operate.