Answer the question
In order to leave comments, you need to log in
Does it make sense to upload all images to a subdomain?
Hello everyone, now this is probably a stupid question, but I'll ask it anyway.
I have a project that is already quite good online and a friend advised me to read about why it is worth keeping all images on a subdomain.
I read that in this way loading is faster in browsers.
Now the question is I have a website in three languages, that is, three different domains.
I can create a subdomain for the main version i.e. english and subfolders in them for all other languages.
What I see is that firstly it will be easier to work with images, especially those that have to be posted offline, banner ads and so on.
If I understand correctly, then you can also place scripts and other files on the subdomain.
The only question is how much faster will it be? Is there any sense in this? Is it some kind of homemade CDN for the disabled?
Answer the question
In order to leave comments, you need to log in
Yes, cookieless domain will speed things up a bit.
And you yourself saw some kind of simplification in storing images.
In addition, browsers have limits on the number of simultaneous connections to one domain. Since you most likely need to load scripts and styles as well, hosting images on a different domain will reduce this competition and speed up page loading a little.
The exact figures for the limits are here:
stackoverflow.com/questions/985431/max-parallel-ht...
CDN is a bit about something else. Delays in receiving content from a server located on the other side of the globe will be greater than from a server on the next street. CDN is primarily a geographically distributed network of servers so that the client can connect to the nearest one of his choice.
Relocation to a subdomain is a popular and rather meaningless recommendation for most sites. And often harmful.
"Acceleration" occurs due to two factors:
1) Due to the lack of cookies on this subdomain, there is an imperceptible micro-reduction in the amount of transmitted data.
2) Browsers have limits on simultaneous connections to a single domain, so theoretically this would allow for more download streams. In some specific cases, when there is a lot of content (in terms of the number of individual files), and parallelization itself works as a plus. And, in any case, not globally.
But it has one really significant disadvantage:
- Downloading from this subdomain will be delayed for the duration of the DNS query.
And in the end, this can even slow down the page loading and delay the start of rendering for the visitor. Especially in case of js\css.
Therefore, it is better to simply connect the site to a good CDN service. Of the proven ones, I can advise WSR . They have a good coverage of the regions in the Russian Federation / CIS, so there will be no problems with the download speed of statics at all. + they also cache dynamics, which can significantly offload server resources.
If you want to solve the issue of speeding up the loading of content through different subdomains, it's better to switch to HTTP/2.
You do not have to set up a bunch of subdomains, I have links in the site code to these subdomains. In this case, files from one domain will be downloaded in 1 connection. All popular latest browsers support HTTP/2.
Described here is configuring HTTP/2 in Nginx.
Placing content on a separate subdomain allows you to more conveniently manage this very content. For example, in order to connect to a CDN.
CDN is about speeding up the loading of static content by caching it on servers around the world.
If you have users from different cities, then the CDN option is fine.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question