System.Win.ScktComp.TServerSocket.ThreadCacheSize

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property ThreadCacheSize: Integer read GetThreadCacheSize write SetThreadCacheSize default 10;

C++

__property ThreadCacheSize = {default=10};

Properties

Type Visibility Source Unit Parent
property published
System.Win.ScktComp.pas
System.Win.ScktComp.hpp
System.Win.ScktComp TServerSocket

Description

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

System.Win.ScktComp.TServerSocket.ThreadCacheSize inherits from System.Win.ScktComp.TCustomServerSocket.ThreadCacheSize. All content below this line refers to System.Win.ScktComp.TCustomServerSocket.ThreadCacheSize.

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