3

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.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Stelio
  • 561
  • 6
  • 15

2 Answers2

12

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.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
  • I don't think that delivery static file is going to consume much CPU and memory from the web role instance. my webrole is going to have only "static" files. About the multiple domain, I agree with you, but that's all about the client behavior. my question was on the Azure side.... Is there any convenience to pay for the CDN if all the traffic comes from UK???? and the other question is, is that convenience on using a storage account instead than the standard web role in my scenario? the only 2 factor that I think could affect is the disk, cache and network layers used in Azure infrastruct. – Stelio Mar 01 '12 at 15:46
  • 2
    Every call goes through IIS, meaning memory and CPU. If you have a high-volume site, you'll see a reduction in system resources. IIS is basically brokering all content calls. I've seen this first-hand with several of the ISVs I work with. Just think about it: You either go through IIS to serve content, or you bypass it completely and take advantage of the Storage Service to scale for you. – David Makogon Mar 01 '12 at 15:50
  • I am not entirely sure that IIS is going to be the bottleneck for this scenario... I am neither sure that the storage account is not using IIS to host the static files... – Stelio Mar 01 '12 at 15:57
  • 3
    Storage absolutely does not use IIS. It's a massive-scale storage system, with each blob capable of a sustained transaction rate of 500 transactions / second, and up to 5,000 transactions / second across your entire storage account. I can't speak to your app's implementation or runtime bottlenecks, but I can assure you that moving storage from IIS (within your deployment) to blobs will decrease load on your Web Role instances (allowing you to handle more traffic with fewer instances). I believe I've answered your original question. Please feel free to mark it as such and upvote if you concur. – David Makogon Mar 01 '12 at 19:18
  • 4
    @Stelio Asking a question and disputing the answer seems like a strange practice. I can assure you a request direct to blob storage (i.e. not to your web role) does not encounter your web role's IIS. I can also assure you that I have seen David Makogon give many great answers on Azure so he is more than qualified on the topic – BritishDeveloper May 28 '12 at 11:55
2

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.

smnbss
  • 1,031
  • 1
  • 10
  • 21
  • Simone, I agree with your considerations... but it does not really answer to my question... is it convenient to use CDN if my site is going to serve only UK traffic??? is it better to use storage account or web role in term of performances, is it going to be a big difference in term of performances between a static file hosted in a web role and a file hosted in a storage account??? – Stelio Mar 01 '12 at 15:54
  • well, using a CDN will use less bandwidth for your resources (no cookies overhead) and as David said, every request to the webrole goes through the IIS pipeline until it hit the StaticResource Handler, so it will theoretically save you some CPU & Memory. you can do a quick test right? upload 10 filed with different sizes on the CDN and on the webrole, and request it 1000000 time, you average the response time and you get your answer :) – smnbss Mar 01 '12 at 16:02
  • I guess that all the tests that I can do is going to be heavily affected by my ISP Network quality... anyhow I'll do it and I will post the results... with CDN, without CDN and using the storage... – Stelio Mar 01 '12 at 16:17