Aside from use of CDNs, using separate domains for static data also means:
You can use a lightweight web server that doesn't have to load all the modules/extensions that your dynamic content web server has to load on every single request. Not having to scan each directory in the URI path to read .htaccess files also increases the number of simultaneous requests the server can handle.
Adding an extra subdomain means you increase the number of parallel downloads that the browser can perform.
If set up properly (e.g. your site is hosted on www.example.com
instead of example.com
), you can also take advantage of a cookieless subdomain, reducing traffic and roundtrip times.
The only downside is, if you're using SSL sessions, you need a signed certificate and separate static IP for the additional domain(s). But the benefits outweigh this minor inconvenience in most cases.
Edit:
Sorry, I misread your question. If you're asking why some people use separate SLDs, that would be answered by the parenthesis on #3. It's also explained on sstatic.net:
If your domain is www.example.org, you can host your static components
on static.example.org. However, if you've already set cookies on the
top-level domain example.org as opposed to www.example.org, then all
the requests to static.example.org will include those cookies. In this
case, you can buy a whole new domain, host your static components
there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube
uses ytimg.com, Amazon uses images-amazon.com and so on.
But incarnate also mentions a good point about using a separate generic SLD instead of a subdomain of an existing SLD when you're running a large network of sites that share certain assets.
Lastly, as Niels Basjes points out, part of the reason for eliminating cookies is to minimize the number of packets used to perform a request. I think the YSlow guidelines state that most networks have a max packet size of 1500 bytes, so keeping it under 1500 bytes would reduce TCP overhead. This also demonstrates another advantage of using sstatic.net
instead of static.webmasters.stackexchange.com
.