My opportunity hosts about 30 internet sites all discussing exactly the same code base and re-using most of the same images. At this time, the pictures its the websites are located about the one domain, after which almost every other site needs to connect to individuals images.

i.e., world wide web.example.com/images/hello.digital

as well as on world wide web.example2.com we now have something similar to: <img src="http://world wide web.example.com/images/hello.digital" />

Lately someone explained which i ought to be putting many of these shared/static images on the subdomain, however i aren't seeing the benefits for this. I've heard that there can be a small speed increase, but I have also heard that it may complicate things. Can someone elaborate?

A few benefits of it:

  • Another domain prevents your domain's snacks from being sent for each image request, where they are unnecessary. Cuts down on the bandwidth overhead for every request.
  • Most browsers is only going to create a certain quantity of HTTP demands previously to particular domain, so serving images along with other static content off another domain potentially doubles the amount of HTTP demands previously.
  • You are able to certainly make use of a different, lighter in weight webserver like nginx/lighttpd for everyone the static content.

Disadvantages:

  • Controlling it.
  • Two DNS searches rather than one.

Whenever a browser is asking for static files like CSS and Javascript, it frequently limits the amount of connections to some given server/sub-domain. Putting static files within different domain enables more synchronised downloads.

If setup properly, the various sub-domain might be a directory in your webserver. Is dependent in your config-file-fu.

This really is covered in a few the Stackoverflow podcasts.

One concern - if you're serving an https page the consumer could get an alert about a mixture of secure and insecure products.