RTC Forums
November 23, 2024, 03:56:26 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
TRtcHttpServer threads
Pages: [
1
]
« previous
next »
Print
Author
Topic: TRtcHttpServer threads (Read 4066 times)
DPerkins
RTC License
Posts: 37
TRtcHttpServer threads
«
on:
July 18, 2017, 12:23:21 PM »
I have a TRtcHttpServer running and I give it a stress test with a few clients applications. I note that the thread count goes up to 64. If the client applications then close, what causes the server thread count to reduce? It still seems to be at 64 after 20 minutes.
Thanks
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcHttpServer threads
«
Reply #1 on:
July 18, 2017, 12:58:42 PM »
All parameters of the RTC Thread Pool (which is used by all RTC components that work with threads) can be configured using global variables declared in the "
rtcThrPool.pas
" unit. Here is the list of available parameters with their default values ...
// Max. number of unused threads to keep active
RTC_THREAD_POOL_OVERSIZE
:word=
256
;
// Max. number of "normal" Threads in our thread pool.
RTC_THREAD_POOL_MAX
:word=
128
;
// Absolute Thread Pool Limit, including high priority threads.
RTC_THREAD_POOL_LIMIT
:word=
256
;
// Maximum time (in seconds) allowed for all worker threads to close when shutting down
RTC_THREAD_POOL_CLOSEWAIT
:word=30;
// Maximum time (in seconds) allowed for the last worker thread to close when shutting down
RTC_THREAD_POOL_CLOSELAST
:word=5;
// "Sleep" time (in milliseconds) after every executed job
RTC_THREAD_SLEEP
:integer=0;
// Time limit (milliseconds) for running multiple events in the Main Thread
RTC_THREAD_SYNCLIMIT
:integer=250;
When configuring the RTC Thread pool, please keep in mind that
starting and stoping a Thread takes time and consumes CPU resources
, but there is
no real cost for leaving a previously used RTC Thread running
and waiting for the next "job".
Unless you have a REALLY GOOD reason to reduce the number of Threads used by the RTC Thread Pool while your Application is running, it is better to leave "idle" threads running and waiting for the next "job", than to close currently "unused" threads, because a currently unused (but previously used) Thread could become "needed" again - for example, when a new Client connects to your Server.
If your Server has to run on a System with limited resources, or if you want to run multiple instances of the Server on the same machine, I would recommend you to limit the maximum number of threads the RTC Thread Pool can use (reduce the
RTC_THREAD_POOL_LIMIT
value) and allow the RTC Thread Pool to grow up to that limit (make sure that RTC_THREAD_POOL_OVERSIZE is larger than RTC_THREAD_POOL_LIMIT) without closing any "idle" threads. Otherwise, you could end up with a Server that performs poorly at peek times, because it would be wasting time and CPU resources to constantly start and stop Threads.
Best Regards,
Danijel Tkalcec
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...