ASP.NET 应用程序/会话缓存是否强制应用程序重新启动?

发布于 2024-12-17 07:36:27 字数 763 浏览 2 评论 0原文

我希望这更多地成为一种讨论。

所以我有一个网站 www.utopiapimp.com。目前每天的页面浏览量超过 100 万次。该网站上有大量不断变化的动态数据。想想“实时股票行情”,但它是一个在线网页游戏。我遇到了一个很深的障碍。

当 Web 应用程序启动时,我从数据库加载一些静态项目,但之后每次用户登录时,我都会为该用户发出 15 个数据库调用,并将这 15 个数据库调用中的整个对象填充到缓存中。在我的服务器显示器上,我可以看到我的 4 GB 内存慢慢地增加到只有 2 GB。然后发生了一些事情,但我不知道是什么。

1 核 CPU VPS,开始永远保持在 25%。有时处理量会飙升至 50% 以上。但大约 20 分钟后,2gbs 或 ram 突然下降到大约 400 毫克,再也没有恢复。

我可以一遍又一遍地重复这句话。我不知道是什么原因造成的,但细心的我仔细扫描了网站和代码,没有发现真正的问题。我开始认为也许我访问了缓存并在缓存中存储了太多东西,但我确实还没有得出结论。

那么在听到这个场景后,有人可以建议我可能错过的东西吗?也许应用程序崩溃了?它在收到的点击量下很难重新启动并且不断崩溃?

我对这个问题很困惑,似乎找不到解决方案。

也许升级到更好的 vps 可能会起作用,但我不想升级到几乎发现同样的问题。

任何帮助公关建议都会很棒,因为过去一周我一直在为此苦苦挣扎,而我的用户确实在努力寻求解决方案。

编辑

我已联系我的托管公司并等待回复。任何其他建议或想法将不胜感激...

非常感谢!

I want this to be more of a discussion than anything.

So I have a website at www.utopiapimp.com. Right now it gets over 1 mil page views a day. There is a ton of dynamic data on this site that is always changing. Think "live stock ticker" but for a online web game. I've run into a deep snag.

I load a few static items from the db when the web app starts, but after that each time a user logs in, I make a out 15 db calls for that user and stuff that entire object into cache from those 15 db calls. On my server monitor I can see my 4 gbs of ram slowely inch up to only 2 gbs. Then something happens and I don't know what.

The 1 core CPU VPS ,starts sitting at 25% forever. Sometimes the processing spikes to well over 50%. But after about 20 mins the 2gbs or ram drops suddenly down to about 400 mgs never to recover.

I can repeat this over and over again. I don't know what is causing this but the meticulous side of me scanned the website and code over hard and found no real hang ups. I began to think maybe I access the cache and store too many things in cache but I truly haven't come to a conclusion.

So after hearing that scenario, can anyone suggest something I may be missing? Maybe the application crashes? And it struggles to restart with the amount of hits it receives and just keeps crashing?

Im pretty hung up on this issue and cant seem to find a solution.

Maybe upgrading to a better vps might work, but i don't want to upgrade nearly to find the same problem there.

Any help pr suggestions would be brilliant because I've been struggling over this for the past week and my users are really hammering for a solution.

EDIT

Ive contacted my hosting company and waiting for a response. Any other suggestions or ideas would be greatly appreciated...

thanks so much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒废 2024-12-24 07:36:27

machine.config 中的 processmodel 部分包含一个参数 memoryLimit,通常为可用内存的 60%。也许这会导致您的应用程序池重置。尝试增加数量以查看是否会导致重置。

<processModel ...
          memoryLimit="60"
/>

另一种可能性是.NET 内存不足并清除缓存。我曾经创建一个管理页面,可以在其中查看当前存储在缓存中的对象。

编辑:
如果您在会话中存储大量数据,则所需的内存会随着每个用户的增加而增加。会话超时后,所需的内存将会减少。您应该始终尽量避免在会话中存储太多数据。

The section processmodel in machine.config contains a parameter memoryLimit which is normally at 60% of the available memory. Maybe that causes a reset of your application pool. Try to increase the amount to see wether this causes the reset.

<processModel ...
          memoryLimit="60"
/>

Another possibility is that .NET gets short of memory and clears the cache. I used to create an admin page where I can have a look which objects are currently stored in the Cache.

EDIT:
In case you store huge data in the session, the required memory increases with every user. After sesssion timeout, the required memory will be reduced. You should always try to avoid storing too much data in the session.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文