文章编号 | : | 821268 |
最后修改 | : | 2005年8月29日 |
修订 | : | 6.0 |
本页
症状
<script type="text/javascript">loadTOCNode(1, 'symptoms');</script>• | 如果您使用 MicrosoftInternet 信息服务 (IIS) 5.0, 会应用程序事件日志中您收到以下消息:
Event Type: Error Event Source: ASP.NET 1.0.3705.0 Event Category: None Event ID: 1003 Date: 5/4/2003 Time: 6:18:23 PM User: N/A Computer: <ComputerName> Description: aspnet_wp.exe (PID: <xxx>) was recycled because it was suspected to be in a deadlocked state. It did not send any responses for pending requests in the last 180 seconds.
|
• | 如果您使用 IIS 6.0, 会应用程序事件日志中您收到以下消息:
Event Type: Warning Event Source: W3SVC-WP Event Category: None Event ID: 2262 Date: 5/4/2003 Time: 1:02:33 PM User: N/A Computer: <ComputerName> Description: ISAPI 'C:/Windows/Microsoft.net/Framework/v.1.1.4322/aspnet_isapi.dll' reported itself as unhealthy for the following reason: 'Deadlock detected'.
|
• | 如果您使用 IIS 6.0, 会系统事件日志中您收到以下消息:
Event Type: Warning Event Source: W3SVC Event Category: None Event ID: 1013 Date: 5/4/2003 Time: 1:03:47 PM User: N/A Computer: <ComputerName> Description: A process serving application pool 'DefaultAppPool' exceeded time limits during shut down. The process id was '<xxxx>'.
|
原因
<script type="text/javascript">loadTOCNode(1, 'cause');</script>对 Web 服务调用通常, 使用一个辅助线程来执行代码发送请求和一个完成端口线程以从 Web 服务接收回调。 但是, 如果请求重定向或需要验证, 调用可能使用多达两辅助和两完成端口线程。 同时发生多个 Web 服务调用时, 因此您可消耗托管 ThreadPool。
例如, 假设 ThreadPool 仅限于 maxworkerthreads, 10, 并且当前执行所有 10 工作线程正在等待回调来执行代码。 由于工作项排队以 ThreadPool 阻塞线程可用之前可从不执行回调。
其他潜在源争夺是 maxconnection 参数, System.Net 命名空间用于限制的连接数。 此限制通常, 按预期工作。 但是, 如果许多应用程序尝试使许多请求到单个 IP 地址同时, 线程可能需要等待一个可用连接。
解决方案
<script type="text/javascript">loadTOCNode(1, 'resolution');</script>• | maxWorkerThreads |
• | minWorkerThreads |
• | maxIoThreads |
• | minFreeThreads |
• | minLocalRequestFreeThreads |
• | maxconnection |
• | executionTimeout |
• | 限制同时到大约 12 每 CPU 执行, ASP.NET 请求的数量。 |
• | 允许 Web 服务回调用于 ThreadPool 中自由线程。 |
• | 选择一个适当值对于 maxconnections 参数。 根据您选择的 IP 地址和 AppDomains 使用数。 |
maxWorkerThreads 和 maxIoThreads
<script type="text/javascript">loadTOCNode(2, 'resolution');</script> ASP.NET 使用以下两配置设置来限制辅助线程和完成线程所使用的最大数量:
<processModel maxWorkerThreads="20" maxIoThreads="20">
maxWorkerThreads 参数和 maxIoThreads 参数是可隐式乘以的 CPU 数。 例如, 如果有两个处理器, 的工作线程数是:
minFreeThreads 和 minLocalRequestFreeThreads
<script type="text/javascript">loadTOCNode(2, 'resolution');</script> ASP.NET 还包含以下配置设置决定多少辅助线程和完成端口线程必须可用于启动远程请求或本地请求:
<httpRuntime minFreeThreads="8" minLocalRequestFreeThreads="8">
如果还有, 不够线程请求是排队直到足够线程可以自由地发出请求。 ASP.NET, 因此不在同一时间执行超过下列数量的请求:
minWorkerThreads
<script type="text/javascript">loadTOCNode(2, 'resolution');</script> 存为 ASP.NET 1.0 Service Pack 3 以及 ASP.NET 1.1, ASP.NET 还包含以下配置设置决定了多少工作线程可能可立即向远程请求服务。
<processModel minWorkerThreads="1">
以多快速度比从 CLR 默认优化 " 线程 " 功能创建辅助线程创建由该设置控制线程。 此设置允许 ASP.NET 对服务请求, 可能是突然填充 ASP.NET 请求队列由于以 slow-down 在后端服务器, 突然暴发来自客户端, 或类似的请求会导致突然高度以多种请求队列中。 对于 minWorkerThreads 参数默认值为 1。 我们建议, 您将 < minWorkerThreads 参数值设置为以下值。
minWorkerThreads = maxWorkerThreads / 2
默认情况下, minWorkerThreads 参数是 Web.config 文件或 Machine.config 文件中不存在。 此设置隐性乘以的 CPU 数。
maxconnection
<script type="text/javascript">loadTOCNode(2, 'resolution');</script> maxconnection 参数确定如何多连接可对特定 IP 地址。 参数显示如下:
<connectionManagement>
<add address="*" maxconnection="2">
<add address="65.53.32.230" maxconnection="12">
</connectionManagement>
对于本文中前面讨论参数设置为所有在进程级。 但是, maxconnection 参数设置适用于 AppDomain 级别。 默认, 因为此设置适用于 AppDomain 级别, 最多两个连接创建到特定 IP 地址从每个 AppDomain 过程中您。
executionTimeout
<script type="text/javascript">loadTOCNode(2, 'resolution');</script> ASP.NET 使用以下配置设置来限制请求执行时间:
<httpRuntime executionTimeout="90"/>
也可以通过 Server.ScriptTimeout 属性设置此限制。注意 如果您增加 executionTimeout 参数, 值可能还需要修改 processModel responseDeadlockInterval 参数设置。
建议
<script type="text/javascript">loadTOCNode(2, 'resolution');</script> 本节中推荐设置对所有应用程序可能无法工作。 但是, 以下附加信息可以帮助您进行适当调整。如果进行一个 Web 服务调用到单个 IP 地址从每个 ASPX 页面, Microsoft 建议您使用下列配置设置:
• | 设置到 100 maxWorkerThreads 参数和 maxIoThreads 参数的值。 |
• | 设置到 12 maxconnection 参数的值 * N N (其中 N 是的, 您有 CPU 数)。 |
• | minFreeThreads 参数的值设置为 88 * N N , minLocalRequestFreeThreads 参数来 76 N N *。 |
• | 设置到 50 minWorkerThreads 的值。 请记住, minWorkerThreads 处于默认配置文件。 必须添加它。 |
注意使用此配置时, 因为您可以同时执行最多 12 ASP.NET 请求每 CPU = 12 100 - 88。 因此, 至少 88 N 辅助线程和 88 N 完成端口线程可对其他使用 (例如用于 Web 服务回调) * *。
例如, 有服务器与四处理器和 hyperthreading 启用。 对于本文中提及配置设置基于这些公式, 将使用下列值。
<processModel maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50">
<httpRuntime minFreeThreads="704" minLocalRequestFreeThreads="608">
<connectionManagement>
<add address="[ProvideIPHere]" maxconnection="96"/>
</connectionManagement>
还, 使用此配置, 时 12 连接可用每个 CPU 按 IP 地址对于每个 AppDomain。 因此, 在下列情况下, 几乎争夺当请求正在等待连接, 并且不耗尽 ThreadPool:
• | Web 承载一个应用程序 (AppDomain)。 |
• | 每对 ASPX 页面请求发出一个 Web 服务请求。 |
• | 所有请求是到同一 IP 地址。 |
• | 请求是到多个 IP 地址。 |
• | 请求是定向 (302 状态代码)。 |
• | 请求需要身份验证。 |
• | 从多 AppDomains 进行请求。 |
状态
<script type="text/javascript">loadTOCNode(1, 'status');</script>参考
<script type="text/javascript">loadTOCNode(1, 'references');</script>
关键字: |
kbprb KB821268 KbMtzh kbmt |