On Performance.MaxBackgroundThreads vs Performance.MaxThreads SOLVED
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Hi Support,
Re (indirectly related): https://forum.pdf-xchange.com/viewtopic.php?f=66&t=33528&p=141379&hilit=MaxBackgroundThreads#p141379
I'm using AsyncDo to process my custom IOperations. Say I have 50 IOperations. Setting "Performance.MaxBackgroundThreads" = 2 -> I would expect all 50 IOperations are executed within same two threads.
However, that is not the case. The number of threads is 4 (so all 50 operations are done by 4 threads). This number "4" is not related to the number of physical cores my machine has. I have the same result on a 4(/8) cores machine and on a 10(/20) cores machine.
Only when I raise MaxBackgroundThreads to a value greater than 4 - the number of reported threads will be as set.
The number of threads actually used seems to be related to "Performance.MaxThreads" - which by default is 0.
When Performance.MaxThreads is 0 (default), setting Performance.MaxBackgroundThreads to any value from 1-4 would always result in 4 threads being used. Raising that value raises the actual number of threads used.
When I set Performance.MaxThreads = 1 or 2, then the number of threads (by AsyncDo) is always 2, nevermind what I set for Performance.MaxBackgroundThreads.
When I set Performance.MaxThreads = 3 or 4, then the number of threads (by AsyncDo) is always 3 or 4, nevermind what I set for Performance.MaxBackgroundThreads.
When I set Performance.MaxThreads = 8, then the number of threads (by AsyncDo) is always at least 4, nevermind what I set for Performance.MaxBackgroundThreads.
[Q]: please clearly explain how Performance.MaxThreads and Performance.MaxBackgroundThreads are related, and how can I be in full control of the number of threads used by AsyncDo?
-žarko
Re (indirectly related): https://forum.pdf-xchange.com/viewtopic.php?f=66&t=33528&p=141379&hilit=MaxBackgroundThreads#p141379
I'm using AsyncDo to process my custom IOperations. Say I have 50 IOperations. Setting "Performance.MaxBackgroundThreads" = 2 -> I would expect all 50 IOperations are executed within same two threads.
However, that is not the case. The number of threads is 4 (so all 50 operations are done by 4 threads). This number "4" is not related to the number of physical cores my machine has. I have the same result on a 4(/8) cores machine and on a 10(/20) cores machine.
Only when I raise MaxBackgroundThreads to a value greater than 4 - the number of reported threads will be as set.
The number of threads actually used seems to be related to "Performance.MaxThreads" - which by default is 0.
When Performance.MaxThreads is 0 (default), setting Performance.MaxBackgroundThreads to any value from 1-4 would always result in 4 threads being used. Raising that value raises the actual number of threads used.
When I set Performance.MaxThreads = 1 or 2, then the number of threads (by AsyncDo) is always 2, nevermind what I set for Performance.MaxBackgroundThreads.
When I set Performance.MaxThreads = 3 or 4, then the number of threads (by AsyncDo) is always 3 or 4, nevermind what I set for Performance.MaxBackgroundThreads.
When I set Performance.MaxThreads = 8, then the number of threads (by AsyncDo) is always at least 4, nevermind what I set for Performance.MaxBackgroundThreads.
[Q]: please clearly explain how Performance.MaxThreads and Performance.MaxBackgroundThreads are related, and how can I be in full control of the number of threads used by AsyncDo?
-žarko
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Hello zarkogajic,
We'll need Vasyl to reply to this one because there is complex behavior coded into this logic. Sadly he does not have enough time for this as we are preparing for the V9 that should be out till the end of the month if everything goes well. Please bump this topic when the V9 is out.
Meanwhile, use the results from your investigation as given - I've seen the code - it's made that way. Why - we'll see later.
Cheers,
Alex
We'll need Vasyl to reply to this one because there is complex behavior coded into this logic. Sadly he does not have enough time for this as we are preparing for the V9 that should be out till the end of the month if everything goes well. Please bump this topic when the V9 is out.
Meanwhile, use the results from your investigation as given - I've seen the code - it's made that way. Why - we'll see later.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Hi,
Since v9 is out (and I do know you have a lot of tasks on your hands ) - pinging in here...
-ž
Since v9 is out (and I do know you have a lot of tasks on your hands ) - pinging in here...
-ž
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Hi Zarko.
The reason of that is simple: the AsyncDo() uses its own narrowed 'room' in our multithreading system. And at the moment this room is limited to 4 max simultaneously working threads.
Cheers.
The reason of that is simple: the AsyncDo() uses its own narrowed 'room' in our multithreading system. And at the moment this room is limited to 4 max simultaneously working threads.
Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Hi Vasly,
But, "when I set MaxBackgroundThreads to a value greater than 4 - the number of reported threads will be as set (so more than 4).".
-žarko
Thanks.at the moment this room is limited to 4 max simultaneously working threads.
But, "when I set MaxBackgroundThreads to a value greater than 4 - the number of reported threads will be as set (so more than 4).".
-žarko
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Sorry, missed that you change the MaxBackgroundThreads. Yes, this parameter is for SDK and actually is calculated as:
And Performance.MaxThreads=0 == "The number of logical processors"
Code: Select all
maxBackgroundThreads = min( Performance.MaxThreads,
max(Performance.MaxBackgroundThreads, 4)
);
And Performance.MaxThreads=0 == "The number of logical processors"
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Hi Vasyl,
Is there a way I could force, for example, only 1 thread to be used by AsyncDo (via Performance.MaxThreads / Performance.MaxBackgroundThreads) ?
p.s.
When I set Performance.MaxThreads = 1 or 2, then the number of threads (by AsyncDo) is always 2, nevermind what I set for Performance.MaxBackgroundThreads.
-žarko
Is there a way I could force, for example, only 1 thread to be used by AsyncDo (via Performance.MaxThreads / Performance.MaxBackgroundThreads) ?
p.s.
When I set Performance.MaxThreads = 1 or 2, then the number of threads (by AsyncDo) is always 2, nevermind what I set for Performance.MaxBackgroundThreads.
-žarko
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads
Sorry, no way to do it at the moment.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: On Performance.MaxBackgroundThreads vs Performance.MaxThreads SOLVED
Hi Vasyl,
Ok, thanks.
-ž
Ok, thanks.
-ž
- Tracker Supp-Stefan
- Site Admin
- Posts: 17910
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact: