What does "Blocked" really mean in the Firefox developer tools Network monitoring?
Asked Answered
D

5

96

The timing section of the Firefox Network Monitor documentation, "Blocked" is explained as:

Time spent in a queue waiting for a network connection.

The browser imposes a limit on the number of simultaneous connections that can be made to a single server. In Firefox this defaults to 6

Is the limit on the number connections the only limitation? Or is the browser blocked waiting to get a connection from the OS count as blocked too?

In a fresh browser, on a first connection, before any other connection is made (so the limit should not apply here), I get blocked for 195 ms.

enter image description here

Is this the browser waiting for the OS? Was does "Blocked" mean here?

Diazole answered 4/5, 2017 at 13:10 Comment(3)
I have the same question. It's really very confusing that when its the only website we are opening on firefox why it shows blocked for several seconds?Sunn
you're lucky, I got blocked for 180516 ms... I actually thought the site was deadBronwen
for me this only happens for certain websites when connected to a VPN. Really weird.Hali
C
11

We changed the Firefox setting (about:config) 'network.http.max-persistent-connections-per-server' to 64 and the blocks went away. We changed it back to 6. We changed our design/development method to a more 'asynchronous' loading method so as not to have a large number simultaneous connections. The blocks were mostly loading a lot of png flags for locale settings.

Cusec answered 23/9, 2019 at 6:36 Comment(2)
Setting 'network.http.max-persistent-connections-per-server' to 64 seems to have resolved it for me, thanks!Casavant
Note that firefox needs to be restarted for this to take effectToothsome
G
6

Time spent in a queue waiting for a network connection.

The browser imposes a limit on the number of simultaneous connections that can be made to a single server. In Firefox this defaults to 6, but can be changed using the network.http.max-persistent-connections-per-server preference. If all connections are in use, the browser can't download more resources until a connection is released.

Source : https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor

It's very clear that the browser fixes the limit to 6 concurrent connections per server (domains/IP), the OS question is not very relevent.

Grandsire answered 22/7, 2017 at 0:59 Comment(8)
But this does not explain why "In a fresh browser, on a first connection, before any other connection is made (so the limit should not apply here), I get blocked for 195 ms." Or does that mean that the highlighted request is not the first on the queueWeisburgh
I think that you maybe had another tab opened with background requests sent to google.ca server. It's not very clear in the doc if the limitation is applied to each tab or to the whole browser, you should try with only one tab opened in your browser and see the result.Grandsire
@Grandsire no, by fresh browser I mean a browser that has just been started and that does not have any other tab or window. I just tried with FF v57 (Quantum), and am still getting "blocked" for 148 ms on the very first request, which eventuall get a 301. The next two are blocked for 109ms and 400ms respectively. Those are the very first 3 requests, I still don't understand why they are blocked.Diazole
I bet that even when a connection is not in use, the overhead of queueing itself is counted as blocking.Convulsion
Firefox DevTools member here: This answer is correct (requests being queued based on limits & heuristics; don't get hooked on specific numbers) with the only caveat that a busy main thread (which handles all networking) can also delay request handling.Communicant
@Communicant if somehow what is consuming the main thread/blocking can be exposed it would be awesome. I have scenarios when no other tabs are open, no addons should be running, no visible requests are active, but I still get ~500ms of blocking before an AJAX request is sent to the HTTPS domain I'm already logged into. e.g. I don't think anything should be blocking, but something is. I need to be able to determine what it is.Freespoken
@Communicant I've attempted to give an answer based on actual wireshark traces. Could you comment on that?Reorganize
@Communicant There's got to be something more to this. "requests being queued based on limits & heuristics" Why would the very first request be blocked? Why would an https request always be block for > 300ms but an http request be blocked for ~50ms? Fresh browser: "google.com" 1st request blocked for 86ms (301) Fresh browser: "https : // google.com" 1st request blocked for 249ms (200) DNS request comes AFTER being blocked. What is FF doing for 249ms? Or even 86ms before even querying DNS?Diazole
R
6

I have a server that takes several seconds to respond, which allowed me to cross-reference the firefox measurement with a wireshark trace. I see that the first SYN is sent out immediately. The end of the "Blocked" time corresponds to when the Server Hello comes back.

I couldn't relate the end of "TLS setup" to any wireshark packet. It extends a few seconds belong the last data that is exchanged on the initial TLS connection.

Bottom line: it doesn't look like the time spent in "Blocked" and "TLS setup" is very reliable, at least in some cases.

My setup has a TLS reverse proxy that forwards the connection with SNI. I'm not sure if that might be related.

Reorganize answered 2/10, 2018 at 13:25 Comment(1)
But looking at the chart, DNS resolution happens after the Blocked phase?Armes
V
3

In my case both waiting for network connection and DNS lookup times were pretty high, up to 2 seconds each, caused significant page load times if the page was loaded for the first time. Firefox was freshly installed without addons and just started with no other opened tabs. I tried on both Ubuntu 18.04 LTS and Ubuntu 19.04 with the same results. Although my ISP doesn't provide support, my router assignes IPv6 addresses. As it turned out the problem was the IPv6 broken network, which forced Firefox to fall back to IPv4 (of course after some time(time-out)). After I turned off the IPv6 support in Linux the requests speeded up significantly. Here is a relavant discussion: https://bugzilla.mozilla.org/show_bug.cgi?id=1452028

Viscera answered 7/7, 2019 at 15:44 Comment(0)
B
1

I encountered this error whilst using an Angular 9 'dist' deployment. I discovered that the error appeared because I was trying to access an unreachable API, according to the specified IP address and port.

Therefore to solve it, I just have to reference a valid and accessible API.

Bouldin answered 2/11, 2020 at 7:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.