TRoThreadPool Parameters

Hello

We would like to understand the reason between the MaxQueue, PoolThreads and MaxThreads parameters of TRoThreadPool, with the connection through TROSynapseSuperTCPServer. We are facing problems with excessive delays, which even seem like the Server application has crashed, on our servers that use Remote SDK 9.

For testing, we configure the variables with the following values:
MaxQueue = 100
PoolThreads = 15
MaxThreads = 30

Is there a problem with these values?

Hi,

from https://docs.remotingsdk.com/API/Delphi/Classes/TROThreadPool/:

  • MaxQueue: Restricts the queue size (50 by default), which is checked by the QueueItem method.
  • MaxThreads: Restricts the maximum thread count (10 by default), which is checked by the QueueItem method.
  • PoolThreads: This property is used for heuristic balancing between the number of threads and the queue length (5 by default).

we use this logic:

procedure TROThreadPool.QueueItem(Callback: IROThreadPoolCallback);
...
    l_usage := fQueue.Count + fWorkingCount + 1;
    if l_usage >= fMaxQueue * fMaxThreads then raise EROException.Create(err_NotEnoughThreadsAvailableForRequest);
    if fThreadCount > fPoolThreads then l_usage := l_usage div 2; // we only need
    if (l_usage >= fThreadCount) and (fThreadCount < fMaxThreads) then begin
      fThreadCount := fThreadCount + 1;
      fThreads.Add(TROPooledThread.Create(Self));
    end;
...

according to your settings, you can have queue in 3000 items otherwise exception will be raised.

I can recommend to retest your server when MaxQueue has increased value and *Threads properties have default values.

1 Like