且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何确定一个会话变量的内存占用?

更新时间:2023-11-27 22:48:34

从乔治牧羊人的ASP.NET常见问题解答的 http://www.syncfusion.com/faq/aspnet/web_c9c.aspx

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

36.37请问有什么办法知道多少内存被使用会话变量在我的应用程序?

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

No

不过,你可以让一个受过教育的猜测。在你的字符串的字节数,再加上你的其他会话变量(8一个int等)占用的字节数,次并发用户会话的数量。

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.