[infinispan-dev] The reason(s) why we have so many threads are spawned in the testsuite
Galder Zamarreno
galder.zamarreno at redhat.com
Fri Oct 9 11:07:10 EDT 2009
On 10/09/2009 12:57 PM, Manik Surtani wrote:
>
> On 6 Oct 2009, at 15:59, Galder Zamarreno wrote:
>
>>
>> The lazyness I was refering about earlier comes into play here in the
>> sense that, why not start the TPE the 1st time we register an async
>> Listener? If we did so, we'd be saving resources if no async listeners
>> are enabled (This looks to me the most common case right now). I can
>> see
>> the point of having this ready for normal use but certainly for
>> testsuite use, this is waste when we're creating so many
>> CacheManagers,
>> Caches instances and have several threads running different tests at
>> the
>> same time.
>
>
> Regarding laziness, I don't think this is an issue. Let's take the
> case of the DefaultExecutorFactory (and
> DefaultScheduledExecutorFactory). We create the executors using the
> JDK ExecutorService, passing in a ThreadFactory impl. So while we may
> create the executor upfront, this is relatively lightweight (except
> perhaps for the task queue, but again we use LinkedBlockingQueues
> which are cheap to construct). The threads themselves to populate the
> threadpool used by the executor is populated lazily (see
> j.u.c.ThreadPoolExecutor#execute(), Sun JDK 6).
Hmmm, true. Very good point. I had assumed that cos we're passing a core
pool size on ctror, it would be create that number of threads during
construction but that is not the case. It's only when setCorePoolSize()
is called that some worker threads might be created.
I'll keep an eye for more "OOM: unable to create thread" messages when
running the testsuite.
>
> Cheers
> --
> Manik Surtani
> manik at jboss.org
> Lead, Infinispan
> Lead, JBoss Cache
> http://www.infinispan.org
> http://www.jbosscache.org
>
>
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
--
Galder ZamarreƱo
Sr. Software Engineer
Infinispan, JBoss Cache
More information about the infinispan-dev
mailing list