TsgcWebSocketLoadBalancerServer › Properties › ThreadPoolOptions
Configures the size and upper bound of the reusable thread pool used when ThreadPool is enabled.
property ThreadPoolOptions: TsgcWSThreadPool_Options read FThreadPoolOptions write SetThreadPoolOptions;
MaxThreads=0 (unlimited), PoolSize=32
MaxThreads caps the total number of worker threads the load balancer 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. Because the load balancer multiplexes many short-lived HTTP fan-outs, a larger pool is often beneficial under bursty traffic. The properties take effect only when ThreadPool is True; they are ignored when IOCP or EPOLL are selected.
oServer := TsgcWebSocketLoadBalancerServer.Create(nil);
oServer.ThreadPool := true;
oServer.ThreadPoolOptions.MaxThreads := 1000;
oServer.ThreadPoolOptions.PoolSize := 64;
oServer.Active := true;