从 ASP.NET 发出 Web 服务请求时出现争用、性能不佳和死锁
我最近部署了一个使用许多 Web 服务调用的 Web 应用程序。在开发过程中,我没有注意到任何死锁或争用,但现在当网站上线并且访问量很大时,我每天都会在事件日志中多次收到此错误,并且网站也会冻结/挂起,因此我必须重新启动 IIS 。
应用程序池“默认 AppPool”超出了其作业限制设置。
我在此网站上找到了一些信息 http://support.microsoft.com/kb/821268,看起来很有希望,但我需要一些有关设置值的帮助。
我正在考虑调整这些设置:
* maxWorkerThreads
* minWorkerThreads
* maxIoThreads
* minFreeThreads
* minLocalRequestFreeThreads
* maxconnection
* executionTimeout
首先它说我必须在 Machine.configm 中执行它们,但我不能只在 Web.config 中执行它们吗?
其次,解决我的争用问题的推荐设置是什么?我的(虚拟)网络服务器在以下系统配置上运行:
我也知道要永久解决此问题,我可能需要对我的代码做一些事情,添加缓存等。我也欢迎有关此的提示。
I have recently deployed a web application that makes use of many web service calls. During deveolpment I did not notice any deadlock or contention, but now when the website is live and heavily visited I get this error in my event log a couple of times a day, and the website also freeze/hangs so that I have to restart IIS.
Application pool 'Default AppPool' exceeded its job limit settings.
I have found some information on this site http://support.microsoft.com/kb/821268, that looks promising, but I need some help regarding the setting values.
Im thinking of tuning these settings:
* maxWorkerThreads
* minWorkerThreads
* maxIoThreads
* minFreeThreads
* minLocalRequestFreeThreads
* maxconnection
* executionTimeout
First it says I have to do them in Machine.configm but couldnt I just do them in Web.config?
Second, what would be the reccomended settings to solve my problem with contention? My (virtual) webserver is running on the following system configuration:
I also know that to solve this permanently, I might have to do something with my code, add caching etc. I welcome tips regarding this aswell.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的知识库链接仅与 2.0 版及更早版本的 .NET Framework 相关。
连接到 Web 服务的 ASP.NET 网站通常不会发生死锁。因此,如果您在代码(或第三方库)中使用自定义锁定,它很可能就是罪魁祸首。因此,弄清真相很重要。
如果线程数量是瓶颈,则增加线程数量可以帮助提高性能。它不太可能帮助解决线程死锁。
就解决方案而言,最重要的一项设置是maxConnection,它默认值为 2,这意味着您只能同时进行 2 个 Web 服务调用。
另请查看此。
Your KB link only relates to versions 2.0 and older of .NET framework.
Deadlocks would not normally happen on an ASP.NET website connecting to web services. So it is very likely that if you use custom locking in the code (or a third-party library), it could be the culprit. So it is important to get to the bottom of that.
Upping the number of threads could help the performance if it is the bottleneck. It is very unlikely to help with thread dead-locks.
In terms of solution, one setting which is of utmost importance is maxConnection which by default is at 2 which means you can only make 2 web service calls at the same time.
Also look into this.
感谢 Aliostad 和 http://www.guidanceshare.com/wiki/ASP。 NET_2.0_Performance_Guidelines__-_Threading 我现在已经调整了我的 Web.config 并添加了以下设置:
这看起来不错吗?我不知道为什么我添加了 maxRequestLength="30000",但它已经有一段时间了。高达30000,这可能有问题吗?
编辑:
看起来我无法在 Web.config 中添加 tge processModel 标记,我收到此错误:
Thanks to Aliostad and http://www.guidanceshare.com/wiki/ASP.NET_2.0_Performance_Guidelines_-_Threading I have now tuned my Web.config and added the following settings:
Does this look okay? I'm not sure why I added maxRequestLength="30000", but it has been like that for a while. Might that be problem, that it is as high as 30000?
EDIT:
Looks like I cant add tge processModel tag in my Web.config, I get this error: