PageSpeed : Minimize request size.

Published

Keeping cookies and request headers as small as possible ensures that an HTTP request can fit into a single packet.



What is an HTTP Request?


Whenever your browser fetches a file(maybe an html page, image, stylesheet,javascript or any other resource that can be received by a browser) , it does so using http Request.

http request is a request that made by client browser to server, to get a resource from server.

Browser : Hello server dude.. Get me that file named "index.html".
Server    : Ok . Browser dude.. I have the file. Take it.. 

That s happening for each file that is in a webpage.

HTTP request headers include:


Cookies.

For resources that must be sent with cookies, keep the cookie sizes to a bare minimum.
To keep the request size within this limit, no one cookie served off any domain should be more than 1000 bytes. Recommendation is that the average size of cookies served off any domain be less than 400 bytes.

Browser-set fields

Many of the header fields are automatically set by the user agent, so you have no control over them.

Requested resource URL (GET and Host fields)

URLs with multiple parameters can run into the thousands of bytes. Try to limit URL lengths to a few hundred bytes at most.

Referrer URL 

URL from where the page referred.


Solutions / Recommendations

Limit Cookie size. 

Make it small as you can. less than 400 bytes good.

Try to limit URL length.

 if you are using additional parameters you can try cut down the length by NOT using self-explainig parameters.
for example,
If you use something like below
http://example.com/?name=myname&age=myage&country=mycountry
try to use other version like below.
http://example.com/?n=myname&a=myage&c=mycountry



Comments

Post a Comment