You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by wjm wjm <zz...@gmail.com> on 2019/01/24 02:35:01 UTC

[discuss] change default settings of sync invocation executor

currently we provide a default sync invocation executor:

   - default integrate two fixed thread pool
   - thread count for one pool is equals cpu count

for most customers, thread count of one pool is too small, and fixed thread
pool is not so good, so will change to:

   - default integrate two ThreadPoolExecutor
   - support to configure core/max thread count, keepAlive time and max
   queue size for one pool
   - default core thread: 25, same to tomcat
   - default max thread: 100, tomcat is 200, because we have 2 pool, so
   change to 100
   - default keepAlive: 1 minute, same to tomcat
   - default max queue size: Integer.MAX_VALUE, same to tomcat

Re: [discuss] change default settings of sync invocation executor

Posted by wjm wjm <zz...@gmail.com>.
https://github.com/apache/servicecomb-java-chassis/pull/1077

wjm wjm <zz...@gmail.com> 于2019年1月25日周五 上午9:05写道:

> @yaohaishi@huawei.com <ya...@huawei.com>
>   think about a business, normally 30 threads are enough, but when
> business is busy, maybe need 300 threads
>   if use fixed thread pool, then after process boot, Whether the business
> is busy or not, must create 300 threads
>   but if use thread pool with core/max/keepAlive configuration, thread
> pool will create thread when business is busy, and destroy thread when
> business is not so busy.
>
> @willem.jiang <wi...@gmail.com>
>   yes, the thread pool is for sync business logic, it's for worker thread
>   but we change from old CPU count thread to tomcat default setting.
>
> Willem Jiang <wi...@gmail.com> 于2019年1月24日周四 下午10:58写道:
>
>> If the thread pool with the cpu core is for the netty boss thread, I
>> think it should be fine.
>> But if the thread pool is for the worker thread, it could be a problem
>> if there are lots of requests need to be processed.
>>
>> Willem Jiang
>>
>> Twitter: willemjiang
>> Weibo: 姜宁willem
>>
>> On Thu, Jan 24, 2019 at 2:48 PM yhs0092 <yh...@163.com> wrote:
>> >
>> > I agree that current default value of thread pool size is too small,
>> but I'm not sure about the disadvantages of the current fixed thread pool.
>> > Do you mean if multiple service instances is deployed on the same
>> machine, a fixed thread pool is not so flexible since the instances cannot
>> clean up some idle business thread?
>> >
>> >
>> > Yours sincerely
>> >
>> >
>> > Yao Haishi
>> > yhs0092@163.com
>> >
>> >
>> > On 1/24/2019 10:49,wjm wjm<zz...@gmail.com> wrote:
>> > or default integrate only one ThreadPoolExecutor?
>> > because most customers TPS is not so high, no need to do this optimize
>> >
>> > wjm wjm <zz...@gmail.com> 于2019年1月24日周四 上午10:35写道:
>> >
>> > currently we provide a default sync invocation executor:
>> >
>> > - default integrate two fixed thread pool
>> > - thread count for one pool is equals cpu count
>> >
>> > for most customers, thread count of one pool is too small, and fixed
>> > thread pool is not so good, so will change to:
>> >
>> > - default integrate two ThreadPoolExecutor
>> > - support to configure core/max thread count, keepAlive time and max
>> > queue size for one pool
>> > - default core thread: 25, same to tomcat
>> > - default max thread: 100, tomcat is 200, because we have 2 pool, so
>> > change to 100
>> > - default keepAlive: 1 minute, same to tomcat
>> > - default max queue size: Integer.MAX_VALUE, same to tomcat
>> >
>> >
>>
>

Re: [discuss] change default settings of sync invocation executor

Posted by wjm wjm <zz...@gmail.com>.
@yaohaishi@huawei.com <ya...@huawei.com>
  think about a business, normally 30 threads are enough, but when business
is busy, maybe need 300 threads
  if use fixed thread pool, then after process boot, Whether the business
is busy or not, must create 300 threads
  but if use thread pool with core/max/keepAlive configuration, thread pool
will create thread when business is busy, and destroy thread when business
is not so busy.

@willem.jiang <wi...@gmail.com>
  yes, the thread pool is for sync business logic, it's for worker thread
  but we change from old CPU count thread to tomcat default setting.

Willem Jiang <wi...@gmail.com> 于2019年1月24日周四 下午10:58写道:

> If the thread pool with the cpu core is for the netty boss thread, I
> think it should be fine.
> But if the thread pool is for the worker thread, it could be a problem
> if there are lots of requests need to be processed.
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Thu, Jan 24, 2019 at 2:48 PM yhs0092 <yh...@163.com> wrote:
> >
> > I agree that current default value of thread pool size is too small, but
> I'm not sure about the disadvantages of the current fixed thread pool.
> > Do you mean if multiple service instances is deployed on the same
> machine, a fixed thread pool is not so flexible since the instances cannot
> clean up some idle business thread?
> >
> >
> > Yours sincerely
> >
> >
> > Yao Haishi
> > yhs0092@163.com
> >
> >
> > On 1/24/2019 10:49,wjm wjm<zz...@gmail.com> wrote:
> > or default integrate only one ThreadPoolExecutor?
> > because most customers TPS is not so high, no need to do this optimize
> >
> > wjm wjm <zz...@gmail.com> 于2019年1月24日周四 上午10:35写道:
> >
> > currently we provide a default sync invocation executor:
> >
> > - default integrate two fixed thread pool
> > - thread count for one pool is equals cpu count
> >
> > for most customers, thread count of one pool is too small, and fixed
> > thread pool is not so good, so will change to:
> >
> > - default integrate two ThreadPoolExecutor
> > - support to configure core/max thread count, keepAlive time and max
> > queue size for one pool
> > - default core thread: 25, same to tomcat
> > - default max thread: 100, tomcat is 200, because we have 2 pool, so
> > change to 100
> > - default keepAlive: 1 minute, same to tomcat
> > - default max queue size: Integer.MAX_VALUE, same to tomcat
> >
> >
>

Re: [discuss] change default settings of sync invocation executor

Posted by Willem Jiang <wi...@gmail.com>.
If the thread pool with the cpu core is for the netty boss thread, I
think it should be fine.
But if the thread pool is for the worker thread, it could be a problem
if there are lots of requests need to be processed.

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Jan 24, 2019 at 2:48 PM yhs0092 <yh...@163.com> wrote:
>
> I agree that current default value of thread pool size is too small, but I'm not sure about the disadvantages of the current fixed thread pool.
> Do you mean if multiple service instances is deployed on the same machine, a fixed thread pool is not so flexible since the instances cannot clean up some idle business thread?
>
>
> Yours sincerely
>
>
> Yao Haishi
> yhs0092@163.com
>
>
> On 1/24/2019 10:49,wjm wjm<zz...@gmail.com> wrote:
> or default integrate only one ThreadPoolExecutor?
> because most customers TPS is not so high, no need to do this optimize
>
> wjm wjm <zz...@gmail.com> 于2019年1月24日周四 上午10:35写道:
>
> currently we provide a default sync invocation executor:
>
> - default integrate two fixed thread pool
> - thread count for one pool is equals cpu count
>
> for most customers, thread count of one pool is too small, and fixed
> thread pool is not so good, so will change to:
>
> - default integrate two ThreadPoolExecutor
> - support to configure core/max thread count, keepAlive time and max
> queue size for one pool
> - default core thread: 25, same to tomcat
> - default max thread: 100, tomcat is 200, because we have 2 pool, so
> change to 100
> - default keepAlive: 1 minute, same to tomcat
> - default max queue size: Integer.MAX_VALUE, same to tomcat
>
>

Re: [discuss] change default settings of sync invocation executor

Posted by yhs0092 <yh...@163.com>.
I agree that current default value of thread pool size is too small, but I'm not sure about the disadvantages of the current fixed thread pool.
Do you mean if multiple service instances is deployed on the same machine, a fixed thread pool is not so flexible since the instances cannot clean up some idle business thread?


Yours sincerely


Yao Haishi
yhs0092@163.com


On 1/24/2019 10:49,wjm wjm<zz...@gmail.com> wrote:
or default integrate only one ThreadPoolExecutor?
because most customers TPS is not so high, no need to do this optimize

wjm wjm <zz...@gmail.com> 于2019年1月24日周四 上午10:35写道:

currently we provide a default sync invocation executor:

- default integrate two fixed thread pool
- thread count for one pool is equals cpu count

for most customers, thread count of one pool is too small, and fixed
thread pool is not so good, so will change to:

- default integrate two ThreadPoolExecutor
- support to configure core/max thread count, keepAlive time and max
queue size for one pool
- default core thread: 25, same to tomcat
- default max thread: 100, tomcat is 200, because we have 2 pool, so
change to 100
- default keepAlive: 1 minute, same to tomcat
- default max queue size: Integer.MAX_VALUE, same to tomcat



Re: [discuss] change default settings of sync invocation executor

Posted by wjm wjm <zz...@gmail.com>.
or default integrate only one ThreadPoolExecutor?
because most customers TPS is not so high, no need to do this optimize

wjm wjm <zz...@gmail.com> 于2019年1月24日周四 上午10:35写道:

> currently we provide a default sync invocation executor:
>
>    - default integrate two fixed thread pool
>    - thread count for one pool is equals cpu count
>
> for most customers, thread count of one pool is too small, and fixed
> thread pool is not so good, so will change to:
>
>    - default integrate two ThreadPoolExecutor
>    - support to configure core/max thread count, keepAlive time and max
>    queue size for one pool
>    - default core thread: 25, same to tomcat
>    - default max thread: 100, tomcat is 200, because we have 2 pool, so
>    change to 100
>    - default keepAlive: 1 minute, same to tomcat
>    - default max queue size: Integer.MAX_VALUE, same to tomcat
>
>