You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/08/17 12:04:18 UTC

[GitHub] [servicecomb-java-chassis] jush-lyy opened a new issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

jush-lyy opened a new issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513


   当前servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count这两个配置项的默认值是min(8, Runtime.getRuntime().availableProcessors()),与Vertx EventLoop线程数默认值(2*cpucore)不一致,导致几个问题:
   1、CPU核数大于8时,不能充分利用CPU多核和EventLoop多线程;
   2、server verticle、client verticle的负载不会完全相同,即使在16核主机上一半CPU核运行server逻辑、一半CPU核运行client逻辑,CPU核的压力也会不平均;
   2、显式配置这两个参数时,因线上运行环境的CPU核数无法预估,并且有可能同时在不同CPU核数的主机上运行,无法用一份配置满足所有运行环境。
   3、不同种类Verticle之间可能互相影响Verticle与EventLoop线程绑定关系,比如在8核机器上有16个EventLoop线程,ClientVerticle HTTP1绑定EventLoop[0,7],ClientVerticle HTTP2绑定EventLoop[8,15],RestServerVerticle绑定EventLoop[0,7],如果应用只用到了HTTP1和RestServer,那就只有一半EventLoop线程在工作。
   
   综上,建议servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count这两个配置项的默认值参考Vertx EventLoop线程数默认值,也取值2*cpucore。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 edited a comment on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
liubao68 edited a comment on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900794613


   这个数据偏差不是很大。 性能考虑的场景比较多, 比如要考虑业务本身的时延。 在实际场景下, 过多的vertical-count对于提升性能帮助不是很大,因为繁忙的不是event-loop,而是业务线程。 
   
   这个参数默认值为8而不是核数的两倍,是考虑到核数很小的情况下, 两倍并不是一个合理的参数。 对于更大的核数的场景, 提升event-loop效率对于系统性能提升意义不大。 
   
   另外,最新版本也提供了对于event-loop线程个数的设置选项。可以不完全是核数*2。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900255073


   这个建议是基于实际更多核CPU的实际测试数据,还是根据理论推测?有具体的性能弱化数据吗?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-901550220


   reactive模式可以考虑将这个值设置的偏大一点,从而减少不同环境的特殊配置。 
   总体上看,这个值的设置并不是一个很麻烦的事情。 通过增加不同参数的绑定关系、并且继续保留实际值设置, 会使得配置理解变得复杂。 个人觉得并不是一个很好的主意。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900794613


   这个数据偏差不是很大。 性能考虑的场景比较多, 比如要考虑业务本身的时延。 在实际场景下, 过多的vertical-count对于提升性能帮助不是很大,因为繁忙的不是event-loop,而是业务线程。 
   
   这个参数默认值为8而不是核数的两倍,是考虑到核数很小的情况下, 两倍并不是一个合理的参数。 对于更大的核数的场景, 提升event-loop效率对于系统性能提升意义不大。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 edited a comment on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
liubao68 edited a comment on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900794613


   这个数据偏差不是很大。 性能考虑的场景比较多, 比如要考虑业务本身的时延。 在实际场景下, 过多的vertical-count对于提升性能帮助不是很大,因为繁忙的不是event-loop,而是业务线程。 
   
   这个参数默认值为8而不是核数的两倍,是考虑到核数很小的情况下, 两倍并不是一个合理的参数。 对于更大的核数的场景, 提升event-loop效率对于系统性能提升意义不大。 
   
   另外,最新版本也提供了对于event-loop线程个数的设置选项。可以不完全是核数*2。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] jush-lyy commented on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
jush-lyy commented on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900754976


   部分是实际测试数据,部分是推测。我目前只有一个8核主机,因此分别将这两个配置设置为4、8、16来模拟测试(我们生产环境是16核主机,相当于在16核主机上使用默认值8、设置为16、32)。
   
   在8核主机上vertx创建了16个eventloop线程。
   配置项为4时:
   ![1](https://user-images.githubusercontent.com/62862072/129824053-78c7ebc7-8552-4315-a023-ffe0978903c3.png)
   配置项为8时:
   ![2](https://user-images.githubusercontent.com/62862072/129824066-17cc1302-43a2-4b53-a6c9-8c6fe0c18f32.png)
   配置项为16时:
   ![3](https://user-images.githubusercontent.com/62862072/129824116-7489d139-909d-4888-8d86-09573e30c1e1.png)
   
   可以看到两个配置项设置为4时,cpu核没有充分利用,只有4个eventloop线程在繁忙,实际上就是4个RestServerVerticle在工作,ClientVerticle的作用只是在启动时绑定Http连接池和eventloop线程,业务流程中所有工作都在RestServerVerticle里。
   
   设置为4、8、16时,应用最高tps是750、910、910,因此推测16核主机上使用默认值8不能发挥最大性能。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] jush-lyy commented on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
jush-lyy commented on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900754976






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] jush-lyy commented on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
jush-lyy commented on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900808628


   对同步阻塞式开发模式来说,确实如你所说,性能瓶颈主要在业务线程。
   
   我这里测试的是Reactive场景,eventloop的利用率直接决定了系统性能。
   
   这里主要是期望verticle数量应该是和eventloop数量成比例的,在Reactive场景下会有自适应核数达到最佳性能的效果,如果2*cpucore或1*cpucore作为默认值不够灵活,是否可以考虑开放verticle数量/eventloop数量比例的参数。
   
   至于默认值8这个立即数,用显式配置也能达到同样效果,如果配置上能实现随核数成比例变化的效果,对Reactive模式应该是一种增强。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2513: servicecomb.rest.server.verticle-count、servicecomb.rest.client.verticle-count默认值是否合理

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2513:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2513#issuecomment-900794613


   这个数据偏差不是很大。 性能考虑的场景比较多, 比如要考虑业务本身的时延。 在实际场景下, 过多的vertical-count对于提升性能帮助不是很大,因为繁忙的不是event-loop,而是业务线程。 
   
   这个参数默认值为8而不是核数的两倍,是考虑到核数很小的情况下, 两倍并不是一个合理的参数。 对于更大的核数的场景, 提升event-loop效率对于系统性能提升意义不大。 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org