次の方法で共有


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

プロパティ値

Int32

スレッド数の上限。 既定値は 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

注釈

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

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

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

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

注意

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

適用対象

こちらもご覧ください