Just tried wrapping an Executors.newCachedThreadPool with a thread factory that 
creates threads as per the original org.apache.river.thread.NewThreadAction.

Performance is much improved, the hotspot is gone.

There are regression tests with sun bug Id's, which cause oome.  I thought this 
might 
prevent the executor from running,  but to my surprise both tests pass.   These 
tests failed when I didn't pool threads and just let them be gc'd.  These tests 
created over 11000 threads with waiting tasks.  In practise I wouldn't expect 
that to happen as an IOException should be thrown.  However there are sun bug 
id's 6313626 and 6304782 for these regression tests, if anyone has a record of 
these bugs or any information they can share, it would be much appreciated.

It's worth noting that the jvm memory options should be tuned properly to avoid 
oome in any case.

Lesson here is, creating threads and gc'ing them is much faster than thread 
pooling if your thread pool is not well optimised.

It's worth noting that ObjectInputStream is now the hotspot for the test, the 
tested code's hotspots are DatagramSocket and SocketInputStream.

ClassLoading is thread confined, there's a lot of class loading going on, but 
because it is uncontended, it only consumes 0.2% cpu, about the same as our 
security architecture overhead (non encrypted).

Regards,

Peter.

Sent from my Samsung device.
  Include original message
---- Original message ----
From: Bryan Thompson <br...@systap.com>
Sent: 02/12/2015 11:25:03 pm
To: <dev@river.apache.org> <dev@river.apache.org>
Subject: Re: Trunk merge and thread pools

Ah. I did not realize that we were discussing a river specific ThreadPool 
vs a Java Concurrency classes ThreadPoolExecutor.  I assume that it would 
be difficult to just substitute in one of the standard executors? 

Bryan 

On Wed, Dec 2, 2015 at 8:18 AM, Peter <j...@zeus.net.au> wrote: 

> First it's worth considering we have a very suboptimal threadpool.  There 
> are qa and jtreg tests that limit our ability to do much with ThreadPool. 
> 
> There are only two instances of ThreadPool, shared by various jeri 
> endpoint implementations, and other components. 
> 
> The implementation is allowed to create numerous threads, only limited by 
> available memory and oome.  At least two tests cause it to create over 
> 11000 threads. 
> 
> Also, it previously used a LinkedList queue,  but now uses a 
> BlockingQueue,  however the queue still uses poll, not take. 
> 
> The limitation seems to be the concern by the original developers that 
> there may be interdependencies between tasks.  Most tasks are method 
> invocations from incoming and outgoing remote calls. 
> 
> It probably warrants further investigation to see if there's a suitable 
> replacement. 
> 
> Regards, 
> 
> Peter. 
> 
> Sent from my Samsung device. 
>   Include original message 
> ---- Original message ---- 
> From: Bryan Thompson <br...@systap.com> 
> Sent: 02/12/2015 09:46:13 am 
> To: <dev@river.apache.org> <dev@river.apache.org> 
> Subject: Re: Trunk merge and thread pools 
> 
> Peter, 
> 
> It might be worth taking this observation about the thread pool behavior to 
> the java concurrency list.  See what feedback you get.  I would certainly 
> be interested in what people there have to say about this. 
> 
> Bryan 
> ​ 
> 
> 


Reply via email to