本文介绍了这是错的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了优化性能,我计划在会话缓存/变量中为用户提供任何有用的信息

。我们的网络服务器将有2GB的内存启动

out。


因为我将放入我将放入的数据量非常宽松会话,

我知道会占用大量的内存资源。但我的计划是监控

网络服务器活动,当流量增加时,我需要做的就是添加另外2GB的
,然后另外2GB,直到我最大化盒子上允许使用内存。

当我无法再添加内存时,我会添加另一个盒子来为网站服务。


我的计划是这样的简单,等错?请与我分享您的

体验和您的想法。非常感谢提前。

To optimize performance, I plan on putting any useful information for a user
in a session cache/variable. Our web server will have 2GB of memory to start
out with.

Since I will be very liberal in the amount of data I''ll put in the session,
I know that will use lots of memory resource. But my plan is to monitor the
web server activity, and when traffic ramping up, all I need to do is add
another 2GB, then another 2GB until I max out memory allowed on the box.
When I can''t add anymore memory, I will add another box to serve the site.

Is my plan so simplistic, and so wrong? Please share with me your
experiences and your thoughts. Thanks so much in advance.

推荐答案




在Session中缓存用户数据是一个好主意 - 但只有在你需要的时候...

那里没什么特别的正确的或错误的关于这样做 -

会话对象毕竟是用的...


只有你可以决定存储多少元素或多少元数据。 ..


例如如果你有很多很多并发用户,那么你可以做的任何事情都可以做到最好尽量减少重复数据库查询。这可能是一个好主意。


但是,如果你'最初的前提是,你所要做的就是在你的网站上投入更多的资金,而且一切都会很好,你真的好了。

应该退后一步尝试正确设计你的网站。



Caching user data in Session is a great idea - but only if you need to...
There''s nothing particularly "right" or "wrong" about doing this - the
Session object is there to be used after all...

Only you can decide how much or how little metadata to store...

E.g. if you have lots and lots of concurrent users, anything you can do to
minimise repetitive database querying is probably a good idea.

However, if you''re initial premise is that all you have to do is throw more
hardware resources at your site and everything will be well, you really
should take a step back and try to design your site properly.







您可能希望将会话缓存设置为使用aspnet_state服务

因此,如果您更新网站,当前会话不会丢失其状态(或者当工作进程被回收时)。或者甚至使用SQL

服务器来保存会话数据,这可以(据我所知)保持数据即使在机器重启时也能保证数据。


Andrew



You might want to set the session cache to use the aspnet_state service
so that if you update the site the current sessions don''t lose their
states (or when the worker process gets recycled). Or even use SQL
server to hold the session data, which can (as far as I read) keep data
even over a machine reboot.

Andrew


这篇关于这是错的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 20:41