DEV Community

Cover image for You Sent One Request. Your App Did Six Things First.
vasundhra singh
vasundhra singh

Posted on

You Sent One Request. Your App Did Six Things First.

When an iOS app feels slow, developers often look at the API first.

The endpoint is responding slowly.

The backend must be the problem.

But what if the server isn't actually the main issue?

Before an API response reaches your app, a network request can pass through several stages — and each one adds time.

Understanding those stages can completely change how you debug mobile networking.

The Journey of a Network Request

A request isn't simply:

App → Server → Response

There is much more happening underneath.

A useful way to think about a request is:

DNS → TCP → TLS → Request → Waiting → Download

Each stage has its own job, and each can become a source of delay.

Let's break them down.

1. DNS: Finding the Server

Before your app can communicate with a domain, it needs to determine where that domain lives.

That's where DNS comes in.

For example, when your application communicates with:

api.example.com

the system needs to resolve that hostname to an IP address.

If DNS resolution takes longer than expected, the request hasn't even reached the server yet.

This is why looking only at the server's response time can sometimes be misleading.

2. TCP: Establishing the Connection

Once the destination is known, the connection needs to be established.

With TCP, the client and server perform the connection handshake before data can be exchanged.

This stage can become noticeable when:

  • The connection isn't already established
  • Network conditions are poor
  • The server is geographically far away
  • Connections are repeatedly being created

A request that looks slow from the user's perspective may have spent a significant portion of its time establishing the connection.

3. TLS: Securing the Connection

For HTTPS requests, there's another important step: TLS.

TLS establishes a secure connection between the client and server.

It provides encryption and helps verify that the client is communicating with the intended server.

But it also takes time.

When debugging HTTPS performance, separating TLS time from the rest of the request can help you understand where the delay actually occurs.

4. Request: Sending the Data

Now the application can actually send its HTTP request.

This includes things such as:

  • HTTP method
  • URL
  • Headers
  • Cookies
  • Request body

At this point, developers often start thinking about the backend.

But we're still only partway through the journey.

5. Waiting: The Server Is Processing

The request has reached the server.

Now the application waits.

The server might need to:

  • Authenticate the request
  • Query a database
  • Call another service
  • Process business logic
  • Generate a response

This is the stage most developers immediately associate with "API latency."

And sometimes, that's exactly where the problem is.

But without separating the other stages, you don't know that for sure.

6. Download: Getting the Response Back

The server has responded.

But the response still needs to travel back to the device.

A large response can take longer to download, especially when network conditions aren't ideal.

And a response that contains several megabytes of data may create a very different experience from a small JSON payload.

This is why response size matters just as much as server processing time.

Why Breaking Down Timing Matters

Imagine an API request takes 1.8 seconds.

At first glance, that sounds like a slow backend.

But imagine the timing looks like this:

DNS: 50 ms

TCP: 100 ms

TLS: 150 ms

Request: 50 ms

Waiting: 1,300 ms

Download: 150 ms

Now you have a much clearer picture.

The backend's processing time is probably the biggest contributor.

But imagine another request:

DNS: 500 ms

TCP: 400 ms

TLS: 300 ms

Request: 50 ms

Waiting: 350 ms

Download: 200 ms

That is a completely different problem.

The server isn't necessarily the main bottleneck.

Without phase-level timing, both requests simply look like "slow API calls."

Don't Debug From One Number

One of the biggest mistakes in network debugging is treating total request duration as the entire story.

A single number tells you how long something took.

It doesn't necessarily tell you why.

When investigating performance, look for questions such as:

  • Did DNS resolution take too long?
  • Was a new connection created?
  • Did TLS negotiation add significant latency?
  • Is the server taking too long to respond?
  • Is the response unusually large?
  • Are network conditions affecting the download?

The more granular your visibility, the faster you can move from guessing to diagnosing.

What About HTTP/2 and HTTP/3?

Modern applications don't necessarily communicate using only HTTP/1.1.

HTTP/2 and HTTP/3 introduce different approaches to transporting requests and responses.

When debugging networking, knowing which protocol is being used can provide valuable context.

TLS details can also matter when investigating secure connections.

The goal isn't to memorize every networking specification.

It's to have enough visibility to understand what your application is actually doing.

And What If You're Using WebSockets?

Traditional HTTP requests aren't the only networking pattern developers need to debug.

WebSockets maintain a persistent connection and allow data to move in both directions.

That makes debugging them different.

Instead of looking at isolated request/response pairs, you may need to understand individual frames, their direction, type, and size.

For developers working with real-time features, that visibility can make troubleshooting significantly easier.

The Better Way to Debug

The next time someone says:

"The API is slow."

Don't immediately start changing the API.

First ask:

Where is the time actually being spent?

Break the request into its individual phases.

Look at the protocol.

Inspect the headers and body.

Check the response size.

For WebSockets, inspect the individual frames.

And compare a slow request with a fast one.

That shift — from looking at the total time to understanding the entire journey — can make network debugging much less frustrating.

Final Thoughts

A network request may look like a single action from the application's perspective.

Underneath, it's a sequence of events.

DNS. TCP. TLS. Request. Waiting. Download.

When developers can see those stages separately, "the app feels slow" becomes a much more actionable engineering problem.

Tools such as Owlse are designed to give developers that deeper visibility into iOS networking, including request phases, protocols, TLS details, WebSocket frames, request comparisons, and response inspection.

The fastest way to fix a networking problem isn't always to change the code.

Sometimes, it's simply to see what's actually happening.

Top comments (0)