Friday, September 16, 2016

domain - Using Subdomain on Same Server : Good or Bad & Why?



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?


Answer



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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...