Micronaut/Netty是否为客户端调用创建单独的线程?
当您与HTTP客户端的互动涉及CPU密集型工作时,我无法理解它们为时,可能值得为一个或所有客户端配置单独的EventloopGroup。
单独的线程将是用于调用HTTP客户端?
假设有两个服务service-a
和service-b
,请求到servicea
获取某些数据,以获取数据服务 - A将通过某些HTTP客户端致电Service-B。那么,将如何为上述情况创建/选择线程呢?
当请求访问service-a
时,将把新线程(例如nio-eventloopgroup-1
)分配给Event-loop的请求,而Service-a则尝试致电Service-B,然后再次将另一个新线程(Nio-Eventloopgroup-2
)分配给该HTTPCLCLIENT任务。
上述方案的两个问题:
- 如果新线程(
nio-eventloopgroup-2
)将分配给httpclient调用,那么第一个线程会发生什么(nio-eventloopgroup-1
)? - 如果相同的线程(
nio-eventloopgroup-1
)将致电客户端,那么为客户端呼叫创建单独的事件循环的含义是什么?
I am unable to understand the micronaut documentation when they as if your interactions with an HTTP client involve CPU-intensive work, it may be worthwhile configuring a separate EventLoopGroup for one or all clients.
Would separate thread would be used for calling the HTTP Client ?
Let's say there are two services service-A
andservice-B
and a request come to serviceA
to fetch some data , to fetch data service-A will call to service-B via some HTTP Client. So how the threads will be created/picked for the above scenario ?
When request comes to service-A
, a new thread(let's say nio-EventLoopGroup-1
) will be assigned to request from event-loop and when service-A tries to call service-B, then again another new thread (nio-EventLoopGroup-2
) will be assigned to that HttpClient task.
Two question on the above scenario :
- If new thread (
nio-EventLoopGroup-2
) will assigned to HttpClient call then what will happend to the first thread (nio-EventLoopGroup-1
) ? - If same thread (
nio-EventLoopGroup-1
) will be calling to the client then what is the meaning of creating separate event-loop for client call ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论