jussssss opened a new issue #2454:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2454


   1)应用启动,部署RestServerVerticle阶段,框架默认设置了WorkerPoolName、WorkerPoolSize。
   
![image](https://user-images.githubusercontent.com/62862072/124596207-95854f80-de94-11eb-888d-46ad4b404da7.png)
   
2)部署Verticle实例的逻辑中,会根据WorkerPoolName是否为空来决定是否创建WorkerExecutor。创建WorkerExecutor时,会从vertx对象获取ContextImpl,并把WorkerExecutor加入到ContextImpl的CloseHooks中。
   
3)部署Verticle实例的逻辑中,会再次从vertx对象获取ContextImpl,用来执行Verticle实例的init和start逻辑,将Verticle实例和ContextImpl(EventLoop线程)绑定。
   
![11](https://user-images.githubusercontent.com/62862072/124597806-7be50780-de96-11eb-9722-f532592caff5.png)
   4)以上逻辑都在main主线程执行,而在主线程中,每次从vertx对象获取ContextImpl,实际上是遍历一个EventLoopGroup成员。
   
![image](https://user-images.githubusercontent.com/62862072/124597960-b058c380-de96-11eb-8294-46438750524c.png)
   
   
也就是说,每部署一个RestServerVerticle实例,EventLoopGroup成员被遍历两个,RestServerVerticle实例与EventLoop实例的绑定关系大概是:RestServerVerticle-0绑定EventLoop-1、RestServerVerticle-2绑定EventLoop-3、RestServerVerticle-3绑定EventLoop-5……。
   
框架未开放EventLoopGroupSize配置,默认值是cpucore*2,一定是偶数,因此无论将RestServerVerticle实例数设置为多少,所有RestServerVerticle实例都只能绑定到一半的EventLoop线程,无法充分利用所有EventLoop线程,无法充分利用所有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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to