Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compacting Http Headers

Its so happening that my actual data is 1/4 that of the HTTP request header size in bytes.
Is there a way to cut down on the size on the HTTP headers or any other relevant way to deal with this situation?
I am sending data from a mobile device over GPRS to the server and dont want to be burdened with huge request packets that will eat into my $$ and also bandwidth.

like image 999
Kevin Boyd Avatar asked Sep 05 '09 17:09

Kevin Boyd


3 Answers

Well, what's taking up the bulk of your headers? For example, Stack Overflow recently moved most of the static content to another domain so that the SO cookies wouldn't be included in requests for the static content (which wouldn't use the cookies anyway).

If, however, most of the headers are just things the browser will always send (user agent etc) then there's not a lot you can do.

like image 65
Jon Skeet Avatar answered Sep 22 '22 05:09

Jon Skeet


I've never had to optimize site performance by chopping off headers. That said, most of the issues had to do with:

  1. Large number of unwanted GET requests. This was often due to the server not sending the appropriate expiry and caching headers back to the client. Sometimes it is a poorly written application.
  2. Large number of TCP connections being opened. Performance improves when you are able to keep the connection alive and reuse it to serve multiple requests. I'm unsure on whether mobile clients support keep alive.
  3. Usage of compression, or the lack of it. If there is anything that can cut down on expenses, it is the usage of compression. However, I'm not so sure of mobile clients being able to support compression. By the way, one normally does compression for responses, and not for requests (all browsers that I know of, never compress the request although the HTTP spec allows for it).

If you still need better performance after #3, your application needs some form of performance design review.

like image 43
Vineet Reynolds Avatar answered Sep 23 '22 05:09

Vineet Reynolds


I consider the headers as "Architecture", that is: "their exact content vary from application to application according to the requirements".

Once you have the exact current list, using the links provided in this post,
you can see which ones you need, and avoid sending the others.

Who knows if it makes a significant difference, but at least you can rest assured that you made your best on that topic.

like image 44
KLE Avatar answered Sep 23 '22 05:09

KLE