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

廉价感情. 提交于 2019-12-14 03:42:41

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/1077780/how-can-i-determine-the-memory-footprint-of-a-session-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!