3

So my site is SPDY. All of my local assets are SPDY too. But the majority of my assets are served from Rackspace's CloudFiles CDN. This is not SPDY.

Do those files get streamed through SPDY somehow, or are they pulled in via separate laborious HTTP requests?

I currently have these CDN assets split across 3 different sub-domains. Should I merge them all into one (as is the preferred serving method for SPDY files, to cut down on DNS lookups), or should I leave them as they are because they're coming over regular HTTP 1.1?

Thanks, I couldn't find any decent information on this via googling.

Codemonkey
  • 1,034
  • 2
  • 17
  • 36

2 Answers2

5

The best approach is to put everything on single domain using SPDY. If you can't do that, you need to calculate the appropriate number based on how many files you are serving.

DNS lookups will cost you about 20-120 milliseconds and are cached for varying periods. Most browsers in use at the moment allow 6 concurrent connections to a single domain (over HTTP) and 30 concurrent connections in total.

If you have more than 6 files they should be evenly split over (filecount/6) subdomains, up to a maximum of 5 subdomains.

Colin Pickard
  • 1,261
  • 2
  • 16
  • 28
  • Is a subdomain (assets.mydomain.com) suitable. Then I can specify cookies to sit on www.mydomain.com, so that they're not sent in any requests to assets.mydomain.com? Though I guess with SPDY and so long as my assets are mainly referenced in HTML/CSS (rather than independently requested) that might not be an issue? – Codemonkey Oct 14 '13 at 14:46
  • 1
    the reason for using cookie-less domains for images is largely mitigated by the header compression and pipelining in SPDY – Colin Pickard Oct 14 '13 at 16:27
0

Don't forget about caching. If you have several subdomains which use the same images and your users may visit all of those subdomains it makes sense to keep the same asset domains for all subdomains. Because no matter which subdomain your user visits, it's already cached.

Great answer @Colin Pickard

Fleshgrinder
  • 3,638
  • 2
  • 16
  • 19