Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do I have a lock here?
    primarykey
    data
    text
    <p>See the following concurrent performance analysis representing the work done by a parallel foreach:</p> <p><img src="https://i.stack.imgur.com/sEMEi.png" alt="enter image description here"></p> <p>Inside the loop each thread reads data from the DB and process it. There are no locks between threads as each one process different data. </p> <p>Looks like there are periodic locks in all the thread of the foreach due to unknown reasons (see the black vertical rectangles). If you see the selected locked segment (the dark red one) you will see that the stack shows the thread locked at StockModel.Quotation constructor. The code there just constructs two empty lists!</p> <p>I've read somewhere that this could be caused by the GC so I've changed the garbage collection to run in server mode with:</p> <pre><code>&lt;runtime&gt; &lt;gcServer enabled="true"/&gt; &lt;/runtime&gt; </code></pre> <p>I got a small improvement (about 10% - 15% faster) but I still have the vertical locks everywhere. </p> <p>I've also added to all the DB queries the WITH(NOLOCK) as I'm only reading data without any difference.</p> <p>Any hint on what's happening here?</p> <p>The computer where the analysis has been done has 8 cores.</p> <p><strong>EDIT:</strong> After enabling Microsoft Symbol servers turns out that all threads are blocked on calls like wait_gor_gc_done or WaitUntilGCComplete. I thought that enabling GCServer I had one GC for each thread so I would avoid the "vertical" lock but seems that it's not the case. Am I wrong?</p> <p>Second question: as the machine is not under memory pressure (5 of 8 gigs are used) is there a way to delay the GC execution or to pause it until the parallel foreach ends (or to configure it to fire less often)?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload