How to Reduce 'Waiting Time' and 'Receiving Time' on Page Load
Asked Answered
S

2

11

I am using CloudFront and many time I see Wait Time and Receiving Time is too high.

According to Firebug document, Waiting time and Receiving time means:

Waiting - Waiting for a response from the server

Receiving - / (from cache) Time required to read the entire response from the server (and/or time required to read from cache)

I do not understand why it takes so much time and what I can do to reduce the time?

enter image description here

Solvolysis answered 5/10, 2013 at 14:4 Comment(1)
This could be due to Apache's reverse lookup settings: stackoverflow.com/a/13672919Israelite
L
6

There are multiple things you can do.

  1. Set appropriate headers Expires, Cache-control, ETag etc.
  2. Use gzipped versions of the assets
  3. User Sprites where possible. Merge your CSS files into one, merge your JS files into one

Run your site through WebpageTest.org and go through all the recommendations.

Run your site through YSlow and go through all the recommendations

Labrador answered 11/10, 2013 at 18:50 Comment(2)
Expires and those others are all set. Sprites or no sprite is not directly related to waiting time or receiving time! These time can be with sprited images. Ya, but it will once than few.Solvolysis
I think it was all due to CloudFront was not in India. Now it is in India but now I am not into web development.Solvolysis
K
6

Waiting

This means that the browser is waiting for the server to process the request and return the response.

When that time is long, it normally means your server-side script takes long to process the request.

There are many reasons why a server-side script may be slow, e.g. a long-running database query, processing of a huge file, deep recursions, etc.

To fix that, you need to optimize your script. Besides optimizing the code itself, a simple way to reduce the execution time for subsequent requests is to implement some kind of server-side caching.

Receiving

This means the browser is receiving the response from the server.

When that time is long, it either means your network connection is slow or the received data is (too) big.

To reduce this time, you therefore need to improve the network connection and/or to reduce the size of the response.

Reducing the response size can be done by compressing the transferred data e.g. by enabling gzip and/or removing unnecessary characters like spaces from the output before outputting the data. For HTML responses, try to reduce the size of the HTML structures. You may also choose a different format for the returned data, where possible, e.g. use JSON instead of XML for data or directly returning HTML.

Generally

To generally reduce the waiting and receiving times you may implement some client-side caching, e.g. by setting appropriate HTTP headers like Expires, Cache-Control, etc. Then the browser will only make rather small requests to check whether there are new versions of the data to fetch.

You can also avoid the requests completely by saving the data on the client side (e.g. by putting it into the local or session storage) instead of fetching it from the server every time you need it.

Kicker answered 19/2, 2017 at 0:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.