【发布时间】:2011-12-08 19:18:32
【问题描述】:
我们有一个托管在 IIS 6.0 上的 .NET 3.5 WCF 服务,它有一个 basicHttp 绑定。这由 2 个 .NET 和 2 个 ASP 应用程序使用。当第 4 个应用程序(无论是 .NET 还是 ASP)启动并尝试使用它时,w3wp.exe 会在 99% 处达到峰值,并在几秒钟后停留在那里。
基于此article,我们尝试将以下内容添加到 .NET 2.0 machine.config 中,但这没有任何效果。
<processModel autoConfig="false" maxWorkerThreads="500" maxIoThreads="500" minWorkerThreads="2"/>
<httpRuntime minFreeThreads="250" minLocalRequestFreeThreads="250"/>
有什么想法吗?
编辑:添加崩溃分析报告信息:
警告 1:w3wp.exe_v2.0 应用程序中的以下线程_PID_2856_Date__12_08_2011__Time_12_13_39PM_876_Manual Dump.dmp 正在等待同步 WCF 请求执行 4.35% 的线程被阻塞
请单击实际线程以查看 WCF 线程或查看 WCF 请求报告以找出该线程正在等待的实际 WCF 线程的线程 ID。有关此 WCF 行为的更多详细信息,请查看有关 WCF 请求限制和服务器可扩展性的博客。
Thread 16 - System ID 3920
Entry point mscorwks!ThreadpoolMgr::intermediateThreadProc
Create time 12/8/2011 12:10:44 PM
Time spent in user mode 0 Days 00:00:00.031
Time spent in kernel mode 0 Days 00:00:00.140
This thread is waiting on a synchronous WCF request to execute
The destination WCF Thread for this ASP.NET worker thread is 14
.NET Call Stack
Function
System.Threading.WaitHandle.WaitOneNative(Microsoft.Win32.SafeHandles.SafeWaitHandle, UInt32, Boolean, Boolean)
System.Threading.WaitHandle.WaitOne(Int64, Boolean)
System.Threading.WaitHandle.WaitOne(Int32, Boolean)
System.Threading.WaitHandle.WaitOne()
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(System.Web.HttpApplication, Boolean)
System.ServiceModel.Activation.HttpModule.ProcessRequest(System.Object, System.EventArgs)
System.Web.HttpApplication+SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
System.Web.HttpApplication+ApplicationStepManager.ResumeSteps(System.Exception)
System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object)
System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest)
System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest)
System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr, Int32)
【问题讨论】:
-
要尝试将 IIS 处理与 WCF 服务所做的工作隔离开来,请创建服务的 Windows 服务托管版本,并查看它在类似负载下是否表现出相同的行为。如果是这样,则服务中的负载会触发 CPU 密集型工作。如果没有,那么您知道您有一个 IIS 优化问题,可以通过迁移到 IIS 7 来解决 :)
-
@SixtoSaez:这似乎是个好主意,但考虑到它的大小,在现阶段将其转换为 Windows 服务(或迁移到 IIS 7)是不切实际的。我希望这可能更多地是关于 ASP.NET 工作线程与 WCF IO 线程对话方式的线程管理问题。