Best performance for storing static files (images, css, javascript) - CDN - BlobStorage or WebRole

走远了吗. 提交于 2019-12-13 12:29:33

问题


I have a very basic question about CDN - BlobStorage and WebRole, and perfrormance.

I have a very simple web site with static content, HTML, Js, Images, CSS & videos (totally could me max 3-5MB the whole content if the users visit all the site). The traffic of my web site will be 98% from UK and I am planning to have a maximum of 500.000 unique visitors per day.

My question is about performance.

Would you recommend me enabling CDN on my webrole? Would I benefit from it? is there a benefit using CDN even if my traffic is coming "mainly" from UK? is CDN content cached on Internet providers (eg. BT) proxy?

Would you recommend me hosting images, video etc on a blob storage account and reference it with absolute url from the web role? is there any difference in term of performance between hosting a static file on a blob (may be enabling CDN on the storage account?) or just put the static file on the web role?

I have not found many references online, but I guess that the web role, the CDN and the Storage, use different disks / cache layers / network layers and it should affect on performances.


回答1:


The only thing I can think of is that using a CDN role, you might have better headers on images (Cache-Control, Expires), so that the browser and proxies can cache for a long time those images, while if you serve those images from your main site you're in charge of controlling the headers on those resources.

Serving images from a different domain will also help, because all the request to resources hosted on the CDN (different domain name, do not use 3rd level domains) will not contain the cookies and authentication headers you need for the main site.




回答2:


Hosting static content in blob storage (or CDN) takes considerable load off your Web Role instances (more specifically IIS). This will reduce CPU and memory usage, as well as overall bandwidth in and out of your Web instances. One more detail: Most browsers are configured for (I believe) two concurrent connections to a given domain. Moving static content to Blob or CDN gives you an additional domain and a bit more parallelism in your browser with regard to content download.

You can go with CDN if you want, but it's best to use CDN for infrequently-changing content (as you can't forcibly expire the content). So, if you have some CSS, background images, etc. that don't change too often, those are great CDN candidates. If it's a daily-changing front-page HTML file, I would skip CDN on that one.

As far as benefit over hitting the data center directly: CDN access isn't necessarily the closest node geographically; it's based on a number of factors. That said, there are a few CDN nodes in the EMEA region (see full list here). You can always add CDN later, but moving to blob storage is going to have a positive impact on your app's performance, even without CDN.

EDIT: There's one more advantage of storing static content in Blobs vs. bundling with your deployment: You can very easily update individual files without having to rebuild / redeploy an entire deployment package.



来源:https://stackoverflow.com/questions/9515651/best-performance-for-storing-static-files-images-css-javascript-cdn-blob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!