DEV Community

Krishna Sagar R
Krishna Sagar R

Posted on

Flush those first bytes

series: strategic web performance

This is my first post from strategic web performance series where I publish my analysis and some strategies based on my understanding which may help other to understand and develop web applications by keeping performance in mind.

This post focuses on explaining the need of flushing the initial and critical HTML content to improve the server response times.

Let us start by understanding the journey of the page response from the server through telecommunications network, then we can think about strategies we can apply to design and applications with improved performance.

Alt Text

  • Browser sends request to the server and will be waiting for the server to respond.

  • If Server respond with HTML document after constructing complete document -- this will take several milli seconds or even more especially when construction of some parts of it require high computation or dependency on other systems.

Alt Text

Overlap

We will need to start flushing the meaningful HTML content to the stream as soon as it is available.

Alt Text

Then we will get an overlap of server time and network time. as when server is busy constructing remaining part of the page the response is already on the wire.

Alt Text

Discussion (0)