简体   繁体   English

ASP.NET - 回收应用程序池指示更大的问题?

[英]ASP.NET - Recycling App Pools indicative of Larger problem?

Is having to recycle an App-Pool in ASP.NET indicative of a larger problem in the Web-App? 是否必须在ASP.NET中回收一个App-Pool,表明Web-App中存在更大的问题? Or is this just 'the way things are' for ASP.NET and IIS? 或者这只是ASP.NET和IIS的'事物的方式'?

Edit: Since one of the errors is an 'OutOfMemory' exception, what would be your suggestions for courses of action? 编辑:由于其中一个错误是“OutOfMemory”异常,您对行动方案的建议是什么? Would you add memory? 你会添加内存吗? Profile the app? 介绍应用程序? (It's important to note that I've got my own ideas on this, and have a path lined up, but would like to hear your answers). (重要的是要注意我对此有自己的想法,并且有一条路径排成一列,但是想听听你的答案)。

Personally, I think it's a sign of bigger problems. 就个人而言,我认为这是一个更大问题的迹象。 I have apps that run for weeks without recycling. 我有几周没有回收的应用程序。 The only reason they do recycle is because we push code updates. 他们回收的唯一原因是我们推动代码更新。 I think you should look into your event log to see if you can find any reason why the app pool is recycling. 我认为您应该查看您的事件日志,看看您是否可以找到应用程序池回收的任何原因。 I've seen it happen quite often with memory leaks that will eventually cause you to run out of memory, forcing your app pool to restart. 我已经看到它经常发生内存泄漏,最终会导致内存不足,迫使你的应用程序池重新启动。

The health monitoring features of IIS enable automatic recycling of an app pool. IIS的运行状况监视功能可以自动回收应用程序池。 So an app pool just recycling itself is not necessarily indicative of a problem; 因此,仅仅回收自己的应用程序池并不一定表示存在问题; it could just be the preventive feature of IIS is turned on. 它可能只是启用了IIS的预防功能。 The idea is that if your application has a memory leak or forgets to deallocate something, we can improve overall availability of the application by restarting it every so often, much like how you might restart Windows after it's been running on your desktop for a month and the net effects of small bad behaviors of many applications begin to take its toll. 我们的想法是,如果您的应用程序有内存泄漏或忘记解除分配,我们可以通过每隔一段时间重新启动它来提高应用程序的整体可用性,就像您在桌面上运行一个月后重新启动Windows一样。许多应用程序的小坏行为的净效应开始造成损失。

In some other platforms, you might not notice these problems as quickly, especially in a CGI environment, since the whole framework is set up and then torn down with each page request. 在其他一些平台中,您可能不会快速地注意到这些问题,尤其是在CGI环境中,因为整个框架已经设置好,然后随着每个页面请求被拆除。

Ideally, you would never have to restart the application pool, and having to do so is usually a sign of some sort of problem. 理想情况下,您永远不必重新启动应用程序池,并且必须这样做通常是某种问题的迹象。 The recycling feature is a sort of liability insurance against our own mistakes, or those "the planets just aligned just so" errors that are very difficult to track down, recreate, and happen so infrequently that they are probably not worth troubleshooting. 回收功能是针对我们自己的错误的一种责任保险,或那些“行星刚刚对齐”的错误,这些错误非常难以追踪,重新创建,并且很少发生,以至于它们可能不值得进行故障排除。

There are alot of reasons an app pool can recycle. 应用程序池可以回收的原因很多。 Unhandled exceptions, or threads hanging are a common cause. 未处理的异常或线程挂起是常见原因。 If you aren't closing all your SqlConnections and the connection pool is empty can cause it to recycle too. 如果您没有关闭所有SqlConnections并且连接池为空,则会导致它也回收。 Deadlock timeout is another one, if you have a deadlock it will hang the worker process, and that will cause a recycle. 死锁超时是另一个,如果你有一个死锁,它将挂起工作进程,这将导致回收。 Also, if IIS is using an abnormal amount of resources on the server, it will recycle (I think the default is 60%) 此外,如果IIS在服务器上使用异常数量的资源,它将回收(我认为默认值为60%)

There are also alot of iis settings that will trigger it. 还有很多iis设置会触发它。 There are settings to regularly recycle (in order to clear out session state), I think by default it is once every 24hrs. 有定期回收的设置(为了清除会话状态),我认为默认情况下每24小时一次。 We have about 40 moderate to heavy public facing properties that we set to recycle during low periods. 我们有大约40个中等到重型公共物业,我们设定在低时期回收。

I am pretty sure there are other reasons as well. 我很确定还有其他原因。 People losing their sessions is probably better then the app crashing or the server hanging, which is why this is built in to IIS. 失去会话的人可能比应用程序崩溃或服务器挂起更好,这就是内置于IIS的原因。 Unfortunately, it can make it really hard to diagnose the problem. 不幸的是,它可能使诊断问题变得非常困难。 I would look at your event viewer around the time a recycle happens and see if there is anything interesting as a place to start. 我会在回收发生的时候看看你的事件查看器,看看有没有什么有趣的地方可以开始。 Keeping track of memory usage would be my next step, followed by some verbose logging. 跟踪内存使用情况将是我的下一步,然后是一些详细的日志记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM