QA Interview Hub · Knowledge base · Quizzes · Українська

Networking

TCP/IP and the path of a request

OSI and TCP/IP models, IP, ports, TCP vs UDP

A network is split into layers so that each solves one task: OSI has seven, TCP/IP four. An IP address points to a host and a port to a process. TCP guarantees delivery and order, UDP does not but is faster. A failure is placed on a layer: ECONNREFUSED is transport (no listener), a connection timeout is dropped packets, a 5xx is the application or a proxy, so diagnosis goes bottom up.

Networking · TCP/IP

A test fails with ECONNREFUSED. Is it an HTTP bug, an app bug or a network problem?

A test hits localhost:3000 and gets ECONNREFUSED. A newcomer files a bug: "HTTP is broken". But HTTP has not even started: the system could not open a connection. To know where to look within a minute you need a simple map: which layers exist, what breaks on each and how they differ. This lesson gives that map and shows how to use it.

How it works and why. A network is split into layers so that each solves one problem and knows nothing about its neighbours. The OSI model has seven layers, TCP/IP has four. In an interview you do not need all seven by heart: what helps is placing a problem on a layer. TLS and WebSocket have no clean place in either model and are usually counted as the application layer.

TCP/IP layers and typical symptoms

Application: HTTP, DNS, TLS, WebSocket4xx, 5xx, wrong JSON, certificate errorTransport: TCP, UDP, portsrefused, timeout, reset, slow handshakeNetwork: IPhost unreachable, packet loss, MTULink: Ethernet, Wi-Fino link, weak signal, collisions
Figure 1. The error points to a layer: ECONNREFUSED is transport, 500 is application (the app), host unreachable is network.

The map dictates the order of diagnosis: lower layers first ("is there a connection"), then upper ones ("what did the server say"). If a 500 came back, TCP, IP and HTTP are fine and the search is in the application. If ECONNREFUSED came back, there will be no HTTP response at all, so opening the application logs is pointless until you know whether anything listens on that port.

IP, port, socket. An IP address (IPv4 or IPv6) points to a host, a port (0-65535) to a process on it. Common ports: 80 (HTTP), 443 (HTTPS), 53 (DNS), 22 (SSH), 5432 (PostgreSQL). A connection is uniquely defined by the IP addresses and ports of both sides. localhost is 127.0.0.1 (IPv6: ::1), the "this machine only" address. A service that listens only there is unreachable from outside the container or machine, while 0.0.0.0 means "all interfaces".

TCP and UDP: what you buy and what you pay

TCP: a reliable stream

A connection, acknowledgements, ordering, congestion control. You pay with a handshake and latency on loss. HTTP/1.1, HTTP/2, WebSocket, databases.

UDP: separate datagrams

No connection, no guarantees, no ordering, minimal overhead. DNS, voice and video, games, QUIC (under HTTP/3), which builds its own reliability.

Figure 2. These are two tools, not "good" and "bad": the choice depends on what matters more, reliability or latency.

Example: the port is published but nothing answers. The app runs in a container started with -p 3000:3000, yet from the host the request ends with Empty reply from server or Connection reset. This is a transport-layer symptom, and the diagnosis goes bottom-up:

docker run -p 3000:3000 app
curl -sS http://localhost:3000/health
# curl: (52) Empty reply from server   # or (56) Connection reset

docker exec <container> ss -ltn        # what listens inside
# LISTEN 0 511 127.0.0.1:3000 ...      # loopback only: the cause

The process listens only on 127.0.0.1 inside the container. Port publishing forwards traffic to the container's external interface, and nothing listens there. The fix in the application:

// listens on loopback inside the container only
app.listen(3000, '127.0.0.1');

// listens on all interfaces: the port can be published
app.listen(3000, '0.0.0.0');

Two subtleties. First: "works locally" without a container proves nothing, because loopback is reachable. Second: 0.0.0.0 exposes the service on every interface, so on a machine with a public address it is a security question, and outside containers it is switched on deliberately.

Limits and alternatives. Layer models are a map, not a law: QUIC, which HTTP/3 runs on, merges transport and encryption and sits on UDP; TLS straddles the border between application and transport. ping uses ICMP, not TCP: it may be blocked by a firewall while the service works. So "ping passes" does not mean "the port is open", and "ping fails" does not mean "the host is down". To check a port: nc -vz host 443 or Test-NetConnection host -Port 443 in PowerShell.

Common mistakes.

  • Reading ECONNREFUSED as an HTTP error and going to the app logs: there was no connection, so there are no logs.
  • Mixing up refused (port closed, instant answer) and timeout (packets dropped, no answer): the causes and the owners of the problem differ.
  • Checking availability with ping only: ICMP may be blocked while the port is open, or the other way round.
  • Starting a service on 127.0.0.1 in a container or on a VM and wondering why it is invisible from outside.
  • Treating UDP as "unreliable, so unusable": DNS and HTTP/3 run on it, with reliability built above.

Check yourself

A CI test gets connect ETIMEDOUT to a service, while on a laptop the same request gives an instant ECONNREFUSED when the service is off. How do the two cases differ and what do they say about the network?

Answer

ECONNREFUSED means the host is reachable and nothing listens on the port: the OS answered RST at once. ETIMEDOUT means there is no answer: a firewall drops the packets or the host is unreachable. In CI the picture is about the network (rules, routing), on the laptop about the process itself. Start by checking the route and rules between the runner and the service.

A service in Docker listens on 127.0.0.1:8080 and the port is published as -p 8080:8080. Why does a request from the host fail and what should change?

Answer

Port publishing forwards traffic to the container external interface, while the process listens only on loopback inside the container. The application or its config must listen on 0.0.0.0 (or the container interface address). Check it with ss -ltn inside the container.

In an interview. Junior: TCP/IP has four layers: link, network (IP), transport (TCP, UDP) and application (HTTP, DNS). An IP address points to a host, a port to a process. TCP guarantees delivery and order, UDP does not but is faster. Middle/Senior: I place an error on a layer: ECONNREFUSED is transport and nothing listens on the port, timeout means dropped packets, 5xx is the application or a proxy. So I diagnose bottom-up: DNS, port, TLS, HTTP. I also remember 127.0.0.1 versus 0.0.0.0 in containers and that ping checks ICMP, not port availability.

DNS: name resolution, records, TTL and cache

DNS turns a name into data (A, CNAME, MX, TXT) through a hierarchy of servers. A recursive resolver asks the root, the TLD and the authoritative server and caches the answer. Every answer has a TTL, and until it expires the cache returns the old address, so changes apply gradually. Discrepancies are diagnosed by comparing answers at different levels with dig, and TTL is lowered before a migration.

Networking · TCP/IP

After a server migration you see the new site and a colleague still sees the old one. Why?

The team moved the app to a new server and changed the A record. You open the site and see the new version, a colleague sees the old one, and CI keeps using the old address for two more minutes. One server, one record, different answers. The reason is that a name becomes an IP through a chain of caches, and each node of the chain has its own moment when the old answer expires. This lesson explains the chain, TTL and records, and shows how to see at which level the old answer got stuck.

How it works and why. DNS is a distributed database "name → data". No single server knows everything, so the system is hierarchical: the root knows who answers for .com, the TLD knows who answers for the domain, and the domain's authoritative server knows the answer. The client does not walk it all itself: it asks a recursive resolver (the ISP's, a corporate or a public one), which performs the walk and caches the result. Caching at every step is what makes DNS fast, and it is also what creates "stale" answers.

Where the answer to a DNS query comes from

1. Caches: browser, OS, hosts filethe fastest path, TTL applies2. Recursive resolver (8.8.8.8, 1.1.1.1)its cache is shared by many clients3. Root, then TLD (.com, .ua)they only point to who knows next4. Authoritative server of the domainthe source of truth: records and TTL
Figure 1. The answer comes from the first cache where it is still alive. A change on the authoritative server does not erase the caches above it.

Every answer has a TTL: how many seconds it may be kept. Until the TTL passes, a cache returns the old address even if the record has changed. Negative answers (NXDOMAIN) are cached as well, so a record that was just created may "not exist" for a while for those who asked earlier. A fresh answer is demanded when the TTL has passed, not when somebody changed the record.

A long or a short TTL

Long TTL (hours)

Fewer queries, faster answers. A record change arrives slowly: some clients keep going to the old address for a long time.

Short TTL (minutes)

Changes apply quickly, handy for migrations and failover. More DNS queries and more risk when a resolver fails.

Figure 2. That is why TTL is lowered in advance before a migration, at least one old TTL before the change, and restored once things are stable.

Records you must be able to read.

  • A name → IPv4, AAAA name → IPv6; if both exist, the client chooses, usually trying both (Happy Eyeballs);
  • CNAME an alias to another name (www → app.example.net). A CNAME is not placed at the zone apex, because it cannot coexist with other records, so providers offer "ALIAS" or "CNAME flattening";
  • MX mail servers, TXT free text (SPF, domain ownership checks), NS the domain's authoritative servers;
  • HTTPS and SVCB hints for the client, for example that the server supports HTTP/3.

Example: whose cache is lying. The record was changed but some users are still on the old address. Where the problem is gets decided by comparing answers at different levels:

# output shortened, numbers illustrative
dig +noall +answer app.example.com
# app.example.com. 3 IN A 203.0.113.10      # 3 s of TTL left: a resolver cache

dig +noall +answer app.example.com @ns1.example.com
# app.example.com. 300 IN A 203.0.113.99    # the authoritative server already gives the new one

dig +short app.example.com @1.1.1.1
dig +short app.example.com @8.8.8.8          # compare different resolvers

Read it like this. If the authoritative server returns the new address and the resolver the old one, the resolver cache is the cause and what remains is waiting for the TTL (or for the provider to flush). If the authoritative server returns the old address, the record was simply not changed, or was changed in the wrong zone. If dig shows the new address and the browser the old one, the cause is an OS, browser or per-process cache: the JVM, for example, has a cache of its own (networkaddress.cache.ttl), while Node has none and relies on the OS or on libraries. To flush the OS cache on Windows: ipconfig /flushdns.

Limits and alternatives. A DNS cache is not the only thing that holds an old address. Long-lived connections (keep-alive, WebSocket, a connection pool in a test client) keep talking to the IP they were opened with until they close, even after the TTL ends. So restarting the client solves more than waiting does. Different answers in different regions may not be an error but geo-balancing or a CDN: different resolvers return different addresses by design. DNS over HTTPS (DoH) and TLS (DoT) also exist: they encrypt the query but do not change the cache logic.

Common mistakes.

  • Changing a record and assuming "DNS has updated": the old answer lives until the TTL ends.
  • Diagnosing only from your own machine: ask specific resolvers (dig @1.1.1.1) and the authoritative server itself.
  • Putting a CNAME at the apex next to MX and TXT: the record conflicts with the others.
  • Not linking ENOTFOUND or ERR_NAME_NOT_RESOLVED to DNS: it is a typo, a missing record, an unreachable resolver or a VPN, not "the server is down".
  • Overriding an address in hosts to test and forgetting to remove it: the test then "works" on one machine only.

Check yourself

You changed an A record, TTL was 3600 s. After 10 minutes dig @ns1 shows the new address and dig @1.1.1.1 the old one. What does it say and what do you do?

Answer

The authoritative server already returns the new address, while the public resolver keeps the cache from the previous answer and refreshes it when the TTL ends, so within an hour of its last query at most. This is normal behaviour, not an error: for a fast switch the TTL is lowered in advance, and until then DNS is bypassed with curl --resolve or a hosts entry.

After a deploy a CI test keeps going to the old server for an hour although dig shows the new address. Name two causes that are not the resolver cache.

Answer

A DNS cache in the runner process or OS (its own TTL, flushing needs a restart) and a long-lived connection opened to the old IP that the client pool has not closed. Check by restarting the client or process and by closing the pool explicitly.

In an interview. Junior: DNS turns a name into an IP address. There are A, AAAA, CNAME, MX and TXT records. TTL says how long an answer can be cached, so changes do not apply at once. Middle/Senior: The answer goes through the browser, OS and recursive resolver caches to the authoritative server, so for discrepancies I compare answers at different levels with dig. Before a migration I lower the TTL in advance, and I remember negative caching, a CNAME at the apex and that long-lived connections do not read DNS again.

TCP handshake, TLS 1.3 and certificates

TCP opens a connection in three steps (SYN, SYN-ACK, ACK), and TLS 1.3 encrypts traffic and authenticates the server with a certificate in one RTT. The client checks the chain to a trusted root, the validity period and that the name matches the SAN. Refused means an RST from a closed port, a timeout means dropped packets, a reset means a cut connection. TLS checks are not disabled globally in tests.

Networking · TCP/IP

A stand test failed with a certificate error although everything worked yesterday. What changed?

The nightly run on the stand is red: certificate has expired. The code was not touched and the browser opens the page without errors because a developer already added an exception. Such a failure has two causes: the certificate really expired, or the client does not trust it. To tell them apart you must understand what happens between pressing Enter and the first data byte: the TCP handshake, then TLS. The lesson takes both steps apart and shows how to read their errors.

How it works and why. TCP builds a reliable stream on top of unreliable packets. Before data, the sides synchronise: the client sends SYN, the server SYN-ACK, the client ACK. That is one round trip (RTT). The connection is closed with FIN segments from both sides, and RST tears it down at once. These three signals stand behind the most common client errors:

SymptomWhat happened in TCP
Connection refusedthe port is closed, the OS answered RST at once
Timeoutno answer: a firewall drops packets, the host is off, no route
Connection resetthe connection existed and the other side tore it down (RST): a process crash, an idle timeout on a balancer

TLS gives three things: encryption, integrity and server authentication (and the client's too if needed, mTLS). In TLS 1.3 the full handshake takes one RTT: in ClientHello the client immediately sends the supported ciphers, its key share and the SNI (the host name, so one IP can serve many domains). The server answers with its share, the certificate and a confirmation, and everything after is encrypted. The application protocol is negotiated here too (ALPN): h2 or http/1.1. About 0-RTT on session resumption: early data can be replayed by an attacker, so it is allowed only for safe requests. TLS 1.0 and 1.1 are obsolete and disabled in modern browsers.

Before the first HTTP request

TCP: SYN, SYN-ACK, ACK1 RTT before the first data byteTLS 1.3: ClientHello, ServerHello, Finished1 RTT: keys, certificate, ALPNHTTP request and response, already encryptedone more RTT plus server time
Figure 1. A new HTTPS request costs two round trips before HTTP itself: TCP and TLS. That is why open connections are reused.

What the client checks in a certificate. A certificate binds a public key to a name. The client checks the signature chain up to a trusted root, the validity period, that the requested name matches the SAN entries (modern browsers no longer check the CN field) and, in some clients, the revocation status. So errors differ by cause:

  • ERR_CERT_DATE_INVALID: the certificate has expired (or the machine clock is off);
  • ERR_CERT_COMMON_NAME_INVALID: the requested name does not match the certificate, for example a request by IP or by another domain;
  • ERR_CERT_AUTHORITY_INVALID, UNABLE_TO_VERIFY_LEAF_SIGNATURE: a self-signed certificate or a missing intermediate in the chain;
  • in a corporate network, TLS inspection replaces certificates with its own root, and tools without that root complain about trust.

Reading the error: a certificate at navigation

1Error: page.goto: 2net::ERR_CERT_DATE_INVALID at 3https://staging.example.com/health
Call log:
  - navigating to "https://staging.example.com/health", waiting until "load"
  1. What: a failure at navigation, before any check on the page. The test logic is not involved.
  2. Cause: ERR_CERT_DATE_INVALID speaks about the certificate date: it has expired (or the machine clock is off). Not the name and not the chain: those have other codes.
  3. Where to look: the host from the URL. That is the one whose certificate is read with openssl s_client.

What to do

Check the certificate notAfter and ask the environment owner to renew it. ignoreHTTPSErrors is not a fix here: it would hide the real problem too.

Figure 2. The real Playwright error text (shortened): the numbers lead to the explanations.

Example: from a red run to the cause. Start with what the server really serves, without relying on the browser:

curl -sS https://staging.example.com/health
# curl: (60) SSL certificate problem: certificate has expired

openssl s_client -connect staging.example.com:443 \
  -servername staging.example.com </dev/null 2>/dev/null \
  | openssl x509 -noout -subject -issuer -dates -ext subjectAltName
# notAfter=Nov  3 09:12:00 2026 GMT        # illustration: the date is already in the past
# X509v3 Subject Alternative Name: DNS:staging.example.com

The notAfter date is in the past: the certificate expired, and this is the stand's problem, not the tests' code. If the date is fine, look at subjectAltName (is the needed name there), then at the chain (-showcerts): a frequent cause of "not trusted" is a server that serves the leaf certificate without the intermediate. The stand's owner fixes it by renewing the certificate and the chain. Turning checks off in tests as a "fix" is not allowed, because then the test would miss a real problem in production.

Limits and alternatives. For stands with a self-signed certificate Playwright has the ignoreHTTPSErrors option:

// playwright.config.ts
export default defineConfig({
  projects: [
    {
      name: 'staging',
      use: {
        baseURL: 'https://staging.example.com',
        // only for a stand with a self-signed certificate
        ignoreHTTPSErrors: true,
      },
    },
  ],
});

It is enabled narrowly for known harmless environments, not "just in case". Revocation checking is uneven: CRL lists have limits, OCSP is being phased out (Let's Encrypt stopped supporting it in 2025), so each client behaves in its own way. Certificate lifetimes keep shrinking: for public CAs the limit is lowered in stages, so automated renewal (ACME) becomes the norm, and expiry stays a typical cause of stand and internal service failures. Mobile apps with certificate pinning reject even a valid certificate if it is not the one embedded in the app.

Common mistakes.

  • Turning TLS verification off globally in tests: the test will not see an expired or wrong certificate in production.
  • Reading ECONNRESET as a "certificate error": a certificate concerns only the TLS step, while a reset is a TCP abort.
  • Connecting by IP instead of by name and wondering about COMMON_NAME_INVALID: SNI and name checks are tied to the name.
  • Not checking the clock of the machine or container: a wrong time yields an "expired" or "not yet valid" certificate.
  • Renewing only the leaf certificate and forgetting the intermediate: a browser will guess, but curl and Node will not.

Check yourself

curl returns connection refused, while another service on the same network gives a timeout. What do the two TCP failures have in common and how do they differ?

Answer

Both mean the connection was not established. Refused: the host is reachable, the port is closed, the OS answered RST at once. Timeout: there is no answer, packets are dropped (a firewall, no route, a powered-off host). Refused is diagnosed on the service host, timeout in the network and its rules.

Why is the TLS 1.3 handshake faster than TLS 1.2 and what is the limit of 0-RTT?

Answer

In TLS 1.3 the client sends its key share at once, so the handshake takes one RTT instead of two. 0-RTT on session resumption allows data to go with the first packet, but it can be replayed by an attacker, so the server accepts it only for requests that are safe to repeat.

In an interview. Junior: TCP opens a connection in three steps: SYN, SYN-ACK, ACK. TLS encrypts traffic and proves with a certificate that the server is who it claims to be. An expired certificate fails certificate validation. Middle/Senior: I tell refused, timeout and reset apart by TCP behaviour. In TLS 1.3 the handshake takes one RTT, the name goes in SNI, and the client checks the chain, validity, SAN and name. I read a certificate with openssl s_client and enable ignoreHTTPSErrors only for a known stand.

What happens when you type a URL in the browser

The browser parses the URL, finds the IP via DNS, opens TCP, runs TLS for HTTPS, sends the HTTP request and renders the response. Each step has a cost and a failure point: TCP and TLS 1.3 take one RTT each, then TTFB and subresources. For «slow», locate the step: Timing in DevTools shows each phase separately, while curl -w times accumulate, so a step is the difference of neighbouring values.

Networking · TCP/IP

A page opens slowly. At which step of the path "URL → screen" is the time lost?

The product team complains that the product card loads in 2 seconds. Someone says "the server is slow", someone "the CDN", someone "the JavaScript is big". Without understanding the path of a request this is an argument of opinions. With it, it is a table: every step has a cost and its own failure points. The classic interview question "what happens when you type a URL" is exactly about this: a strong answer is not a list of words but a sequence with time costs and failure points.

How it works and why. The browser performs steps in turn, each depending on the previous one: you cannot connect without knowing the IP and cannot send a request without an encrypted channel. So the times add up, and optimisation means skipping some steps or doing them in parallel.

The path from URL to screen

1. Parse URL, HSTS, caches0 ms if the response is fresh in cache2. DNSfrom 0 to hundreds of ms: cache or chain3. TCP, then TLS1 RTT + 1 RTT (HTTP/3: 1 RTT combined)4. HTTP request, waiting (TTFB)proxy, CDN, balancer, application5. Body, subresources, renderevery new domain starts at DNS again
Figure 1. The three "hot" steps before the first request (DNS, TCP, TLS) can be skipped by reusing a connection; waiting for the response depends on the server.
  1. URL parsing and caches. Scheme, host, port (443 by default), path, query. If the host is on the HSTS list, http:// becomes https:// at once without a request to the server. If the HTTP cache holds a fresh response (by Cache-Control), there is no network at all. A Service Worker can also answer instead of the network.
  2. DNS. Browser cache, OS, resolver, authoritative server. The cost is from zero to hundreds of milliseconds. Failure points: NXDOMAIN, an unreachable resolver.
  3. TCP. One RTT to the server on port 443. Failure points: refused, timeout.
  4. TLS. One RTT in TLS 1.3: SNI, certificate check, keys, and ALPN (h2 or http/1.1). The browser learns about HTTP/3 from the Alt-Svc header or the HTTPS DNS record and tries QUIC, falling back to TCP if UDP does not pass.
  5. HTTP request. GET /path with Host, Cookie, Accept. It may pass a CDN, a balancer and a reverse proxy before reaching the application. 3xx redirects repeat part of the chain.
  6. Response. Time to first byte (TTFB) shows server processing plus the road; then the body downloads.
  7. Render. HTML parsing, subresources (CSS, JS, images, API calls). Every new domain goes through DNS, TCP and TLS again; the same domain reuses an open connection.

The cold and the warm path

First visit, cold connections

DNS, TCP and TLS from scratch for every domain. A lot of time passes before the first response byte.

Repeat visit, warm connection

DNS cached, the connection open and reused, sometimes the response is fresh in cache. Almost all the time goes to the server.

Figure 2. The difference between a first and a repeat visit is why "it is fast on my machine" guarantees nothing.

Example: breaking "slow" down by numbers. Instead of guessing, measure the cumulative time of every step:

curl -sS -o /dev/null https://shop.example.com/ -w \
"dns=%{time_namelookup} tcp=%{time_connect} tls=%{time_appconnect} \
ttfb=%{time_starttransfer} total=%{time_total}\n"
# illustration: times are cumulative, not step durations
# dns=0.021 tcp=0.065 tls=0.121 ttfb=1.480 total=1.502

The values accumulate, so each step's duration is the difference of neighbours: DNS 21 ms, TCP 44 ms, TLS 56 ms, waiting for the response about 1.36 s, body download 22 ms. The network steps together are under 130 ms, so the problem is on the server or behind it: application, database, proxy. Optimising subresources fixes nothing here. A different split (large DNS and TLS with short waiting) would point at connection infrastructure. In DevTools the Network tab shows the same steps in Timing: DNS Lookup, Initial connection, SSL, Waiting for server response, Content Download. But there each phase is shown as its own duration, not as cumulative time as in curl -w (Initial connection includes SSL). A long Queueing or Stalled often means a queue, for example the six-connections-per-domain limit of HTTP/1.1.

Limits and alternatives. The sequence is simplified: a browser often performs steps ahead of time. It may open a connection before the page needs it (preconnect) or resolve subresource names before they are requested, and preload and dns-prefetch let a developer hint this explicitly. HTTP/2 and HTTP/3 allow many requests on one connection, so "every resource is a new handshake" is true only for a new domain. A page may not render until JS has run and API responses have arrived, so a "fast server" does not yet guarantee a fast screen. For the user, metrics such as LCP matter, not TTFB alone.

Common mistakes.

  • Answering with a list of terms without numbers or failure points: the interviewer wants to see that every step costs something and can break.
  • Reading time_connect as the duration of TCP: it is cumulative, and you subtract the previous value.
  • Drawing a conclusion about speed from one run with a warm cache and an open connection.
  • Forgetting that "slow" is often not the network: a long wait (Waiting) is the server.
  • Ignoring redirects: each 3xx adds another pass through the chain.

Check yourself

curl -w shows dns=0.020 tcp=0.070 tls=0.130 ttfb=2.600. How long was the wait for the response and where do you look for the problem?

Answer

The values accumulate: the wait is ttfb minus tls, that is 2.47 s. The network steps together are about 130 ms, so the problem is on or behind the server (application, database, proxy, CDN origin), not in DNS or TLS.

Why does the same site open faster the second time and what remains if you clear the browser cache?

Answer

The second time uses the DNS cache, an open connection, the HTTP cache and cached subresources. Clearing the browser cache removes only the HTTP cache; DNS and the open connection remain, so a "cold" visit is reproduced in a new window or profile with the cache disabled.

In an interview. Junior: The browser parses the URL, finds the IP through DNS, opens a TCP connection, and for HTTPS TLS too, sends an HTTP request, gets a response and renders the page. Middle/Senior: For each step I name the cost and the failure point: HSTS and caches, DNS, TCP and TLS at one RTT each, ALPN, TTFB, subresources with connections of their own. For "slow" I use Timing in DevTools or curl -w and localise the step first, and only then optimise.