Background: Chrome has a requests queue. It will queue delayable requests under some circumstances. But I found it hard to determine which requests are causing the requests queuing.
My question is: do we have a way to dive into the root cause of the queuing issue ?
HTTP/1.1 vs HTTP/2
For HTTP/2 queuing has a different meaning and analysis. Read this great article on Head of Line Blocking (HOLB).
Here's my analysis of TTFB timings using Wireshark which could be a complement for the debug job.
HTTP/2
HOLB may have 2 causes: HTTP and TCP. Request blocking can still happen (perhaps over TCP reasons).
Having a HAR file for the page/site, find entries with
.blocked > 50
overtimings
(please, read HTTP/1.1 analysis below)jq -r '.log.entries | to_entries[] | select(.value.response.httpVersion == "HTTP/2" and .value.timings.blocked > 0) | [.key, .value.request.url, .value.timings.blocked]' stackoverflow.com.har
Result
HTTP/1.1
There are several reasons why Chrome could be queuing a request (as any other browser)
From the developer's tools Network tab, save the requests with
Save all as HAR with content
and analyze thetimings
object of each requestHAR could be filtered with
jq
, e.g. find entries with_blocked_queueing > 50
jq -r '.log.entries | to_entries[] | if(.value.timings._blocked_queueing > 50) then [.key, .value.request.url, .value.timings._blocked_queueing,.value.timings.blocked ] else empty end' stackoverflow.com.har
Result:
Then we could inspect 6 preceding entries of one of those requests
jq -r --argjson idx 67 '.log.entries[($idx - 6):($idx + 1)] | .[] | [.request.url, .time, .timings]' stackoverflow.com.har
Or get the highest
dns
jq -r '.log.entries | sort_by(.timings.dns|floor)[-1] | .timings.dns, .request.url' stackoverflow.com.har
Google offers an online HAR Analyzer that could be used similar to Dev tools Network pane.
Hovering over a request on the
Waterfall
column, the details of a request can be seen. As a first approach, long queuing requests could be preceded by one or several requests with high values on any of the items.Using the command line below to get a csv and then make a chart with