使用会话存储数据表 [英] Using Session to store Datatable

查看:151
本文介绍了使用会话存储数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我们正在使用的会话存储在我们的网页数据表,这样我们就不必做数据库访问一次又一次地得到相同的数据表。但我担心的是,它使用的服务器内存,如果大量用户登录某一​​天,服务器的响应会变得缓慢和我们的应用程序可能会崩溃,以及。

currently we are using Sessions to store datatables in our pages so that we don't have to make Database hits to get the same datatable again and again. But my worry is that it is using the server memory and if large number of users login some day, the response of the server will become slow and our application might crash as well.

请告诉我的是它的数据表存储到会话一个好主意,或者我们应该得到的数据表从数据库每次?

Please tell me is it a good idea to store datatables into Sessions or should we get the datatables from DB everytime?

推荐答案

根据经验我要说不使用会话的一般规则。我还没有使用会话很长一段时间。只要你进入一个Web场的情况会得到两种速度慢了很多或复杂得多或两者兼而有之。

As a general rule of thumb I would say don't use session. I haven't had to use session for a long time. As soon as you move into a web farm situation session either gets a lot slower or a lot more complicated or both.

你是否会逃脱与否实际上取决于你有多少数据存储在会话,以及有多少用户将在会话超时期限内有效。

Whether you will get away with it or not really depends on how much data you are storing in session, and how many users will be active within the session timeout period.

有大量的缓存和内存数据库选件可今天这可能是一个更好的选择。最后,尽管所描述的解决方案听起来可疑的,我不会,直到你实际测量的问题优化现有的解决方案。

There are a lot of caching and in memory database options available today that may be a better option. Finally, while the solution as described sounds questionable, I wouldn't optimize the existing solution until you have actually measured a problem.

这篇关于使用会话存储数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆