gpt4 book ai didi

java - 网络 4 : Channel-EventLoop mapping in the NioEventLoopGroup

转载 作者:行者123 更新时间:2023-11-29 05:26:21 24 4
gpt4 key购买 nike

我们有一个分布式应用程序,它使用 Netty (4) 进行低级通信。该系统中的一个进程执行多个任务。每个任务都包含一组输入和输出 channel 。在 Netty 中, channel 永久分配给单个 EventLoop。 Channel 到 EventLoop 的映射在 (Nio)EventLoopGroup 中以循环方式发生。我们希望对此映射有更多控制,并将同一任务的所有 channel 分配给相同的 EventLoop。这种“Channel-EventLoop affinity”的目的是减少 ChannelHandlers 中某些特定内存管理内容的锁争用。我们查看了 Netty 文档,但没有找到任何东西。在 Netty 4 中有通用的方法吗?

我确定的另一种可能性是覆盖实现循环 channel 映射的“MultithreadEventExecutorGroup”中的“EventExecutor next()”方法(至少我是这么认为的)。这是强制执行不同映射的一种可能方式,还是我会用这种 hack 产生不良副作用?

我很感激任何帮助!!托比

最佳答案

目前不可能以“干净”的方式执行此操作。我们想在 netty 5 中改变它。另见 https://github.com/netty/netty/issues/1230

关于java - 网络 4 : Channel-EventLoop mapping in the NioEventLoopGroup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22559272/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com