Mobile app version of vmapp.org
Login or Join
Fox8124981

: Images on a subdomain, hosted on the same server — will simultaneous downloads increase? (CDN) Browsers only allow you to download a limited number of concurrent files from the same domain.

@Fox8124981

Posted in: #Browsers #Cdn #ImageHosting #PageSpeed #Subdomain

Browsers only allow you to download a limited number of concurrent files from the same domain.

Would a subdomain for images (basically as a content delivery network) on the same web hosting server increase the number of files that can be downloaded simultaneously?

(And thus improve page loading time?)



Consider this example:
example.com img.example.com


The img subdomain is hosted on the same web server (same IP & location) as the www domain.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

2 Comments

Sorted by latest first Latest Oldest Best

 

@Welton855

Yes or no. Your assumption is correct and that more resources can be loaded in parallel by the browser if they are served from multiple domains. There are two cases to consider though:


Your server is not presently serving at maximum capacity: In this case more requests being served simultaneously is better. Visitors who's download bandwidth is not already maxed out will see reduced page-load time.
Your server is serving at maximum capacity: There will be little change, it may even slow down due to the overhead of getting and handling more requests. The way to speed up in this case is either to upgrade the server or use an actual CDN network.


You should look at your server performance logs to see which is the case. CPU usage is a good indicator when images are expected to be cached for the general case (you serve mostly the same images over-and-over). Disk usage is a better indicator when your image set is so large that it wont be cached so often (you serve different images to different users as for most personal gallery sites).

10% popularity Vote Up Vote Down


 

@Nimeshi995

Short answer yes using a sub domain will enable parallel downloading that can will improve the amount of fetches sent and received at any one time, also you can setup the sub domain to be cookieless with good expires which will further emulate the use of a CDN.

But bear in mind the following:


CDN mirrors your files all over the globe and speeds up the site for people all over the globe.
CDNs are extremely cheap.
Good CDNs do not slow down and scale with demand.
CDNs do not eat up your server resources up while server providing all the client requests can.
Using a CDN adds an additional layer of security if the main site gets hacked, Assuming you don't bare your API key.
CDN provide also API based features that allows you do to lots of funky stuff.
Data loss doesn't really happen on CDNs since 1, your files are mirrored all over the globe and 2 they use fail proof raid setups while your own server may not.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme