Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros and Cons of a separate image server (e.g. images.mydomain.com)?

We have several images and PDF documents that are available via our website. These images and documents are stored in source control and are copied content on deployment. We are considering creating a separate image server to put our stock images and PDF docs on - thus significantly decreasing the bulk of our deployment package.

Does anyone have experience with this approach?

I am wondering about any "gotchas" - like XSS issues and/or browser issues delivering content from the alternate sub-domain?

like image 521
qxotk Avatar asked May 26 '09 23:05

qxotk


Video Answer


2 Answers

Pro:

Many browsers will only allocate two sockets to downloading assets from a single host. So if index.html is downloaded from www.domain.com and it references 6 image files, 3 javascript files, and 3 CSS files (all on www.domain.com), the browser will download them 2 at a time, with the other blocking until a socket is free.

If you pull the 6 image files off onto a separate host, say images.domain.com, you get an extra two sockets dedicated to download your images. This parallelizes the asset download process so, in theory, your page could render twice as fast.

Con:

If you're using SSL, you would need to either get an additional single-host SSL certificate for images.domain.com or a wildcard SSL certificate for *.domain.com (matches any subdomain). Failure to do so will generate a warning in the browser saying the page contains mixed secure and insecure content.

like image 81
Chris Sears Avatar answered Apr 28 '23 19:04

Chris Sears


You will also, with a different domain, not send the cookies data with every request. This can increase performance.

like image 31
alex Avatar answered Apr 28 '23 21:04

alex