Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>the more I increase the newFixedThreadPool the slower the execution</p> </blockquote> <p>In general, if you add threads to a job and it doesn't speed it up it could be because of one of a couple of reasons:</p> <ul> <li><p>Each of the jobs have to synchronize on some sort of resource so they are all fighting for lock contention and not running independently.</p></li> <li><p>The jobs do not have much CPU work to be done. Adding threads to an IO bound process will not make things go faster because the IO channel may already be maxed out.</p></li> </ul> <p>However, it is an interesting situation if you your application runs half as fast. I can only guess that it is a combination of the two of them.</p> <p>One thing to try is to start with 1 thread and then try 2. If it doesn't run faster then first take a look at what locks are shared between the jobs. What concurrent collections or other objects are being modified by each job? Try to reduce the number of locks or have the threads store temporary information and then lock once to update the central objects.</p> <p>You can also watch your system statistics to see if your IO channels are maxed out. Disk a common issue here. See if you can run on a memory disk to see if your application runs faster. That will be an indicator that you are IO bound.</p> <p>Lastly, I would look into why you are getting any <code>ExecutionException</code>s when you jobs get reaped. This may be an indicator of some other problem but you should understand this first. </p>
 

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