Asp.net mvc 2 and .net 4 parallelism

How can an MVC website use the new parallelism features in .net 4? Do parallelism websites support defaults, as multiple users access them at once? Can anyone clarify this?

+4
source share
3 answers

Performing parallel tasks is especially useful for long tasks. What constitutes a long-term task may differ, but it should be longer than the overhead of formatting and synchronizing threads.

Thus, there is no particular advantage for MVC, but for each request there is a general advantage that requires several things to be done in parallel.

This article published an article from MSDN Magazine that describes some aspects of parallel library performance.

Example 1: a user clicks on a page that displays two different graphs. Each graph is calculated from a data set. Performing parallel computing will benefit the overall time it takes to display a page. (Performing parallel separate tasks)

Example 2: you need to perform some function in a data list. And use Parallel.For to enumerate the data and execute some code on it in parallel.

You should analyze your application and find out which parts can run in parallel, and then test new language features if this helps your application or not.

+1
source

Parallelism - a computer processor. Parallelism does not mean that multiple users are accessing the application. Parallelism is that for a single request, an application can split tasks into multiple processors to do the job. Thus, several users accessing the application are a factor in how the server parses the work, but not the basic idea of ​​parallelism.

0
source

Each request is processed in its own thread, so you get the default degree of parallelism using ASP.Net.

When using any type of parallelism, it is important to test your code with and without parallelism. You must make sure that the overhead of packing, distributing, and completing each task is no more than completing the tasks in a sequential manner. This is often for most of your daily cycles. parallelism is best used in computationally intensive tasks.

-1
source

Source: https://habr.com/ru/post/1307567/


All Articles