| outline |
|
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| title | Thread Pool Configuration | ||||||||||||||||||||||||||||
| titleTemplate | NpgsqlRest | ||||||||||||||||||||||||||||
| description | Configure .NET thread pool settings for NpgsqlRest performance. Worker threads, completion ports, and async optimization for high-throughput APIs. | ||||||||||||||||||||||||||||
| head |
|
Thread pool configuration settings for optimizing application performance.
{
"ThreadPool": {
"MinWorkerThreads": null,
"MinCompletionPortThreads": null,
"MaxWorkerThreads": null,
"MaxCompletionPortThreads": null
}
}| Setting | Type | Default | Description |
|---|---|---|---|
MinWorkerThreads |
int | null |
Minimum number of worker threads in the thread pool. Uses system defaults if null. |
MinCompletionPortThreads |
int | null |
Minimum number of completion port threads. Uses system defaults if null. |
MaxWorkerThreads |
int | null |
Maximum number of worker threads in the thread pool. Uses system defaults if null. |
MaxCompletionPortThreads |
int | null |
Maximum number of completion port threads. Uses system defaults if null. |
- Worker threads execute CPU-bound work and synchronous operations
- Completion port threads handle asynchronous I/O operations (database queries, HTTP requests)
The default thread pool settings work well for most scenarios. Consider adjusting when:
- High-concurrency workloads cause thread pool starvation
- Application experiences delays during burst traffic
- Profiling indicates thread pool bottlenecks
High-concurrency configuration:
{
"ThreadPool": {
"MinWorkerThreads": 100,
"MinCompletionPortThreads": 100,
"MaxWorkerThreads": 500,
"MaxCompletionPortThreads": 500
}
}::: warning Setting thread pool values too high can increase memory usage and context switching overhead. Test thoroughly before deploying to production. :::
- Comment Annotations Guide - How annotations work
- Configuration Guide - How configuration works
- Connection Settings - Configure database connections
- Server & SSL - Configure HTTPS and Kestrel web server