Web Api请求永远在IIS上排队(状态:ExecuteRequestHandler) [英] Web Api Requests Queueing up forever on IIS (in state: ExecuteRequestHandler)

查看:2103
本文介绍了Web Api请求永远在IIS上排队(状态:ExecuteRequestHandler)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在生产环境中遇到一些问题,经过一些调查后,我看到很多请求在应用程序池的工作进程中排队。常见的是,排队很长时间的每个请求都是一个web api请求,我在应用程序中同时使用 MVC Web API

I'm currently experiencing some hangs on production environment, and after some investigation I'm seeing a lot of request queued up in the worker process of the Application Pool. The common thing is that every request that is queued for a long time is a web api request, I'm using both MVC and Web API in the app.

请求排队约3小时,当应用程序池被回收时,它们会立即开始排队。

The requests are being queued for about 3 hours, when the application pool is recycled they immediately start queueing up.

他们全都在 ExecuteRequestHandler 状态

我应该继续挖掘哪些想法?

Any ideas for where should I continue digging?

推荐答案

您的请求可能会因多种原因而停止:

Your requests can be stalled for a number of reasons:


  • 他们正在等待I / O操作,例如数据库,Web服务调用

  • 他们正在循环或对大型数据集执行操作

  • cpu密集型操作

  • 以上的一些组合

  • they are waiting on I/O operation e.g database, web service call
  • they are looping or performing operations on a large data set
  • cpu intensive operations
  • some combination of the above

为了找出你的要求在做什么,首先获取请求的网址需要很长时间。

In order to find out what your requests are doing, start by getting the urls of the requests taking a long time.

你可以在cmd行中执行此操作,如下所示

You can do this in the cmd line as follows

c:\windows\system32\inetsrv\appcmd list requests

如果从网址中看不清楚并且查看代码,则需要对w3wp进行进程转储服务器上的.exe。一旦你有一个进程转储,你需要将它加载到windbg中,以分析占用所有cpu周期的内容。覆盖windbg是相当大的,但这里简要介绍一下你需要做什么:

If its not obvious from the urls and looking at the code, you need to do a process dump of the w3wp.exe on the server. Once you have a process dump you will need to load it into windbg in order to analyze what's taking up all the cpu cycles. Covering off windbg is pretty big, but here's briefly what you need to do:


  • 加载SOS dll(托管调试扩展)

  • 调用!runaway命令

  • 获取长时间运行的线程列表,通过选择它并调用!clrstack command <进入长期运行的线程
    / li>
  • load the SOS dll (managed debug extension)
  • call the !runaway command
  • to get list of long running threads dive into a long running thread by selecting it and calling !clrstack command

有很多关于使用windbg的博客。这是一个示例。分析这些类型问题的一个很好的资源是Tess Ferrandez的博客

There are many blogs on using windbg. Here is one example. A great resource on analyzing these types of issues is Tess Ferrandez's blog.

这篇关于Web Api请求永远在IIS上排队(状态:ExecuteRequestHandler)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆