Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've working on a simple HTML-CSS-JQuery based website and choose 000webhost as a free hosting provider.

It gives me sufficient space and bandwidth and a shared Unix based Apache Server.

Now on to my question, i had googled for pros and cons of managing subdomains especially for static data and concluded that, subdomain is good idea and can shared the load of HTTP request and response.

But what in my case where i've only one server available which is also shared?

Is it optimal to have subdomains on same server or its good to have just one domain and folder divisions?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Having multiple hostnames in URLs used to be quite important. There were mainly 2 reasons, which follow. But today I'd say it is often not that important.

The reasons are / used to be:

  • Sharding (an overloaded term): Older browsers would only open 2 connections per hostname. Thus if all HTML, CSS, JS & IMG files were retrieved from www.company.com then the browser would download at most 2 files at any time. Using multiple hostnames in internal URLs, i.e. http://www.company.com as well as shard1.company.com and shard2.company.com would speed up the downloads. This is no longer important, because all modern browsers use 8 or more parallel connections per hostname.

  • Cookieless subdomains: Assuming that www.company.com sets a number of cookies for stuff like login state and analytics, then there is a small performance benefit to serving static files from a cookieless domain, for example static-files.company.com. This still holds true today, and is still helpful -- but it is a smaller optimization. Cookies are usually quite small, and the time taken to transmit them is low, but of course it all adds up.

The classical book that broke the news about this is "High Performance Websites" by Steve Souders. Some of the specific recommendations in the book are a bit old, but it's still the best all-round introduction to frontend performance engineering there is.

share|improve this answer
    
Meanwhile, it is just a little advantage of subdomains as you said according to current scenario but is this little advantage continues on having subdomains hosted by same server? –  Asif Feb 6 '12 at 22:06
    
The mojor speedup to be gained in the second case (cookieless subdomains) has more to do with caches (both browser caches and reverse proxies), since caches tend not retain responses that look dynamic, and cookies are usually dynamic (they vary per user). –  TokenMacGuy Feb 6 '12 at 22:23
    
@Asif Yes, used with moderation cookieless domains will still increase page load performance, even if they point to the same IP address / server. Remember to upvote. –  Jesper Mortensen Feb 7 '12 at 1:40

Having different subdomains serving static files may improve page loading times, not only for more bandwidth or load-balancing advantages, but especially for how browsers manage data connections to remote servers: having a bunch of files served from an unique domain name will limit the number of parallel transfers, since the browser don't want to overload the webserver.

A better way to handle static files, should be to use a Content Distribution Network instead of your webserver.

If you want a general overview on your topic and related techniques to speed-up page loading, take a look here: http://developer.yahoo.com/performance/rules.html

share|improve this answer
    
Thanks for the link it has many other options useful for me... –  Asif Feb 6 '12 at 22:08

Having subdomains allows for cookies to be handled at each domain level. If your app can benefit from this, then you need subdomains.

Having subdomains also will allow you to scale out if you grow and host each subdomain on a different box down the road without having to do some crazy rewriting during the transition.

Having subdirectories is much simpler as there is nothing additional to configure. No extra DNS records, no extra virtual hosts, etc.

Really, it's up to you. Take future growth into account and choose what is best for you.

share|improve this answer
    
Ok thats good...i have to re-write and reconsider my expansion planing and then will turn towards what i now needs....thanks.. :) –  Asif Feb 6 '12 at 22:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.