locked
parallel code execution RRS feed

  • Question

  • User379720387 posted

    Is it possible to separate code in two parallel tasks, one that needs to be executed to maintain the workflow for the user, and one that can run in the background while the user is still doing something unrelated to the second task?

    In my application the second task could be running on the server.

    Monday, September 22, 2014 4:47 PM

Answers

  • User-166373564 posted

    Hi,

    According to your description above, you want to use parallel in asp.net. I read relevant articles about using Parallel in ASP.NET apps,

    In most cases, and in particular for Web applications with heavy usage, it is probably not necessary to introduce extra parallelism since adding more work items will only result in competition for CPU time and ultimately reduce request throughput.

    Web applications that need to perform expensive computations may still benefit from parallelism if the latency of an individual request is more important than overall request throughput. See: http://blogs.msdn.com/b/pfxteam/archive/2010/02/08/9960003.aspx

    Best regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 24, 2014 1:47 AM
  • User1526116210 posted
    You might find that it would be reasonably easy to do this with SignalR
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 2, 2014 5:04 AM
  • User895691971 posted

    Just to answer the possibility, that is called Threading in .NET Framework. You can use multiple threads in your application, each thread working out for each process. 

    However, as already said. This would just slow down the processes so it is not a good way of doing this. But still there are options to put the thread to sleep and more. You can read those from the MSDN document and see whether they fit your purpose or not. 

    http://msdn.microsoft.com/en-us/library/system.threading.thread(v=vs.110).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 2, 2014 11:17 AM

All replies

  • User-166373564 posted

    Hi,

    According to your description above, you want to use parallel in asp.net. I read relevant articles about using Parallel in ASP.NET apps,

    In most cases, and in particular for Web applications with heavy usage, it is probably not necessary to introduce extra parallelism since adding more work items will only result in competition for CPU time and ultimately reduce request throughput.

    Web applications that need to perform expensive computations may still benefit from parallelism if the latency of an individual request is more important than overall request throughput. See: http://blogs.msdn.com/b/pfxteam/archive/2010/02/08/9960003.aspx

    Best regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 24, 2014 1:47 AM
  • User379720387 posted

    Thanks.

    Wednesday, September 24, 2014 8:43 AM
  • User1526116210 posted
    You might find that it would be reasonably easy to do this with SignalR
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 2, 2014 5:04 AM
  • User895691971 posted

    Just to answer the possibility, that is called Threading in .NET Framework. You can use multiple threads in your application, each thread working out for each process. 

    However, as already said. This would just slow down the processes so it is not a good way of doing this. But still there are options to put the thread to sleep and more. You can read those from the MSDN document and see whether they fit your purpose or not. 

    http://msdn.microsoft.com/en-us/library/system.threading.thread(v=vs.110).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 2, 2014 11:17 AM