Micronaut/Netty是否为客户端调用创建单独的线程?

发布于 2025-02-06 06:39:30 字数 694 浏览 1 评论 0原文

当您与HTTP客户端的互动涉及CPU密集型工作时,我无法理解它们为时,可能值得为一个或所有客户端配置单独的EventloopGroup。

单独的线程将是用于调用HTTP客户端?

假设有两个服务service-aservice-b,请求到servicea获取某些数据,以获取数据服务 - A将通过某些HTTP客户端致电Service-B。那么,将如何为上述情况创建/选择线程呢?

当请求访问service-a时,将把新线程(例如nio-eventloopgroup-1)分配给Event-loop的请求,而Service-a则尝试致电Service-B,然后再次将另一个新线程(Nio-Eventloopgroup-2)分配给该HTTPCLCLIENT任务。

上述方案的两个问题:

  1. 如果新线程(nio-eventloopgroup-2)将分配给httpclient调用,那么第一个线程会发生什么(nio-eventloopgroup-1 )?
  2. 如果相同的线程(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 :

  1. If new thread (nio-EventLoopGroup-2) will assigned to HttpClient call then what will happend to the first thread (nio-EventLoopGroup-1) ?
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文