TsgcWebSocketProxyServerProperties › 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 downstream worker threads the proxy 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. Size the pool generously in proxy scenarios because each accepted downstream client also opens an outbound link to the server defined in Proxy.

Example


oProxy := TsgcWebSocketProxyServer.Create(nil);
oProxy.ThreadPool := true;
oProxy.ThreadPoolOptions.MaxThreads := 500;
oProxy.ThreadPoolOptions.PoolSize := 64;
oProxy.Proxy.Host := 'upstream.example.com';
oProxy.Proxy.Port := 8080;
oProxy.Active := true;

Back to Properties