<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:3 0 5 9 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;}
span.moz-smiley-s1
        {mso-style-name:moz-smiley-s1;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">It all depends on the module you are running and whether it effectively uses the “-multi” option with “all_available_cores” and of course how many cores are available on your system.  Yes it will vary a lot depending on the nature of the
 processing and what stage it is in for that particular module.   Another consideration is the Processor model that is on your system and how many sockets you have active on it. Servers from the so called “Enterprise” class can support 2-4 processor sockets
 and those processor sockets can have up to 24 cores on them. A Dell R930 (a 4 socket Motherboard) can support are running with 96 cores per system with its current socket, the FC630s blades are capable of 40 cores per system.  The use of the “ALL_AVAILABLE_CORES”
 option will work on an as needed basis to add cores to the optimum for the workflow modules and the data characteristics being processed.  It gets down to understanding what is normal for your processor model, how much real memory you have, and the nature
 of the application and the data layout to avoid conflicts.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Qgis-user <qgis-user-bounces@lists.osgeo.org> <b>
On Behalf Of </b>David Strip via Qgis-user<br>
<b>Sent:</b> Saturday, July 30, 2022 10:44 PM<br>
<b>To:</b> Greg Troxel <gdt@lexort.com>; chris hermansen <clhermansen@gmail.com><br>
<b>Cc:</b> qgis-user <qgis-user@lists.osgeo.org><br>
<b>Subject:</b> Re: [Qgis-user] excessive threads?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 7/30/2022 6:36 PM, Greg Troxel via Qgis-user wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<pre>I do understand that threads could help parallelization, eitehr using<o:p></o:p></pre>
<pre>multiple cores, or just allowing IO in parallel.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>chris hermansen <a href="mailto:clhermansen@gmail.com"><clhermansen@gmail.com></a> writes:<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><span style="color:#007CFF">Does it seem like you have one thread per layer for reading plus one for<o:p></o:p></span></pre>
<pre><span style="color:#007CFF">rendering plus one for user  input?<o:p></o:p></span></pre>
</blockquote>
<pre>I don't know how many layers I have <span class="moz-smiley-s1">:-)</span>    I can experiment with some<o:p></o:p></pre>
<pre>smaller projects.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>When I noticed this, I had not tried to use qgis in at least a day.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
</div>
</blockquote>
<p class="MsoNormal">I did a little bit of quick experimentation using Qgis 3.26 (Buenos Aires) on Windows 10. The number of threads is all over the place. It does not seem to be tied to the number of layers in the map, at least in the sense of steady state
 (ie, let the app sit idle for a while). Adding layers bumps the thread count, with shapefiles adding more threads than files in a geopkg. Locally stored geotiffs are more like a geopkg vector file in terms of threads. But once things settle down I end up around
 20 threads. Interestingly, Help->About bumped the thread count by 8. Closing a project (not saving) and then opening a "new" project (no template) bumped another 8 threads for about 30 seconds, then settled back down.Launching Qgis peaked at 30 threads, then
 after about it minute settles down to 14. I suspect this is dependent on which plug-ins I'm running.
<br>
<br>
Note these numbers are non-deterministic - Help->About on a fresh start of Qgis with an empty project jumped from 13 threads to 33, then settled down to 22, which is different from the previous attempt where there were open layers in the map.<br>
<br>
I'll be interested to hear what drives the thread count to > 150 . None of my very limited test involved database connections or connections to remote data. Those might have something to do with it. Maybe layer filters? Complex rendering (eg, geometry generators)?<o:p></o:p></p>
</div>
</body>
</html>