Now why would you want to do that? Azure provides a nice separation of roles in web role and a worker role – why do you want to combine those you’ll ask. Multiple reasons – saving cost being the primary. The most requested feature on the Windows Azure feature voting forum is “Make it less expensive to run my very small service on Windows Azure.” and rightly so. If you wish to host your “small service” on the cloud it makes sense to minimize the cost. Even for large scale services this can help to maximize the use of resources. Let’s crunch some numbers to see this in action.
Assume that your “simple service” consists of a simple website that provides the UI to the users. There is also a background worker for sending registration emails, sending newsletters and does some nightly batch processing of your data. Let’s say you don’t need a full blown SQL server and are happy with the semi structured data storage that Windows Azure table storage provides. These assumptions are not unrealistic for a large number of simple websites, in fact most startup websites will start with this model and then scale out as the traffic increases and that’s exactly what Windows Azure enables you to do. So with these very realistic scenario let’s examine what will it cost to host such a service on Windows Azure. We will only focus on the compute cost as that’s what you will save on (& is the biggest cost for a small service) when you combine roles so we can safely ignore the storage, bandwidth and other costs of hosting on Azure as they are all usage based.
Here’s what the compute instances cost on Windows Azure.
- Small instance (default): $0.12 per hour
- Medium instance: $0.24 per hour
- Large instance: $0.48 per hour
- Extra large instance: $0.96 per hour
Let’s say you will use the small instances for both your roles. So your monthly cost comes out to be,
30 (days in a month) * 24 (hours in a day) * 0.12 (cost per hour) * 2 (number of instances)
= $172.80 per month
Now you are wondering the worker role is just sitting there doing nothing for most of those hours. Shouldn’t you only count the “compute hours” in which the role is actually is alive and doing work instead of the full 24 hours for a day. Well, that’s not how Windows Azure billing work. It’s pay as you go alright but not at that granularity so you end up paying as long as your have reserved the VM, even in the suspended state. May be some day Azure will be able to provide that level of billing granularity – may be we should request that feature on the forum :-) But till then the only way to save cost here will be - if we just got rid of one role entirely and still do all the work with just one role. Turns out it’s very easy to do that on Windows Azure.
To understand how to do that we first need to understand how web and worker role differs in Windows Azure. One obvious difference is the web role will have an IIS installed on the VM and the work role will not. What else? Well, turns out that’s about it. In every other sense as far as Window Azure is concerned those roles are pretty much the same. You could potentially have your worker role listen on port 8080 and receive web traffic and your web role have a Run()method that does the background work. When you create a Cloud project in Visual studio, by default in the webrole.cs the template does not add a Run() method like it does in your worker role but there is nothing that stops you from doing that either because the WebRole class also derives from the same RoleEntryPoint which workers derive from as well.
public class WebRole : RoleEntryPoint
{
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.WriteLine("WorkerRole1 entry point called", "Information");
while (true)
{
Thread.Sleep(10000);
Trace.WriteLine("Working", "Information");
}
}
}
As simple as that. Once your web role gets provisioned Azure fabric will start start IIS and deploy your application as well as start a worker which you can use to do some background processing. The thing to note that both of these processes are running on the same VM and will share the resources so this technique should not be used where a consistently high throughput is required at all the times by either your website or your background worker. But if you are able to use this technique you end up cutting your compute cost in half for your small service.
Hope that helps.
nice piece of information, I had come to know about your internet site from my friend vinay, delhi,i have read atleast 4 posts of yours by now, and let me tell you, your website gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new post, once again hats off to you! Thanx a ton once again, Regards windows azure training in hyderabad
ReplyDeleteI feel this is among the such a lot vital info for me. And i am satisfied studying your article. However wanna commentary on few general things, The website style is ideal, the articles is truly nice
DeleteTangki Panel
Tangki Fiberglass
Jual Septic Tank
Great Article
DeleteProject Centers in Chennai
Final Year Project Domains for CSE
JavaScript Training in Chennai
JavaScript Training in Chennai
thanks for sharing wonderful blog with us. its really more helpful to our institute candidates to get aware some useful knowledge keep sharing more information.
ReplyDeleteDot Net training in Chennai
Nice post.
ReplyDeleteBest Selenium Training in Chennai |Selenium Training in Chennai |
Android Training in ChennaiBest Manual Testing Training in chennai
Nice blog Best Selenium Training in Chennai |Selenium Training in Chennai |
ReplyDeleteAndroid Training in ChennaiBest Manual Testing Training in chennai
I didn't spend much time to visit many websites. But today I found this accidentally and I got more information from your site.
ReplyDeleteRegards,
Windows Azure course in Chennai | Azure Training center in Chennai | Microsoft windows azure Training
best windows azure online training in hyderabad with work support and job assistance and high quality training facilities and well expert faculty
ReplyDeleteto Register you free demo please visit
windows azure training in hyderabad
Nice Blog. Thank you for Sharing. Enterprise Resource Planning Software Solutions in Chennai. For more details contact us info@bravetechnologies.in
ReplyDeleteerp in chennai | erp software providers chennai
The best thing is that your blog really informative thanks for your great information!
ReplyDeleteerp software in chennai | erp solutions in chennai | erp software development company in chennai
It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
ReplyDeleteAndroid Training in Chennai
Ios Training in Chennai
Good and nice post... thanks for sharing your information... it is very useful to me...
ReplyDeleteAndroid Training in chennai | IOS Training in chennai
Interesting post! This is really helpful for me. I like it! Thanks for sharing!
ReplyDeleteWebseiten Gestaltung Lüdenscheid
Interesting post! This is really helpful for me. I like it! Thanks for sharing!
ReplyDeletemicrosoft office online
ReplyDeleteNice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating. Power BI Online Training .
Interesting post! This is really helpful for me. I like it! Thanks for sharing!
ReplyDeleteWebDesign Lüdenscheid
ReplyDeletefantastic post.i really like it
Netzwerk jobs
great post thanks for such posts, Thanks for sharing this Article...
ReplyDeleteCorelDraw Training Institute in Chennai | CorelDraw Training Institute in Velachery
The strategy you posted was nice. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
ReplyDeletePhotoshop Training Institute in Chennai | Photoshop Training Institute in Velachery
Thanks for sharing this post with us it is a worth read..
ReplyDeleteCorelDraw Training Institute in Chennai | CorelDraw Training Institute in Velachery
Good
ReplyDeleteKeep up the good Work, Very Informative Content,,,
Thanks For Sharing,,,
Graphics Designing Training Institute in Chennai | Graphics Designing Training Institute in Velachery | Graphics Designing Training Institute in Chennai
It’s hard to come by experienced people about this subject, but you seem like you know what you’re talking about! Thanks
ReplyDeleteCoreldraw Training Institute in Chennai | Photoshop Training Institute in Chennai | CorelDraw Training Institute in Velachery
I enjoy what you guys are usually up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve added you guys to my blog roll..,
ReplyDeletewhite label website builder
mobile website builder
The website is looking bit flashy and it catches the visitors eyes. A design is pretty simple .
ReplyDeleteregionale stellenbörse
amazing
ReplyDeletejobbörse Neunkirchen
,
Thanks for the post very useful
ReplyDeleteazure certification training in chennai
Very useful information, if you are Looking for software courses?
ReplyDeletePHP Training in Chennai
web designing course in chennai
JAVA Training in Chennai
Hadoop Training in Chennai
Selenium Training in Chennai
German Classes in chennai
java training in OMR
Thanks for your powerful post and Its very helpful for me. I was read your great article and I got more kinds of techniques. Please blogging...
ReplyDeleteExcel Training in Chennai
Excel classes in Chennai
Tableau Training in Chennai
corporate training in chennai
Oracle Training in Chennai
Linux Training in Chennai
Spark Training in Chennai
Embedded System Course Chennai
Oracle DBA Training in Chennai
Power BI Training in Chennai
It's really interesting blog!thanks for sharing this information with us!!
ReplyDeleteIELTS Coaching in Chennai
Best IELTS Coaching in Chennai
Spoken English in Chennai
Best IELTS Coaching centres in Chennai
German Language Classes in Chennai
IELTS Classes in Chennai
Japanese Language Course in Chennai
IELTS Coaching in Tnagar
IELTS Coaching in vadapalani
IELTS Coaching in Thiruvanmiyur
Thanks for sharing the valuable information. This blog contains various good concepts and ideas.
ReplyDeleteDevOps Training in Chennai
DevOps Training in Bangalore
Best DevOps Training in Bangalore
DevOps Course in Bangalore
DevOps Training Bangalore
DevOps Training Institutes in Bangalore
AWS Training in Bangalore
Data Science Courses in Bangalore
DevOps Course in Marathahalli
DevOps Training in btm
Nice Article, valuable content...thanks for sharing...
ReplyDeleteLoadRunner Training in Chennai
performance testing training in chennai
performance testing training
Loadrunner Training in OMR
Loadrunner Training in Porur
QTP Training in Chennai
core java training in chennai
C C++ Training in Chennai
Mobile Testing Training in Chennai
Manual Testing Training in Chennai
Awesome blog, very informative content... Thanks for sharing waiting for next update...
ReplyDeleteArtificial Intelligence Course in Chennai
AI Training in chennai
artificial intelligence training in chennai
C C++ Training in Chennai
javascript training in chennai
Html5 Training in Chennai
QTP Training in Chennai
Spring Training in Chennai
DOT NET Training in Chennai
Wonderful blog. It is really informative to all.keep update more information about this
ReplyDeleteGerman Classes in Chennai
German Classes in Bangalore
German Classes in Coimbatore
German Classes in Madurai
German Language Course in Hyderabad
Best german classes in bangalore
German classes in marathahalli
German language classes in bangalore
Ethical Hacking Course in Bangalore
Software Testing Course in Bangalore
This blog is really nice and informative blog, The explanation given is really comprehensive and informative.
ReplyDeleteData Science Course in Chennai
Data Science Courses in Bangalore
Data Science Training in Bangalore
Best Data Science Courses in Bangalore
Data Science Institute in Bangalore
Data Science Training Institutes in Bangalore
Data Science Training in BTM
A fascinating discussion is definitely worth comment. I do think that you need to write more techno on this topic, it might not be a taboo matter but typically people do not speak about such subjects. To the next! All the best!!
ReplyDeleteNice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much
ReplyDeleteMicrosoft Windows Azure Training | Online Course | Certification in chennai | Microsoft Windows Azure Training | Online Course | Certification in bangalore | Microsoft Windows Azure Training | Online Course | Certification in hyderabad | Microsoft Windows Azure Training | Online Course | Certification in pune
I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article. i really enjoy to read this
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery