Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
205 views
in Technique[技术] by (71.8m points)

How to create your own CDN? Is it just creating a subdomain?

I was wondering if it is possible to create my own CDN on my server through plesk alone?
I mean would creating an extra subdomain like cdn.mywebsite.com be sufficient?
And should I create a cdn subdomain for each website I create or should I create a subdomain with server space and upload all images?

question from:https://stackoverflow.com/questions/12402268/how-to-create-your-own-cdn-is-it-just-creating-a-subdomain

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The main point of a Content Distribution Network (CDN) is to put the content as close to the end-user as possible, thereby reducing the Distance component of the Round Trip Time (RTT) and speeding up the request. Simply serving static content from a sub-domain isn't really the same as using a CDN.

The advantages of serving content from such a sub-domain, however, are that

  1. The sub-domain can be a cookie-less domain

    If you use your cookies correctly (ie. don't have any *.mydomain.com cookies), you can dramatically reduce the size (ie. number of packets sent) of the HTTP request, which would save on bandwidth and speed up requests significantly if you use cookies heavily on the main site.

  2. The page can benefit from a more simultaneous requests being made by the browser

    Most browsers will make simultaneous requests for page assets, like images, fonts, CSS, etc. The catch is that most browsers will only allow a limited number of open requests to a particular domain (somewhere around 5 I think). By spreading your assets across multiple sub-domains, you "trick" the browser, and allow more parallel requests, since the limit applies to each sub-domain.

So, yes, you could set this up by just making a sub-domain, but you also have to make sure the cookies you are using don't get sent to requests for that sub-domain as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...