multithreading - Java's ExecutorService performance -


i have main thread dispatches jobs thread pool. i'm using java's executor framework.

from profiler (virtualvm) can see each thread's activity: can see main thread waiting lot (because executor's queue has upper limit) means executor's queue full of time. executor's threads not busy have thought. of them have waiting time of 75%. in virtualvm says waits on monitor.

can explain why happenning? why executor threads wait while there still plenty of work available do? , how improve performance of executor? improve performance overall? more detail on executor's wait on monitor great.

the job runs in workers computation, don't depends on else , don't communicate other thread (no synchronisation), except in end, put data in database, using own connection.

parallel execution yield better results synchronous execution if:

  1. the work done independent each other (no or few , short critical sections)

  2. each single executed work takes enough time make thread start / executor's internal synchronization

  3. the work not use same resource - example reading multiple files same disk slower reading them sequentially.

  4. you have enough system resources (processor cores, memory, network speed) use @ once


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -