【问题标题】:ASP .NET ProcessModel configurationASP .NET ProcessModel 配置
【发布时间】:2011-05-17 16:17:55
【问题描述】:

根据 MSDN 中针对 ProcessModel 的 this 文档,autoConfig=true 根据这篇 KB 文章设置以下属性:

maxWorkerThreads、maxIoThreads、minFreeThreads、minLocalRequestFreeThreads、maxConnection

为了验证此设置,我在 ASP .NET 3.5 中有一个示例 Web 应用程序,在 page_load 事件中包含以下代码:

        int w, c;

        ThreadPool.GetMinThreads(out w, out c);

        // Write the numbers of minimum threads
        Response.Write("Min: " + string.Format("{0}, {1}", w, c));

        w=0;
        c = 0;

        ThreadPool.GetMaxThreads(out w, out c);

        Response.Write(" Max: " + string.Format("{0}, {1}", w, c));

        Response.Write(" Maxconnections: " + ServicePointManager.DefaultConnectionLimit);

        Configuration conf = ConfigurationManager.OpenMachineConfiguration();
        ConfigurationSectionGroup secGrp = conf.SectionGroups["system.web"];
        ConfigurationSection sec = secGrp.Sections["httpRuntime"];
        Response.Write(" httpruntime settings: " + sec.ElementInformation.Properties["minFreeThreads"].Value + ", " +
                                                    sec.ElementInformation.Properties["minLocalRequestFreeThreads"].Value);

        Response.Flush();

当我先将 autoConfig 设置为 false 然后设置为 true 运行页面时,我得到以下输出:

autoConfig=false: Min: 2, 2 Max: 40, 40 Maxconnections: 10 httpruntime settings: 8, 4

autoConfig=true: Min: 2, 2 Max: 200, 200 Maxconnections: 24 httpruntime settings: 8, 4

autoConfig=false 按预期工作,并且可以在输出中看到默认值,但是设置为 true 时的输出让我有点吃惊:

  1. 它确实正确设置了 maxWorkerThreads 和 maxIoThreads 属性,因此输出为 200(双核 CPU 上为 100x2)。
  2. 但是,它似乎没有设置 minWorkerThreads 属性,根据 KB 应该是:minWorkerThreads = maxWorkerThreads/2
  3. 此外,根据 MSDN 文档设置 autoConfig=true 确实将 minFreeThreads 和 minLocalRequestFreeThreads 属性设置为 KB 中推荐的值,但似乎也并非如此。我得到了 8 和 4 的默认值。

我有点困惑,关于这里发生了什么的任何想法?是我弄错了样本还是什么?

【问题讨论】:

  • 我正在尝试提高我的 web 服务吞吐量(目前只有少数用户获得 100% 的 CPU 负载),但我遇到了完全相同的问题。启用 AutoConfig 后,MaxWorkerThreads 得到 20。
  • 我在双核机器上的 IIS6 中运行 ASP.NET 3.5 应用程序,我得到的结果和你一样。
  • 出了点问题,不确定是什么?在将 AutoConfig 属性设置为 false 后,我们最终在 web.config 中手动修改了设置!

标签: asp.net processmodel


【解决方案1】:

我的猜测是您正在处理以下相同的逻辑:

WCF 4: Higher Default Throttling Settings for WCF Services

在 WCF 4 中,我们修改了这些设置的默认值,以便人们在大多数情况下不必更改默认值。以下是主要变化:

· MaxConcurrentSessions:默认为100 * ProcessorCount

· MaxConcurrentCalls:默认为 16 * ProcessorCount

· MaxConcurrentInstances:默认是以上两个的总和,和之前的模式一样。

【讨论】:

    猜你喜欢
    • 2010-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-25
    • 1970-01-01
    • 2017-03-01
    • 2011-11-29
    • 1970-01-01
    相关资源
    最近更新 更多