Speed is one of the few product characteristics that the user feels before being able to explain. No one opens a website and thinks "the latency here is high". People just feel like something is slow, they get impatient and leave. Latency is invisible until it becomes abandonment.
For those who are starting to delve into web performance, the first confusion is treating latency as a synonym for "slow internet". It is not. Latency is the time between an action and the response to that action, and it is built by a chain of factors that go far beyond the user's connection. Understanding this chain is what separates those who initiate optimizations from those who solve the problem at the source.
This text is a base. The goal is not to deliver recipes, but to give you the vocabulary and mental model to reason about latency clearly, because without understanding where it comes from, any optimization becomes trial and error.
What is latency, in fact
Latency is waiting time. When someone clicks a button and something needs to happen on the server, there is a delay between the click and the visible response. This interval is the perceived latency, and it is the sum of several smaller times.
It is useful to separate latency from throughput, two concepts that are often confused. Latency is how long a single request takes. Throughput is how many requests the system can handle per second. You can have a high-throughput and high-latency system at the same time, it serves a lot of people, but everyone waits. For the individual user, what matters is latency. For the operation, both are important.
The central thesis of this text: latency is a sum of steps, and you only improve what you can see. Anyone who treats latency as a single, opaque number is stuck with generic optimizations. Whoever breaks down the chain discovers where time is really lost.
Where does latency come from
Imagine the path of a typical request, from the user's click to the response on the screen. Each stretch of this path adds time.
There is physical distance. Information travels across the network at a finite speed, and the distance between the user and the server matters. A server on another continent adds tens of milliseconds just for the round trip, before any processing. For a Brazilian public served by distant infrastructure, this is a real part of the problem.
There is the establishment of the connection. Opening a secure connection involves an initial negotiation between client and server that costs round trips across the network. Repurposed connections pay this cost once; new connections pay every time.
There is processing on the server. The time it takes the application to understand the request, query databases, execute the business logic and assemble the response. This is where much of the latency lives that teams can directly control.
There is data querying. Database is often the biggest hidden villain. A poorly indexed query, a call that triggers dozens of other queries in a row, a slow external service in the chain, any of these turn a quick response into a wait.
And there's in-browser rendering. Even after the response arrives, the browser needs to process it and draw the screen. Heavy JavaScript, blocking resources, and large images add time in the last section, right where the user is looking.
Why this matters for business
It's tempting to view latency as an engineering issue only. It's a management error. Latency has a direct effect on conversion, retention and perception of quality. Slow applications are abandoned, and abandonment does not ask for permission.
Think of a public services portal. The citizen who tries to issue a duplicate, schedule an appointment or consult a benefit does not have infinite patience, and is often accessing it from a cell phone with a modest connection. If each step takes time, the completion rate drops, face-to-face service swells and the perception that "the government system doesn't work" is reinforced. Latency, in this case, is a barrier to accessing a right.
In private products, the logic is the same under another name: every second of waiting is money going out the door. That's why latency shouldn't be a concern that only appears when the user complains. It should be an indicator monitored as one would monitor revenue.
Measure before optimizing
The most common mistake made by those learning about latency is to start optimizing before measuring. You add cache here, rewrite a function there, all by intuition, and the result is scattered effort with no clear impact.
The correct discipline is the opposite. First measure where time is lost, then attack the biggest bottleneck. Latency usually follows an uneven distribution: a single step can account for most of the total time. Optimizing others is wasteful.
It is also worth looking not only at the average, but at the worst cases. Average latency may seem great while a relevant fraction of users experience long waits. It is precisely these users, those in the bad percentile, who abandon and complain. A good average can hide a terrible experience for many people.
The trap of optimizing the invisible
There's a risk on the other side of performance enthusiasm: optimizing what doesn't matter. Excited teams spend weeks saving milliseconds on a part that the user never notices, while the biggest wait remains intact.
Performance is always a matter of proportion. Reducing a step that represents little of the total time does not change the experience. Maturity lies in resisting the temptation of elegant optimization and asking, first of all, whether it moves the number that the user feels.
Another pitfall is treating latency as a problem solved after a round of improvements. Systems evolve, data grows, new features add calls. Latency goes up again if no one is looking. It's an indicator to continually monitor, not a task to cross off the list.
Closing
Latency is the invisible tax that every web application pays, and the user is the one who feels the bill. Understanding its fundamentals, that it is a sum of steps, that it is measured before optimizing, that it matters for the business as much as it does for engineering, is the first step to building products that people do not abandon out of impatience.
Speed is neither a luxury nor a technical detail. It's part of the promise your product makes. Those who treat performance as a product decision, and not as a last-minute adjustment, deliver experiences that respect the time of those on the other side of the screen.
If you are starting to look at the performance of your application more seriously, it is worth doing so with measurement in hand from the beginning. There are other articles here on the blog about architecture and scalability that go deeper into the topic.
Also read
- Reduce latency in web applications: a quick guide to attacking the right bottlenecks
- Progressive Web Apps for beginners: examples and optimization without complicating things
- PWA: what it is and how to take care of performance on a daily basis
- Automated Testing: Architecture and Fundamentals
- Edge computing: why distributed processing will redefine your architecture
- Edge Computing Architecture: Strategies for Distributed Processing
