I'm just wondering what would happen if I have a worker roles hosting in Azure, and instead of
public class WorkerRole : RoleEntryPoint
{
public override void Run()
{
while (true)
{
Thread.Sleep(10000);
Trace.TraceInformation("Working", "Information");
}
}
//Other code remove for brevity
}
}
I do
public class WorkerRole : RoleEntryPoint
{
public override void Run()
{
while (true)
{
}
}
//Other code remove for brevity
}
}
I know that the second code snippet spinning the process all the time, which is bad. But is there any other differences in terms of money?
Thanks.
As long as you don't produce network transfer, that second
while(true)
code would simply block your worker role's main thread if each iteration takes few milliseconds to be processed.You can check how worker roles are billed using Azure Pricing Calculator for cloud services (and you'll discover that you pay a fixed price per month based on CPU power and RAM, and also based on network bandwidth).