寻找在 ASP .NET 中有效管理 1MB 会话数据的解决方案
这个问题是关于.net 中的性能。 我有一个项目,它在网格中显示 10,000 个产品信息。
.net项目中我们使用HTML表格来显示信息。一次显示一个页面中的500条记录。点击页码就会显示相关的页面信息。
网格有操作,删除,分组,排序,过滤。 为了实现这一目标,我们目前从数据库中获取所有 10,000 个产品信息(此小计结果实际上是从 2 个数据库调用和 2 个 Web 服务调用中检索的)并将它们保留在会话中,然后从会话中检索分页数据。通过 ajax 调用,每个 ajax 调用都会从会话中获取相关页面数据 -resultset
现在,这在 SQL Server 中维护会话的生产中对性能产生了巨大的影响,
我正在寻找管理此结果的解决方案有效地对象(每个用户 1mb 数据)。 调用服务和数据库来获取每个页面数据又很繁重。
谢谢 国民账户体系
This question is about performance in .net.
I have a project which shows 10,000 product information in a grid.
The .net project we have used HTML table to display information .At a time 500 records in a page is shown.And on click of the page numbers the relevant page information is shown.
Grid has actions ,delete ,group ,sort ,filter .
To achieve this we are currently bringing all 10,000 product information from DB(this subtotal result is actually retrieved from 2 DB calls and 2 web service calls) and keep them in session ,and later retrieving the page wise data from session.each page is brought by ajax call-and each ajax call pick up the relevant page data from session -resultset
Now this has a huge performance hit in production where session is maintained in SQL server,
I am looking for a solution managing this result object(1mb data per user) efficiently.
A call to service and db's to get each page data is again heavy.
Thanks
SNA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您真的需要从数据库中为每个用户复制所有 10,000 条记录吗?如果这 10,000 个对于每个用户来说或多或少是相同的,那么您可能需要 缓存有关产品的数据并仅存储对缓存的引用(即主键、内存地址等)。
除了产品列表之外,您还在会话中存储哪些类型的信息?您有多少用户?也许您使用 IIS 内存会话< /a> 用于最关键和经常请求的数据,其余数据则放入 SQL Server 或仅使用 IIS 内存会话(如果您的服务器有足够的容量)。
最后,如果这没有帮助,那么您可能需要更改 SLA 并减少用户会话中存储的产品数量,而不是按需从数据库重新查询它们。这不是最佳选择,但也许 90% 的用户不会注意到任何事情。
Do you really need to copy all 10,000 records from your database for every user? If these 10,000 are the more or less the same for every user, then you probably need to cache the data about products and store only the references to your cache (i.e. primary keys, memory addresses etc.)
What kind of information do you store in session apart from the product list? How many users do you have? Maybe you separate your data, using IIS in-memory sessions for most critical and often requested data and the rest put to your SQL Server or just to use IIS in-memory sessions (if your server has enough capacity for it).
And finally, if that doesn't help, then you probably need to change your SLA and decrease the number of products stored in user sessions, rather re-querying them from database on demand. That is not optimal, but maybe 90% of your users won't notice anything.
在我看来,您有以下选项:
确实没有必要将所有产品发送给用户。使用 ajax 可以轻松处理大量项目,而无需将所有产品推送给用户。
在客户端存储项目。 Cookie 不是一种选择,因为它们无法存储 1mb 的数据。 HTML5 有一个名为 LocalStorage 的东西,您可以使用它(但随后要求您的用户使用现代浏览器)。在这里尝试 LocalStorage:http://www.quirksmode.org/html5/tests/storage。 html
存储表服务器端。即,将所有内容加载到应用程序存储中,并且仅在每个会话中存储密钥。您还可以使用外部缓存(什么是Memcached 与.NET Cache 系统相比有何优势?)
Sounds to me that you got these options:
There is really no need to send all products to the user. Using ajax makes it really easy handle a lot of items without having to push all to the user.
Store items client side. Cookies is not an option since they cannot store 1mb data. HTML5 got something called LocalStorage that you can use (but would then require that your users use a modern browser). Try LocalStorage here: http://www.quirksmode.org/html5/tests/storage.html
Store the table server side. i.e. Load everything into the Application storage and only store keys in each session. You could also use an external cache (What are the advantages of Memcached compared to .NET Cache system?)