TsgcWebSocketLoadBalancerServerProperties › ThreadPool

ThreadPool Property

Enables a thread pool that recycles worker threads instead of destroying them when connections close.

Syntax

property ThreadPool: Boolean read GetThreadPool write SetThreadPool;

Default Value

False

Remarks

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.

Example


oServer := TsgcWebSocketLoadBalancerServer.Create(nil);
oServer.ThreadPool := true;
oServer.ThreadPoolOptions.PoolSize := 64;
oServer.Active := true;

Back to Properties