ProcessModelSection.MaxWorkerThreads プロパティ

定義

CLR スレッド プール内の CPU あたりのワーカー スレッドの最大数を示す値を取得または設定します。

public:
 property int MaxWorkerThreads { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("maxWorkerThreads", DefaultValue=20)]
[System.Configuration.IntegerValidator(MaxValue=2147483646, MinValue=1)]
public int MaxWorkerThreads { get; set; }
[<System.Configuration.ConfigurationProperty("maxWorkerThreads", DefaultValue=20)>]
[<System.Configuration.IntegerValidator(MaxValue=2147483646, MinValue=1)>]
member this.MaxWorkerThreads : int with get, set
Public Property MaxWorkerThreads As Integer

プロパティ値

スレッドの最大数。 既定値は 20 です。

属性

次のコード例は、 MaxWorkerThreads プロパティにアクセスする方法を示しています。


// Get the current MaxWorkerThreads property value.
int maxWorkerThreads = 
    processModelSection.MaxWorkerThreads;

// Set the MaxWorkerThreads property to 128.
processModelSection.MaxWorkerThreads = 128;
' Get the current MaxWorkerThreads property value.
   Dim maxWorkerThreads As Integer = _
   processModelSection.MaxWorkerThreads

' Set the MaxWorkerThreads property to 128.
processModelSection.MaxWorkerThreads = 128

注釈

MaxWorkerThreadsの値は、httpRuntime構成セクションのMinFreeThreads設定以上である必要があります。

MaxWorkerThreads プロパティと MaxIOThreads プロパティをそれぞれ使用して、ワーカー スレッドと I/O スレッドの数を設定することで、CPU 使用率を制御できます。

2 種類のスレッドの違いは、後者がストリームやパイプなどの I/O オブジェクトにバインドされ、前者が従来の無制限のスレッドであるという点です。 インターネット インフォメーション サービス (IIS) バージョン 6.0 以降の場合、ASP.NET はワーカー スレッドで要求を処理します。 これは、ASP.NET が IIS 内に統合されているためです。

これらのスレッドは、アプリケーションに属するプロセス全体の CLR スレッド プールから取得されます。

通常、許可されるスレッドの既定値は、CPU 使用率を高く保つために十分です。 何らかの理由でアプリケーションが低速で、おそらく外部リソースを待機している場合は、スレッドの数を 100 未満の値に増やすことができます。

適用対象

こちらもご覧ください