asp.net - ASP .NET ProcessModel 配置

标签 asp.net processmodel

根据 this MSDN for ProcessModel 中的文档,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 设置: 8, 4

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

autoConfig=false 按预期工作,默认值可以在输出中看到,但是设置为 true 时的输出让我有点惊讶:
  • 它确实正确设置了 maxWorkerThreads 和 maxIoThreads 属性,因此输出为 200(双核 CPU 上为 100x2)。
  • 但是,它似乎没有设置 minWorkerThreads 属性,根据 KB 应该是: minWorkerThreads = maxWorkerThreads/2
  • 此外,根据 MSDN 文档设置 autoConfig=true 确实将 minFreeThreads 和 minLocalRequestFreeThreads 属性设置为知识库中推荐的值,但情况似乎也并非如此。我得到默认值 8 和 4。

  • 我有点困惑,对这里发生的事情有什么想法吗?我弄错了 sample 还是什么?

    最佳答案

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

    WCF 4: Higher Default Throttling Settings for WCF Services

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

    · MaxConcurrentSessions:默认为 100 * 处理器数量

    · MaxConcurrentCalls:默认为 16 * 处理器数量

    · MaxConcurrentInstances:默认为上述两者的总和,与之前的模式相同。

    关于asp.net - ASP .NET ProcessModel 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4310719/

    相关文章:

    asp.net - 是否可以在运行时更改 ASP.NET Web.Config 值而不重新加载应用程序域?

    c# - 当请求离开 asp :multiview or ajax 时,在 Response.End() 之后没有写入响应

    c# - Mono 3.0/Debian/asp.net - 找不到方法 : 'System. Configuration.IConfigurationSectionHandler.Create

    javascript - Web方法不会调用,但不会出错

    asp.net - 工作线程和 I/O 线程有什么区别?

    ASP.NET - 使用 web.config 文件中的凭据进行登录控制

    logging - 流口水日志文件

    ASP.NET Processmodel 配置优化

    asp.net - 进程模型 minFreeThreads 澄清