0

我正在尝试创建一个简单的 OWIN/Katana - 托管 Web 服务,驻留在 Azure Worker 角色中。我预计会出现高并发情况,并试图弄清楚如何增加诸如 HTTP.Sys 队列限制之类的东西并进行其他提高并发性的配置更改(例如 WCF 中的最大并发实例)。

所有想法都表示赞赏。

谢谢。

4

2 回答 2

3

我相信您正在寻找限制 selfhost katana 的方法。对于 katana selfhost,您可以使用以下方式限制底层 HttpListener:

public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var owinHttpListener = (OwinHttpListener)app.Properties["Microsoft.Owin.Host.HttpListener.OwinHttpListener"];
            //Default for maxAccepts = 5 * ProcCount
            //Default for maxRequests = Int32.MaxValue;
            owinHttpListener.SetRequestProcessingLimits(x, y);

            //Your OWIN pipeline here...
        }
    }
于 2013-09-03T01:43:08.107 回答
1

Configuration changes to the machine level config values, IIS values and what not can be accomplished for both Web and Worker roles by using start up tasks. Specifically you should be able to use appcmd.xe to set the change for the HTTP.sys queue limit (Note, I've not tried it personally, but if you use a start up command with elevated rights I don't see why it wouldn't work).

Example (for 2008, 2012 should be similar I'd think): appcmd.exe set config /section:serverRuntime /appConcurrentRequestLimit:<#of users * 1.5>.

Docs for appcmd.exe command line: Modifying the ASP.NET queue length limit

Note that this can be tricky depending on what you are trying to accomplish, so check out this other MS documentation on the subject.

于 2013-09-02T02:01:11.520 回答