As David mentioned in his answer, you can start multiple threads. One of my clients did this using the ThreadedRoleEntryPoint class.
This class allows you to use several classes of workgroup entry points (even from several assemblies) and run them in the same role:
public override void Run() { Trace.TraceInformation("WebRole::Run begin", "Information"); List<WorkerEntryPoint> workers = new List<WorkerEntryPoint>(); workers.Add(new Worker1()); workers.Add(new Worker2()); base.Run(workers.ToArray()); Trace.TraceInformation("WebRole::Run end", "Information"); }
The advantage is that you can start small and run all work roles (not work roles, but let them handle processes or workers) in one role (which you are actually deploying).
Then, when your business begins to grow, you can begin to use the allocated roles, which means that you will have at least 1 instance running as a worker. And when this should happen, the impact on your code will be minimal, as the workers passed ThreadedRoleEntryPoint to inherit from WorkerEntryPoint, which is very similar to the RoleEntryPoint class.
Sandrino di mattia
source share