Friday, January 25, 2019

Steps involved from request to response of website

When you first type in an address, the browser will look up the hostname in DNS, if it is not already in the browser cache.
Then the browser sends an HTTP GET request to the remote server.
What happens on the server is really up to the server; but it should respond back with an HTTP response, that includes headers, which perhaps describe the content to the browser and how long it is allowed to be cached. The response might be a redirect, in which case the browser will send another request to the redirected page.
Obviously, server response time will be one of the critical points for perceived performance, but there are many other things to it.
When a response is returned from the server, the browser will do a few things. First, it will parse the HTML returned, and create it's DOM (Document Object Model) from that. Then it will run any startup Javascript on the page; before the page is ready to be displayed in the browser. Remember, that if the page contains any resources such as external stylesheets, scripts, images and so on, the browser will have to download those, before it can display the page. Each resource is a separate HTTP get, and there is some latency time involved here. Therefore, one thing that in some cases can greatly reduce load times is to use as few external resources as possible, and make sure they are cached on the client (so the browser don't have to fetch them for each pageview).
To summarize, to optimize performance for a web page, you want to look at, as a minimum:
  • Server response time
  • Bandwidth /content transfer time.
  • Make sure you have a small and simple DOM (especially if you need to support IE6).
  • Make sure you understand client-side caching and the settings you need to set on the server.
  • Make sure you make the client download as little data as possible. Consider GZipping resources and perhaps dynamic content also (dependent on your situation).
  • Make sure you don't have any CPU intensive javascript on Page load.
Ref: https://stackoverflow.com/questions/2896199/what-are-the-steps-involved-from-entering-a-web-site-address-to-the-page-being-d

No comments:

Post a Comment