, , , ,

PS : This post is not about Careers in Azure (If you are searching for careers Azure, this will help you. Or this will help you a lot. Remember this will be the perfact help but most people hate this 😦 because its Bing 😦 ).

In this moment if want to run a task or a job on Azure we had a lot of possibilities starting from Worker Roles and ending with Web Jobs or Schedulers on Mobile Services.

In this post we will look over a part of the services that are available on Windows Azure to run different jobs. For each of them we will try to identify the best case when we can use them.


We will start with Worker Roles. Theoretically behind the Worker Role we have a VM that gives to us the full power of the CPU and Memory that is available on it. On such machines we can run the most complex jobs that we can have. On such roles we can implement any kind of jobs, without any kind of limitations. Because the VM is managed by Azure platform we don’t need to be worried about OS, security updates and so on.
I would use this kind of machines if I would need to process an audio stream, generate an ISO with a custom content or doing some heavy tasks.

Another place where we have the ability to run jobs is on Hadoop (HDInsight). On this service we can run jobs that are consuming a lot of resources to process different content. For example if we have a data source (like a job) from where we need to extract some statistical information. This jobs perfect option for us when we have a lot of input data and based on it we need to extract reports or statistical information.
I would use Hadoop for jobs that need to process large amounts of logs data to extract different reports.
In Mobile Services we have the ability to schedule and run different jobs. They are very similar with CRON jobs and can be written in JavaScript. The jobs that can be run from Mobile Services are very simple and are oriented to the mobile service and mobile applications. This means that the job should be very simple and would process the data only for a user or for a limited number of users. For example this jobs are great if you need to update different fields from customers table or clean some tables.
But you shouldn’t use this job to process pictures or make long call requests to different jobs (for example call 10-20 different external services and send clients data). You should use the jobs from Mobil Services at your application level. For more complicated jobs, you should try to use other solutions.

Azure Scheduler is something like a scheduler. Basically, this is the scheduler mechanism that gives you the ability to call a custom URL at a specific time interval. You will not be able to define the action that needs to be executed, only the endpoint that needs to be called. The endpoint that can be called can be an HTTP, HTTPs endpoint or a queue. For queues you have the ability to specify the body content of the message that is added to the queue.
This can be used with success in combination with Worker Roles (using queues) or WebJobs. For example if we have a cleaning task that needs to be executed every 4 days, we can define an Azure Scheduler that will call a specific URL of our site every 4 days. The URL will trigger our custom clean action.

The last available mechanism to define and run a job or a task is by Web Jobs. Using Web Jobs we have the ability to run any task on the web instances where we run our application. It is important to know that the Web Jobs will run on the same instances that we host our application. Because of this we need to be aware of what kind of tasks we want to run using Web Jobs. We don’t want to have tasks that consume a lot of resources from our instances and put our web application down. The good part is that the load balancer from Windows Azure will select the instances that has the lowest load. Like Mobile Services “CRON’ jobs, Web Jobs are recommended to use for small and simple jobs. For complex jobs we can use with success worker roles of HDInsight.

Copy pasted from here 😉