Friday, September 26, 2008

S3. Should you use subdomain or directory for bucket?

When you create a bucket on S3 to host media content for public access there are two ways you can create the URL.

http://bucket-name.s3.amazonaws.com/

Or

http://s3.amazonaws.com/bucket-name/

Sometimes people name their buckets with their domain name, which just looks good. Otherwise it is same as first or second one.

Here is my unscientific observation done via wget. The method of using sub-domain is slower.

Here is why.

If bucket-name.s3.amazonaws.com domain is not extremely popular, name resolution takes some time. The subdomain s3.amazonaws.com is few orders of magnitude (think thousands of times) popular than the ones with bucketname prefixed to it, domain resolution happens very quickly.

Of course, once that domain is found, the subsequent requests should be faster with DNS caching. But this problem will again arise when the DNS is flushed.

Tell me how wrong I am on this.

Labels: ,


Comments: Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]