System.Win.ScktComp.TCustomServerSocket.ThreadCacheSize

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property ThreadCacheSize: Integer read GetThreadCacheSize

C++

__property int ThreadCacheSize = {read=GetThreadCacheSize, write=SetThreadCacheSize, nodefault};

Properties

Type Visibility Source Unit Parent
property protected
System.Win.ScktComp.pas
System.Win.ScktComp.hpp
System.Win.ScktComp TCustomServerSocket

Description

Specifies the maximum number of threads that can be reused for new client connections.

When ServerType is stThreadBlocking, each new connection that is accepted by the server socket is given a separate execution thread. In order to improve performance, server sockets store these threads in a cache rather than freeing them when the connection is closed. New connections can then reuse threads from the cache, rather than requiring the socket server to create a new thread every time a connection is accepted.

Set ThreadCacheSize to specify the number of threads that are cached for reuse. The ideal value for ThreadCacheSize depends on the number and frequency of client socket requests received by the server socket. If ThreadCacheSize is too low, the server socket will spend more time freeing and creating threads when client connections are accepted. If ThreadCacheSize is too high, the server socket may unnecessarily lock up the memory for threads that are never reused.

See Also