问题描述
我运行到使用实现IHttpAsyncHandler通用处理器的一些性能问题。最简单的处理程序接收一个GET请求,20秒后结束后写'&LT的反应;超时/>'到响应。
在与10000-20000同时请求锤击ashx的,它无法与503服务器precisely 5000请求后不可用。当切换到同步模式,并立即结束的请求,问题消失。
我修修补补了一些设置,但我已经成功地acheive较低在发生这个错误请求门槛。唯一
这里是我已经玩弄设置一个破败的:
machine.config中:
<结构>
...
<&的System.Web GT;
...
<中processModel启用=真requestQueueLimit =10000/>
...
的web.config:
<结构>
...
<&的System.Web GT;
...
<的httpRuntime启用=真正的AP prequestQueueLimit =10000/>
...
IIS管理器> ApplicationPools>高级设置
队列长度:65535
虽然我不能肯定,好像这些设置工作好和细如果请求是同步的,但是当异步,我似乎无法获得超越5000完全相同请求的服务器开始告诉我走开之前。如果我设置的东西较低(不记得到底是哪设置,这将是从上面的,但我已经试过所有),那么503计数上升相应的,但我从来没有停止它的时候严重负荷下发生超越5000
似乎有一些散在的可能影响这个地方了无数的设置,但5000似乎相当一成不变的。我看<一个href=\"http://74.125.77.132/search?q=cache:Rw6hb12Ac94J:www.duringlunch.com/file.axd%3Ffile%3DAdvanced%2BASP.Net%2B2.ppt%2Bap$p$pquestQueueLimit%2B%22up%2Bto%22%2B5000&hl=en&ct=clnk&cd=1&gl=uk&client=firefox-a\">here该AP prequestQueueLimit不能超过5000,但可以找到有关此没有进一步的信息,并知道这是误传。
有什么样的防洪在IIS中设置可能被限制在单个主机不超过5000的请求?我怎样才能获得IIS来处理更多的并发5000异步请求?
EDIT2:是否有其极限可能会超出任何柜台或其他指标,我怎么会进一步调查
?编辑:这里是loadgenerator code:
使用系统;
使用System.Net;
使用的System.Threading;命名空间HammerTime
{
类节目
{
私有静态诠释柜台= 0;
静态无效的主要(字串[] args)
{
VAR上限= 5000;
ServicePointManager.DefaultConnectionLimit =限制;
的for(int i = 0; I&LT;限制; ++ I)
{
StartWebRequest(i.ToString()); }
到Console.ReadLine();
} 私有静态无效StartWebRequest(字符串的channelID)
{
字符串URI =HTTP://spender2008/test/Test.ashx通道=+的channelID;
HttpWebRequest的要求=(HttpWebRequest的)WebRequest.Create(URI);
request.BeginGetResponse(ResponseHandler所,请求);
} 私有静态无效ResponseHandler所(IAsyncResult的AR)
{
尝试
{
HttpWebRequest的状态=(HttpWebRequest的)ar.AsyncState;
HttpWebResponse响应=(HttpWebResponse)state.EndGetResponse(AR); }
赶上(例外五)
{
Console.WriteLine(e.Message);
}
最后
{
Console.WriteLine(Interlocked.Increment(参考计数器));
} }
}
}
确定。修正了......非常感谢职务。
要消除所需的503错误3种不同配置的变化:
machine.config中:
&LT;结构&gt;
...
&LT;&的System.Web GT;
...
&LT;中processModel启用=真requestQueueLimit =100000/&GT;
IIS管理器> ApplicationPools>高级设置
队列长度:65535
和最后(缺少一块拼图),在命令行:
Appcmd.exe的设置配置/条:serverRuntime中/ appConcurrentRequestLimit:100000
在主帖中提到的web.config中的设置是不相关的。
10000并行连接,没有任何问题。感谢您的帮助!
I'm running into some performance issues using a generic handler that implements IHttpAsyncHandler. At its simplest, the handler receives a GET request, and 20 seconds later ends the response after writing '< timeout / >' to the response.
When hammering the .ashx with 10000-20000 simultaneous requests, it fails with 503 server unavailable after precisely 5000 requests. When switching to synchronous mode, and ending the request immediately, the problem goes away.
I've tinkered with a number of settings, yet the only thing I've managed to acheive is lower the request threshold at which this error occurs.
Here's a rundown of the settings I've toyed with:
machine.config:
<configuration>
...
<system.web>
...
<processModel enable="true" requestQueueLimit="10000"/>
...
web.config:
<configuration>
...
<system.web>
...
<httpRuntime enable="true" appRequestQueueLimit="10000"/>
...
IIS Manager > ApplicationPools > Advanced Settings
Queue Length : 65535
Although I can't be sure, it seems like these settings work good and fine if the requests are synchronous, but when async, I can't seem to get beyond exactly 5000 requests before the server starts telling me to go away. If I set things lower (can't remember exactly which setting that would be from the above, but I've tried them all), then the 503 count goes up accordingly, but I can never stop it happening beyond 5000 when under serious load.
It seems that there a a number of settings scattered in a myriad of places that might affect this, but the 5000 seems fairly set in stone. I see here that appRequestQueueLimit cannot exceed 5000, but can find no further info about this, and wonder if this is misinformation.
Is there any kind of "flood-control" setting in IIS that might be limiting a single host to no more than 5000 requests? How can I get IIS to handle more that 5000 concurrent asynchronous requests?
Edit2: Are there any counters or other indicators of which limit might be being exceeded, and how would I investigate further?
Edit: Here's the loadgenerator code:
using System;
using System.Net;
using System.Threading;
namespace HammerTime
{
class Program
{
private static int counter = 0;
static void Main(string[] args)
{
var limit = 5000;
ServicePointManager.DefaultConnectionLimit=limit;
for (int i = 0; i < limit;++i )
{
StartWebRequest(i.ToString());
}
Console.ReadLine();
}
private static void StartWebRequest(string channelId)
{
string uri = "http://spender2008/test/Test.ashx?channel="+channelId;
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(uri);
request.BeginGetResponse(responseHandler, request);
}
private static void responseHandler(IAsyncResult ar)
{
try
{
HttpWebRequest state = (HttpWebRequest)ar.AsyncState;
HttpWebResponse response = (HttpWebResponse)state.EndGetResponse(ar);
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
Console.WriteLine(Interlocked.Increment(ref counter));
}
}
}
}
OK. Fixed... many thanks to this post for clearing up a few details.
To eliminate the 503 errors required 3 different config changes:
machine.config:
<configuration>
...
<system.web>
...
<processModel enable="true" requestQueueLimit="100000"/>
IIS Manager > ApplicationPools > Advanced Settings
Queue Length : 65535
and finally (the missing piece of the puzzle), the command line:
appcmd.exe set config /section:serverRuntime /appConcurrentRequestLimit:100000
The web.config setting mentioned in the main post was irrelevant.
10000 concurrent connections, no problems. Thanks for help!
这篇关于IIS 7.0 503错误与通用处理器(ashx的)执行IHttpAsyncHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!