Last month I started monitoring how much my website cost to host on Azure, and I was surprised that I am paying around 25USD for traffic which I should not generate. Firstly I did not understand what is going on and what is generating so much traffic, since before I was using VPS and i did not pay for that so I started investigation

Chrome

I am using chrome by default so it was easy to get what is going on (Pressing F12->Network).
So each visit to my site generates only on one script 534Kb + 18.6 and its only on javascript but i have css, images so on.

Use cache

First step to improve that was enabling cache in web.config
<staticContent>
      <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="90.00:00:00" />
</staticContent>

Now if we compare network in chrome its possible to see that script is loading from cache


CDN

To speed up even more loading of static files I created new CDN on Azure. And cool thing about it that it actually require zero configuration. After CDN its pretty easy to configure it, usig existing web app.

How CDN works

It will check in browser cache if file exists, if not it will check if file is in CDN cache and if not it will load from WebApp. (This solution its not right, since better would be if I have deployment tasks which will deploy binary to webapp, and static file to CDN, but this private project and I dont have much time to do everything right :( ) 


"> Last month I started monitoring how much my website cost to host on Azure, and I was surprised that I am paying around 25USD for traffic which I should not generate. Firstly I did not understand what is going on and what is generating so much traffic, since before I was using VPS and i did not pay for that so I started investigation

Chrome

I am using chrome by default so it was easy to get what is going on (Pressing F12->Network).
So each visit to my site generates only on one script 534Kb + 18.6 and its only on javascript but i have css, images so on.

Use cache

First step to improve that was enabling cache in web.config
<staticContent>
      <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="90.00:00:00" />
</staticContent>

Now if we compare network in chrome its possible to see that script is loading from cache


CDN

To speed up even more loading of static files I created new CDN on Azure. And cool thing about it that it actually require zero configuration. After CDN its pretty easy to configure it, usig existing web app.

How CDN works

It will check in browser cache if file exists, if not it will check if file is in CDN cache and if not it will load from WebApp. (This solution its not right, since better would be if I have deployment tasks which will deploy binary to webapp, and static file to CDN, but this private project and I dont have much time to do everything right :( ) 


"> Last month I started monitoring how much my website cost to host on Azure, and I was surprised that I am paying around 25USD for traffic which I should not generate. Firstly I did not understand what is going on and what is generating so much traffic, since before I was using VPS and i did not pay for that so I started investigation

Chrome

I am using chrome by default so it was easy to get what is going on (Pressing F12->Network).
So each visit to my site generates only on one script 534Kb + 18.6 and its only on javascript but i have css, images so on.

Use cache

First step to improve that was enabling cache in web.config
<staticContent>
      <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="90.00:00:00" />
</staticContent>

Now if we compare network in chrome its possible to see that script is loading from cache


CDN

To speed up even more loading of static files I created new CDN on Azure. And cool thing about it that it actually require zero configuration. After CDN its pretty easy to configure it, usig existing web app.

How CDN works

It will check in browser cache if file exists, if not it will check if file is in CDN cache and if not it will load from WebApp. (This solution its not right, since better would be if I have deployment tasks which will deploy binary to webapp, and static file to CDN, but this private project and I dont have much time to do everything right :( ) 


" />
Vova Bilyachat

Melbourne, Australia

Save traffic for your website and improve loading speed, Azure CDN, Asp.Net MVC

20 April 2016

Last month I started monitoring how much my website cost to host on Azure, and I was surprised that I am paying around 25USD for traffic which I should not generate. Firstly I did not understand what is going on and what is generating so much traffic, since before I was using VPS and i did not pay for that so I started investigation

Chrome

I am using chrome by default so it was easy to get what is going on (Pressing F12->Network).
So each visit to my site generates only on one script 534Kb + 18.6 and its only on javascript but i have css, images so on.

Use cache

First step to improve that was enabling cache in web.config
<staticContent>
      <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="90.00:00:00" />
</staticContent>

Now if we compare network in chrome its possible to see that script is loading from cache


CDN

To speed up even more loading of static files I created new CDN on Azure. And cool thing about it that it actually require zero configuration. After CDN its pretty easy to configure it, usig existing web app.

How CDN works

It will check in browser cache if file exists, if not it will check if file is in CDN cache and if not it will load from WebApp. (This solution its not right, since better would be if I have deployment tasks which will deploy binary to webapp, and static file to CDN, but this private project and I dont have much time to do everything right :( )