Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance degradation using Azure CDN?

I have experimented quite a bit with CDN from Azure, and I thought i was home safe after a successful setup using a web-role.

Why the web-role?

Well, I wanted the benefits of compression and caching headers which I was unsuccessful obtaining using normal blob way. And as an added bonus; the case-sensitive constrain was eliminated also.

Enough with the choice of CDN serving; while all content before was served from the same domain, I now serve more or less all "static" content from cdn.cuemon.net. In theory, this should improve performance since browsers parallel can spread content gathering over "multiple" domains compared to one domain only.

Unfortunately this has lead to a decrease in performance which I believe has to do with number of hobs before content is being served (using a tracert command):

C:\Windows\system32>tracert -d cdn.cuemon.net

Tracing route to az162766.vo.msecnd.net [94.245.68.160]
over a maximum of 30 hops:

  1     1 ms     1 ms     1 ms  192.168.1.1
  2    21 ms    21 ms    21 ms  87.59.99.217
  3    30 ms    30 ms    31 ms  62.95.54.124
  4    30 ms    29 ms    29 ms  194.68.128.181
  5    30 ms    30 ms    30 ms  207.46.42.44
  6    83 ms    61 ms    59 ms  207.46.42.7
  7    65 ms    65 ms    64 ms  207.46.42.13
  8    65 ms    67 ms    74 ms  213.199.152.186
  9    65 ms    65 ms    64 ms  94.245.68.160

C:\Windows\system32>tracert cdn.cuemon.net

Tracing route to az162766.vo.msecnd.net [94.245.68.160]
over a maximum of 30 hops:

  1     1 ms     1 ms     1 ms  192.168.1.1
  2    21 ms    22 ms    20 ms  ge-1-1-0-1104.hlgnqu1.dk.ip.tdc.net [87.59.99.217]
  3    29 ms    30 ms    30 ms  ae1.tg4-peer1.sto.se.ip.tdc.net [62.95.54.124]
  4    30 ms    30 ms    29 ms  netnod-ix-ge-b-sth-1500.microsoft.com [194.68.128.181]
  5    45 ms    45 ms    46 ms  ge-3-0-0-0.ams-64cb-1a.ntwk.msn.net [207.46.42.10]
  6    87 ms    59 ms    59 ms  xe-3-2-0-0.fra-96cbe-1a.ntwk.msn.net [207.46.42.50]
  7    68 ms    65 ms    65 ms  xe-0-1-0-0.zrh-96cbe-1b.ntwk.msn.net [207.46.42.13]
  8    65 ms    70 ms    74 ms  10gigabitethernet5-1.zrh-xmx-edgcom-1b.ntwk.msn.net [213.199.152.186]
  9    65 ms    65 ms    65 ms  cds29.zrh9.msecn.net [94.245.68.160]

As you can see from the above trace route, all external content is delayed for quite some time. It is worth noticing, that the Azure service is setup in North Europe and I am settled in Denmark, why this trace route is a bit .. hmm .. over the top?

Another issue might be that the web-role is two extra small instances; I have not found the time yet to try with two small instances, but I know that Microsoft limits the extra small instances to a 5Mb/s WAN where small and above has 100Mb/s.

I am just unsure if this goes for CDN as well.

Anyway - any help and/or explanation is greatly appreciated.

And let me state, that I am very satisfied with the Azure platform - I am just curious in regards to the above mentioned matters.

Update

New tracert without the -d option.

Being inspired by user728584 I have researched and found this article, http://blogs.msdn.com/b/scicoria/archive/2011/03/11/taking-advantage-of-windows-azure-cdn-and-dynamic-pages-in-asp-net-caching-content-from-hosted-services.aspx, which I will investigate further in regards to public cache-control and CDN.

This does not explain the excessive hops count phenomenon, but I hope a skilled network professional can help in casting light to this matter.

Rest assured, that I will keep you posted according to my findings.

like image 583
gimlichael Avatar asked Apr 24 '12 23:04

gimlichael


2 Answers

Okay, after I'd implemented public caching-control headers, the CDN appears to do what is expected; delivering content from x-number of nodes in the CDN cluster.

The above has the constrain that it is experienced - it is not measured for a concrete validation.

However, this link support my theory: http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_windowsazurecdn_topic3,

The time-to-live (TTL) setting for a blob controls for how long a CDN edge server returns a copy of the cached resource before requesting a fresh copy from its source in blob storage. Once this period expires, a new request will force the CDN server to retrieve the resource again from the original blob, at which point it will cache it again.

Which was my assumed challenge; the CDN referenced resources kept pooling the original blob.

Also, credits must be given to this link also (given by user728584); http://blogs.msdn.com/b/scicoria/archive/2011/03/11/taking-advantage-of-windows-azure-cdn-and-dynamic-pages-in-asp-net-caching-content-from-hosted-services.aspx.

And the final link for now: http://blogs.msdn.com/b/windowsazure/archive/2011/03/18/best-practices-for-the-windows-azure-content-delivery-network.aspx

For ASP.NET pages, the default behavior is to set cache control to private. In this case, the Windows Azure CDN will not cache this content. To override this behavior, use the Response object to change the default cache control settings.

So my conclusion so far for this little puzzle is that you must pay a close attention to your cache-control (which often is set to private for obvious reasons). If you skip the web-role approach, the TTL is per default 72 hours, why you may not never experience what i experienced; hence it will just work out-of-the-box.

Thanks to user728584 for pointing me in the right direction.

like image 24
gimlichael Avatar answered Nov 04 '22 04:11

gimlichael


Not to state the obvious but I assume you have set the Cache-Control HTTP header to a large number so as your content is not being removed from the CDN Cache and being served from Blob Storage when you did your tracert tests?

There are quite a few edge servers near you so I would expect it to perform better: 'Windows Azure CDN Node Locations' http://msdn.microsoft.com/en-us/library/windowsazure/gg680302.aspx

Maarten Balliauw has a great article on usage and use cases for the CDN (this might help?): http://acloudyplace.com/2012/04/using-the-windows-azure-content-delivery-network/

Not sure if that helps at all, interesting...

like image 72
user728584 Avatar answered Nov 04 '22 06:11

user728584