ASP.NET and multithreading best practices -
I am working on the asp.net project and yesterday I saw a piece of code that uses the system. threading. The task thread for some new thread runs some SQL statements and logs results.
Is not it better to use another approach? For example, a Windows service that does SQL batch. Then what are the best practices for multiplying in Web page bus (ADP.Net)? What are the fair uses of Threads / TPL actions / etc. In a web page?
My thoughts when using multi-threading in ASP.NET:
-
ASP.NET Epideman recycles for some reasons like you web. In the period of time to change config or to avoid memory leakage. The thing is that you do not know the exact time of recycle. Long-lasting thread is not suitable because when ASPNET recycles, it will take your thread accordingly. The correct approach of this case should be run through Qi on the background process as long as you mention.
To run short or async / await are most appropriate because it does not block the use of HTTP requests in the thread pool .
Comments
Post a Comment