使用会话:我在滥用它吗? [英] using sessions: am I abusing it?

查看:75
本文介绍了使用会话:我在滥用它吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个网站,其中的报告页面将包含用户特定的每日报告.

Let's say I have a site where a reporting page will contain user-specific daily reports.

默认情况下,该用户进入今天的报告,但是如果他单击日历控件并选择一个新日期,则该日将加载一个新报告.我想做的是将会话用作报告的缓存.他第一次加载一天的报告,该报告从数据库加载到会话中,然后从会话加载到页面中.每次他为日期加载新报告时,逻辑首先检查该特定报告是否在会话中,并且只有在未从数据库中加载时才进行检查.一个报告大约有15列,每天大约有300-500行.会话中将存储对象列表的字典,其中日期为键,列表为值.我正在使用InProc会话.我也在考虑存储其他几个字典以及其他对象列表.

By default, the user lands on today's report but then if he clicks on a calendar control and selects a new date, a new report will load for that day. What I want to do is use sessions as a cache for reports. The first time he loads a report for a day, it's loaded from the database into the session and then from the session to the page. Each time he loads a new report for a date, the logic first checks to see if this particular report is in the session and only if it's not is it loaded from the DB. A report has about 15 columns and is made up of about 300-500 rows per day. What will be stored in the session is a dictionary of lists of objects, with the date as the key and the list as the value. I'm using InProc session. I'm also considering storing several other dictionaries as well for other lists of objects.

这是充分利用.net框架的有效方法吗?如果与调用数据源相比,它实际上并没有提高性能,那么它会变慢吗?我正在寻找一种可以扩展到大约500-1000个并发用户的东西.

Is this an efficient way to make the most of the .net framework? If it doesn't actually improve performance over making calls to the data source, will it make it slower? I'm looking to build something that'll scale to about 500-1000 simultaneous users or so.

谢谢.

推荐答案

这听起来像是您对我的预优化.您是否进行了任何性能测试,以验证将其放入会话(或缓存)中是否可以获得任何好处?

It sounds like your pre-optimizing to me. Have you run any performance tests to verify that you get any benefit at all to putting it in Session (or Cache)?

您的用户是否对性能表示关注?

Have your users expressed concern over the performance?

对我来说,在知道性能问题之前,我不会考虑优化任何类型的缓存,然后查看为什么我遇到了性能问题,然后优化

For me, I wouldn't consider optimizing to any kind of cache until I knew I had a performance issue, and then I would look at why I had the performance problem, and optimize that

这篇关于使用会话:我在滥用它吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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