Nginx – Why the browser wouldn’t load all image resources at once

nginxstatic-filestime

I am trying to optimize the loading time of a webpage. Currently, the main http request can be done in under a second, however, the consenquent loading of images seems "to cascade":

http://picpaste.novarata.net/pics/320bd387b4988729ad2dbb10f69a7857.png

I am using nginx to serve my static files, with 3 workers. Is there a possiblity that connections are being held by backlog?

I would assume that all of these images would be loaded at the same time. Files are being served over HTTPS, with keepalive set to 65 seconds.

EDIT: Firefox indeed seems to try to load them at once, however, the connection time is gradually increasing up to more than 2 seconds:

http://picpaste.novarata.net/pics/32c28414501d165df3e04b01e3ac3084.png

Best Answer

This behaviour depends on your browser. If you use Chrome, for example, you might find the Timing graph shows the same behaviour, but that things are 'stalled' for a while; this is likely due to [Chrome's] limit of 6 concurrent connections per origin.

You don't say what browser&version you are using.

Here's an extract from https://developer.chrome.com/devtools/docs/network#resource-network-timing

Stalled/Blocking Time the request spent waiting before it could be sent. This time is inclusive of any time spent in proxy negotiation. Additionally, this time will include when the browser is waiting for an already established connection to become available for re-use, obeying Chrome's maximum six TCP connection per origin rule.

Related Topic