System.Win.ScktComp.TServerWinSocket.ThreadCacheSize
Delphi
property ThreadCacheSize: Integer read FThreadCacheSize write SetThreadCacheSize;
C++
__property int ThreadCacheSize = {read=FThreadCacheSize, write=SetThreadCacheSize, nodefault};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | System.Win.ScktComp.pas System.Win.ScktComp.hpp |
System.Win.ScktComp | TServerWinSocket |
Description
Indicates the number of TServerClientThread objects cached for reuse by new connections to client sockets.
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.