Bagikan melalui


ProcessModelSection.MaxWorkerThreads Properti

Definisi

Mendapatkan atau menetapkan nilai yang menunjukkan jumlah maksimum utas pekerja per CPU di kumpulan utas CLR.

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

Nilai Properti

Jumlah maksimum utas. Defaultnya adalah 20.

Atribut

Contoh

Contoh kode berikut menunjukkan cara mengakses MaxWorkerThreads properti.


// 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

Keterangan

Nilai MaxWorkerThreads harus sama dengan atau lebih besar dari MinFreeThreads pengaturan di bagian httpRuntime konfigurasi.

Anda dapat memiliki kontrol atas pemanfaatan CPU dengan mengatur jumlah utas pekerja dan utas I/O, masing-masing menggunakan MaxWorkerThreads properti dan, MaxIOThreads properti .

Perbedaan antara dua jenis utas adalah bahwa yang terakhir terikat ke objek I/O, seperti aliran atau pipa, dan yang pertama adalah utas tradisional yang tidak dibatasi. Untuk Internet Information Services (IIS) versi 6.0 dan yang lebih tinggi, ASP.NET memproses permintaan pada utas pekerja. Ini karena ASP.NET terintegrasi dalam IIS.

Utas ini diperoleh dari kumpulan utas CLR seluruh proses milik aplikasi.

Nota

Biasanya nilai default untuk utas yang diizinkan cukup untuk menjaga pemanfaatan CPU tetap tinggi. Jika karena alasan tertentu aplikasi Anda lambat, mungkin menunggu sumber daya eksternal, Anda dapat mencoba meningkatkan jumlah utas ke nilai kurang dari 100.

Berlaku untuk

Lihat juga