Re: Long URIs

>> Are Long URLs wasting bandwith?
>> http://tech.slashdot.org/article.pl?sid=09/03/27/2017250&from=rss
>
> It's been a few years since I went as far down the protocol stack as
> TCP/IP, but don't TCP packets have a minimum size? I would have
> thought that most HTTP requests would fit into a single packet, with
> no difference to the packet size. Or is my memory faulty here?

It depends on the underlying transport protocol. If your IP traffic is  
going over an ATM switch, your data is being broken down into 48-byte  
frames, in which case saving a few bytes in URL length can make a  
difference of a frame or two for every request.

On the other hand, if every host en route is using Ethernet-size  
packets, on the order of 1500 bytes, then yes, HTTP requests will  
typically fit into a single packet.

Perhaps more important is the inclusion of URLs in response bodies,  
not requests. I was intrigued by this, so I did a little digging.

Slashdot's front page right now is 75KB, which is about 50 1500B  
Ethernet frames (which might well be fragmented and recombined across  
multiple protocol layers en route). I was surprised to see that about  
10KB of that data (remaining size 65138 versus 75252 bytes) is  
composed of URLs in href, action, and src attributes.

Put another way: *outside* of protocol headers, 13% of Slashdot's HTML  
traffic is sending URLs back and forth. Shorter URLs, both internally  
and on the web at large (because many links are external) could cut  
their bandwidth bill by a noticeable amount. Not that significant  
compared to minifying CSS, Javascript, and HTML, or turning on gzip  
encoding, but every little helps when you're serving millions of  
visitors a day. (You'd also see a benefit at scale if you switched  
from XML to JSON or s-expressions. Every long tag name makes a  
difference!)

Those shorter URLs will also impact HTTP requests and responses, 302s,  
303s, and so on.

I could certainly imagine a measurable reduction in bandwidth usage by  
shortening URLs, particularly in formats that are URI-heavy, like  
readable RDF encodings. Whether that translates into a meaningful  
financial saving is another matter, which seems to be the most common  
objection to this article.

-R

Received on Friday, 17 April 2009 21:57:57 UTC