elmah / Elmah

Error Logging Modules & Handlers for ASP.NET
https://elmah.github.io/
Apache License 2.0
306 stars 65 forks source link

Asynchronous HTTP Modules and HTTP Handlers in Asp.Net 4.5 #408

Closed kiquenet closed 7 years ago

kiquenet commented 7 years ago

ELMAH can be asynchronous HTTP Handler - Module in ASP.NET 4.5 ?

IMHO, will be more performance, perhaps, isn't?

I use ASP.NET 4.6.1 web App.

atifaziz commented 7 years ago

ErrorLogDownloadModule is frankly the module that would benefit the most from being asynchronous since it can take a while to run as it serves to download. To that extent, it is already implemented in an asynchronous manner by virtue of implementing IHttpAsyncHandler. It doesn't used tasks/TPL but it's asynchronous alright.

However, that alone does not guarantee asynchronous execution semantics. The ErrorLog implementation also needs to support (non-blocking) asynchronous retrieval and the only one that does is SqlErrorLog.

will be more performance, perhaps, isn't?

It's not about performance per se. Instead, it's about returning threads to the pool while waiting for an I/O so that those thread are more available to service other requests meanwhile. It will affect your scalability.


If your questions are answered, consider closing the issue.

kiquenet commented 7 years ago

Useful. ASP.NET Async SessionState module

The default ASP.NET SessionStateModule is already partly asynchronous; it reads the request state asynchronous, but it doesn’t support async when reading/writing to the session store. In the .NET Framework 4.6.2 release, Microsoft changed this by introducting a new interface named ISessionStateModule.

Thanks to the async SessionState module it becomes possible to access the session storage providers(SQL Server, Redis,…) asynchronously. Async I/O operation helps release the thread more quickly than synchronous I/O operation, and ASP.NET can handle other requests.

Here are the required steps to start using this module: •Change your application to target .NET Framework 4.6.2 •Download and install the Microsoft.AspNet.SessionState.SessionStateModule NuGet package. This will replace the default session state provider by the new async one. •Download an async session state provider from NuGet. At the moment of writing I only could find an implementation for SQL Server, but the hope is that other will follow soon.

The introduction of this module will help in improving the performance of your ASP.NET applications.

http://bartwullems.blogspot.com.es/2016/10/aspnet-async-sessionstate-module.html