Monday, February 21, 2011

How can I determine the memory footprint of a session variable?

Also, web.config - please explain.

<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" 
cookieless="false" timeout="120"/>

We are using inproc mode and we used the 20 session variable in our web application. We need to know each variables Occupying the memory spaces.

From stackoverflow
  • From George Shepherd's ASP.NET FAQ at http://www.syncfusion.com/faq/aspnet/web_c9c.aspx

    36.37 Is there any way to know how much memory is being used by session variables in my application?

    No
    

    However, you can make an educated guess. The number of bytes in your strings, plus the number of bytes taken up by your other session variables (8 for an int, etc.), times the number of concurrent user sessions.

    It follows that your session variables need to be as small as possible. The smaller your session state is, the better the site will scale.

  • You could change your backing store to SQL Server and look at the size of SessionItemShort or SessionItemLong to get an idea of what the serialized size of the data is. Probably not exact, but should be close.

0 comments:

Post a Comment