TsgcWebSocketServerProperties › ThreadPoolOptions

ThreadPoolOptions Property

Configures the size and upper bound of the reusable thread pool used when ThreadPool is enabled.

Syntax

property ThreadPoolOptions: TsgcWSThreadPool_Options read FThreadPoolOptions write SetThreadPoolOptions;

Default Value

MaxThreads=0 (unlimited), PoolSize=32

Remarks

MaxThreads caps the total number of worker threads the server may create; when the limit is reached additional incoming connections are refused. Leave it at 0 for no upper bound. PoolSize is the number of threads kept warm in the pool (default 32); higher values reduce creation overhead for bursty workloads at the cost of idle memory. The properties take effect only when ThreadPool is True; they are ignored when IOCP or EPOLL are selected via IOHandlerOptions.

Example


oServer := TsgcWebSocketServer.Create(nil);
oServer.ThreadPool := true;
oServer.ThreadPoolOptions.MaxThreads := 500;
oServer.ThreadPoolOptions.PoolSize := 64;
oServer.Active := true;

Back to Properties