: Is there a benefit to running assets on a subdomain if subdomains can increase time to first byte? A few days ago, I conducted a major experiment on my site. Before then, I had major sections
A few days ago, I conducted a major experiment on my site. Before then, I had major sections of the site categorized as domains. For example:
pictures.example.com/whatever http://help.example.com/whatever internalstuff.example.com/whatever http://tips.example.com/whatever
Now I converted most of the domains into one so that accessing the same resources is as follows:
example.com/pictures/whatever http://example.com/help/whatever example.com/tips/whatever http://internalstuff.example.com/whatever
I left one subdomain alone because its strictly meant to be used for assets but I'm wondering if that is even a good idea anymore because I have my site currently setup to load pictures after the HTML loads, not while the HTML loads.
After converting 6 subdomains into one domain using the method above, and running mobile tests with webpagetest.org, it turns out the time to first byte significantly decreased from 210ms to about 135ms.
So my question is, with such a large image site like mine, Am I better off to just run everything off of only one domain and hope for the lowest time to first byte, or should I keep my assets running off of a subdomain?
I'm just trying to figure out if there is really any kind of advantage to using a subdomain.
And as a side note, since the merge, my income at least doubled on average.
More posts by @Angela700
2 Comments
Sorted by latest first Latest Oldest Best
Don't confuse with HTTP/2, because webmaster still need to use cookie less subdomain or external domain to serve asset files.
Don't use subdomain to serve static assest, if you're using naked domain like stackoverflow.com, because if you use third party service like Google analytics, then your cookies will pass to all other subdomain. So use subdomain only, if you're using www or similar subdomain to serve webpages.
Based on your comment "I should add that for 99% of the pages a maximum of 4 items are downloaded" the answer for your use-case is definitely no. Four page assets are well within the maximum number of connections a modern browser will make, and spreading those four page assets across multiple domains is pointless.
For others reading your question title and wanting a more general response, the answer is definitely yes. That's because most websites have more page assets to load and spreading them out across domains helps. Here is an implementation guide from GTmetrix which is a great place to start learning more about it.
Note that newer versions of web servers are starting to support HTTP/2 which alleviates this restriction and permits many more concurrent downloads at once. That's probably the best choice going forward but it requires more work to set up.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.