Sunday, 29 September 2013

Thread Pool Executor

Thread Pool Executor

I am working on changing legacy design with Thread Pool Executor. The
details are as follows:-
Legacy:- In case of legacy design 600 threads are created at the time of
application start up. and are placed in various pools, which are then
picked up when required and task is assigned to the corresponding thread.
New:- In new design i replaced the thread pool by executor service as
ThreadPoolExecutor thpool = new ThreadPoolExecutor(coreSize,poolsize,...);
What i am observing is that in case of Executor no threads are created at
the time of start up. They are created when request is fired from the
client. As a result of which threads created in memory are quite less as
compared to previous one.
But what my question is that is it right way because Thread creation is
also a overhead which is happening at the time of call is triggered.
Please tell which is more hevay process Thread creation at the time of
call from client or Idle threads being there in memory as per legacy
approach.
Also suggest which Executor pool to use in order to get best results in
terms of performance.
Thanks & Regards, Tushar

No comments:

Post a Comment