samedi 26 avril 2014

Should I use TPL or Thread in a controller for scalability?


Vote count:

0




In my controller I'm spawning 10 threads like this:



public class HomeController : Controller
{
public ActionResult Index()
{
new Thread(() => new ClassName()).Start();
new Thread(() => new ClassName()).Start();
new Thread(() => new ClassName()).Start();
new Thread(() => new ClassName()).Start();
new Thread(() => new ClassName()).Start();
}
}


For exception handling purposes I'm thinking about using Task.Start (to use with Task.WaitAll());


No I'm wondering:


As I understood, TPL uses threads from the precious thread-pool which can cause scalability issues and Thread does not.


What are the pro's and cons of using TPL vs Thread in a controller in asp.net MVC 5?



asked 1 min ago

Dimo

597





Aucun commentaire:

Enregistrer un commentaire