Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys,
Wishing you and your family a very happy new Year

I want to execute multiple actions parallely asp.net MVC. Actually thread pool executes request one after another and in asynchronous programming also we can create and execute mutiple threads inside a single request.

My requirement is such taht i made 11 async ajax calls from browser to different Actions of my controller each one of them takes an average of 3-4 sec, so to process all request it is taking almost 40 to 44 sec. It is happening because all requests sent from browser async but they got starved in thread pool because thread pool executes them one after another.

Is there any way to force thread pool to run multiple requests parallely.
If it is possible then it would be much better to do it for a particular controller in asp.net mvc4.


Thanks in advancve...
Any help would be much appreciated
Posted
Comments
Afzaal Ahmad Zeeshan 1-Jan-15 6:20am    
Did you try to send async ajax requests to load the content instead of using POSTBACK?
C For Code!!! 1-Jan-15 6:49am    
yes friend i am doing ajax async calls only as I said in my question also. The problem is happening in server side where my all requests are getting starved.. :(
Kornfeld Eliyahu Peter 1-Jan-15 14:10pm    
Please show us your current code so we may understand better you problem...

There's a little problem with how you laid this out.

Each request coming from the browser is being handled separately, like 11 different clients. They are not normally handled synchronously, but at the same time, given the restrictions on how ASP.NET is setup.

Requests are not handled by threads in the ThreadPool. They are handled by ASP.NET Worker Threads. They are not the same!

You're going to have to modify your question a bit and list which O/S you're using, which version of Visual Studio, which web server you're using and where it is installed. Did you modify your web.config? If so, what did you change?

Next, look at your code, specifically, the methods that these calls are using. Do they use a common resource? What is it? Are you using it efficiently?
 
Share this answer
 
Hi,

In ASP.NET 4.0 one concept "Parallelprogramming is introduced. You can make use of that. It internally manages multiple threads. Here I have given some links for reference. Have a look into them and change accordingly.

1.) Parallel Programming in .NET
2.) Asynchronous MVC using the Task Parallel Library

Thanks
Sisir Patro
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900