I just discovered why all ASP.Net websites are slow, and I am trying to work out what to do about it

前端 未结 10 673
情话喂你
情话喂你 2020-11-22 07:53

I just discovered that every request in an ASP.Net web application gets a Session lock at the beginning of a request, and then releases it at the end of the request!

10条回答
  •  遇见更好的自我
    2020-11-22 08:26

    I prepared a library based on links posted in this thread. It uses the examples from MSDN and CodeProject. Thanks to James.

    I also made modifications advised by Joel Mueller.

    Code is here:

    https://github.com/dermeister0/LockFreeSessionState

    HashTable module:

    Install-Package Heavysoft.LockFreeSessionState.HashTable
    

    ScaleOut StateServer module:

    Install-Package Heavysoft.LockFreeSessionState.Soss
    

    Custom module:

    Install-Package Heavysoft.LockFreeSessionState.Common
    

    If you want to implement support of Memcached or Redis, install this package. Then inherit the LockFreeSessionStateModule class and implement abstract methods.

    The code is not tested on production yet. Also need to improve error handling. Exceptions are not caught in current implementation.

    Some lock-free session providers using Redis:

    • https://github.com/angieslist/AL-Redis (Suggested by gregmac in this thread.)
    • https://github.com/welegan/RedisSessionProvider (NuGet: RedisSessionProvider)
    • https://github.com/efaruk/playground/tree/master/UnlockedStateProvider (NuGet: UnlockedStateProvider.Redis)

提交回复
热议问题