This project is read-only.

ThreadedRoleEntryPoint project

ThreadedRoleEntryPoint is a class library project that works as the business logic for multi-threaded roles; i.e. the MultiThreadedWorkerRole project. If you create a standard Azure worker role only a single thread is in use, this is a huge waste of resources as the server instances that the worker roles run on have processors with many cores that are capable of processing many threads asynchronously, MultiThreadedWorkerRole worker role counters his by spawning one thread for each role.

Multi-threaded role

The MultiThreadedWorkerRole project's job is to spawn a new thread for each job that is done. If you create a standard Azure worker role only a single thread is in use, this is a huge waste of resources as the server instances that the worker roles run on have processors with many cores that are capable of processing many threads asynchronously, MultiThreadedWorkerRole worker role counters his by spawning one thread for each role.

See http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2010/12/running-multiple-threads-on-windows.html for information on how this multi-threaded worker role software design pattern works.

ThreadedRoleEntryPoint.cs

ThreadedRoleEntryPoint is an abstract class that works as a role entry point for multi-threaded worker roles. It has the following work assigned to it:
  • spawn a thread for each job,
  • monitor and restart dead threads.

The application setting CheckDeadThreadSleepInSeconds determines how often ThreadedRoleEntryPoint should check for dead threads, increasing this may save you Azure computing costs.

WorkerEntryPoint.cs

WorkerEntryPoint is an abstract class that contains the logic for the Back-Off design pattern.

Back-off pattern

The MultiThreadedWorkerRole project inherits a Back-Off design pattern from ThreadedWorkerRoleLib, this pattern causes the System.Threading.Thread.Sleep() to double after each time the job was unemployed. Since you pay per processing hour on Azure this design pattern saves you money.

Last edited Oct 2, 2011 at 2:31 PM by ihenriksen, version 3

Comments

No comments yet.