TsgcWebSocketLoadBalancerServer › Properties › ThreadPool
Enables a thread pool that recycles worker threads instead of destroying them when connections close.
property ThreadPool: Boolean read GetThreadPool write SetThreadPool;
False
When ThreadPool is True, threads that finish serving a downstream client are returned to a pool instead of being destroyed; they are marked inactive and consume no CPU cycles until reused. This dramatically reduces the cost of short-lived HTTP fan-out on the load balancer. Tune ThreadPoolOptions (MaxThreads, PoolSize) to control how many threads may be created. The thread pool is not compatible with IOCP: do not enable both ThreadPool and an IOCP-based I/O handler at the same time.
oServer := TsgcWebSocketLoadBalancerServer.Create(nil);
oServer.ThreadPool := true;
oServer.ThreadPoolOptions.PoolSize := 64;
oServer.Active := true;