架构师_程序员_码农网

Retrieve password
Register

QQ登录

Just one step to get started

Search
Views:24252|Replies: 0
打印 上一主题 下一主题

[ NET/C# Set Minimum Number of Threads ThreadPool.SetMinThreads Improves Performance

[Copy link] .
ThreadPool.SetMinThreads
跳转到指定楼层
owner of the building
发表于 2021-6-17 18:10:45| 看该作者回帖奖励|ReverseBrowse|Read Mode
public static bool SetMinThreads(int workerThreads, int completionPortThreads)

workerThreads: the new minimum number of free auxiliary threads to be maintained by the thread pool.
completionPortThreads: the new minimum number of idle asynchronous I/O threads to be maintained by the thread pool.

Idle threads are maintained by the thread pool in order to reduce the time required to fulfill thread requests from the thread pool. Separate minimums are maintained for auxiliary threads and asynchronous I/O threads. To conserve system resources, idle threads that exceed the minimum number are terminated. Idle threads are maintained as background tasks.

What is the maximum number of threads that can be set in the thread pool?

The maximum number of worker threads is: 32767, the maximum number of asynchronous I/O threads is: 1000, the number is independent of the number of CPU cores, if the number is greater than the maximum number that can be set when using the SetMinThreads method, the setup will fail, i.e., the SetMinThreads method returns false, which means that the change failed.

Test code:










Previous: .
Next: NET/C# SslMode Performance Optimization for MySQL Databases
Code Farmer, only published in the process of practice, encountered technical difficulties, do not mislead others.
You need to log in before you can post back Log in | Register

This version of the integral rules

DISCLAIMER:
All software, programming materials or articles published by Code Farmer are limited to be used for learning and research purposes only; the above contents shall not be used for commercial or illegal purposes, otherwise, all the consequences shall be borne by the users themselves. This site information from the network, copyright dispute has nothing to do with this site. You must completely remove the above content from your computer within 24 hours of downloading. If you like the program, please support the genuine software, buy registration and get better genuine service. If there is any infringement, please contact us by email to deal with it.

Mail To:help@itsvse.com

QQ| ( ICP备14021824号-2 )|Sitemap

GMT+8, 2024-9-19 01:43

Quick ReplyBack to topBack to list