locked
MVC with RedisSessionStateProvider causes cpu high RRS feed

  • Question

  • User-1931755722 posted

    My MVC application shares session with RedisSessionStateProvider.  It happens to causes cpu to 70+%。 I dump with windbg and find Microsoft.Web.Redis.ChangeTrackingSessionStateItemCollection.GetData hangs for 1+h.  But I do not know why it's blocked. 

    Please help me and any suggestion is welcome.

    windbg & clrstack:

    000000f76cbfc870 00007ffd7b43ab07 *** WARNING: Unable to verify checksum for System.Core.ni.dll
    System.Collections.Generic.HashSet`1[[System.__Canon, mscorlib]].AddIfNotPresent(System.__Canon)
    000000f76cbfc8f0 00007ffd249fefb8 Microsoft.Web.Redis.ChangeTrackingSessionStateItemCollection.GetData(System.String)
    000000f76cbfc930 00007ffd763fcf39 *** WARNING: Unable to verify checksum for System.Web.ni.dll
    System.Web.HttpSessionStateWrapper.get_Item(System.String)
    000000f76cbfc960 00007ffd24efb4cb ASP._Page_Views_HomeX_Index_cshtml.Execute()
    000000f76cbfdfa0 00007ffd24a103cc System.Web.WebPages.WebPageBase.ExecutePageHierarchy()

    cshtml code:

    var userSetting = Session["usersetting"] as UserSetting;

    Associated c# code with session:

    Parallel.Invoke(
    () =>
    {
    Session["crmsyspower"] = CrmManager.GetUserPower(User.Identity.Name);
    },
    () =>
    {
    Session["usersetting"] = CrmManager.GetUserSetting(User.Identity.Name);
    },
    () =>
    {
    CrmManager.UpdateRegionCache();
    }
    );

    web.config:

    <sessionState mode="Custom" customProvider="Redis">
    <providers>
    <add name="Redis" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="xxx.cn" databaseId="9" ssl="false" applicationName="xx" />
    </providers>
    </sessionState>

    dll version:

    Microsoft.Web.Redis.RedisSessionStateProvider.dll 2.2.5

    System.Web.Mvc 5.2.3

    System.Web.WebPages 3.0.0

    Wednesday, January 17, 2018 10:03 AM

All replies

  • User283571144 posted

    Hi cuirongqing,

    My MVC application shares session with RedisSessionStateProvider.  It happens to causes cpu to 70+%。 I dump with windbg and find Microsoft.Web.Redis.ChangeTrackingSessionStateItemCollection.GetData hangs for 1+h.  But I do not know why it's blocked. 

    Does your mvc application host in azure and used azure redis as the session provider?

    In my opinion, I guess this may related with too many thread run at same time.

    I suggest you could consider improve the azure web app service plan. 

    Besides, I suggest you could also try to improve the "Microsoft.Web.RedisSessionStateProvider" version to the newest 2.2.6.

    Best Regards,

    Brando

    Thursday, January 18, 2018 5:08 AM
  • User-1931755722 posted

    Thank you for yr help.

    My MVC application is hosted in virtual server.  The server performance is OK. I  have tried to config maxConnection to 512 and start to monitor for a long time.

    I will upgrade version to newest 2.2.6 if 512 does not work.

    Thursday, January 18, 2018 6:55 AM