Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I actually just ended up diving into this issue not long ago, you wont be able to change the thread priority but there are ways around this.</p> <p>To give you a bit of background on the problem, in the cPython implementation CPU bound threads can cause other threads to starve because of the way the Global Interpreter Lock or GIL is released and acquired. Oddly enough this problem is made worse in a multicore environment. A really detailed analysis and presentation on this issue was done by <a href="http://www.dabeaz.com/" rel="nofollow">David Beazley</a> which you can find at <a href="http://www.dabeaz.com/python/GIL.pdf" rel="nofollow">http://www.dabeaz.com/python/GIL.pdf</a>. He has several blog posts that go into more detail. They're long but quite fascinating. </p> <p>The short version is that the CPU bound thread releases and reacquires the GIL before the other threads can be woken up to grab it. Resulting in the CPU bound thread holding the GIL for more than 90% of the time.</p> <p>There are some patterns you can use to work around this issue. For example you can run your CPU bound tasks in a completely different process. This will allow the operating system scheduler to manage resource sharing a lot better and should allow your web2py threads to continue to run since operating systems actually give preferential treatment to IO bound threads. The <a href="http://docs.python.org/library/multiprocessing.html" rel="nofollow">multiprocessing</a> library is provided for cases such as this. It will require some more code to get it working but that should help.</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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