netty冲突 play sbt_Netty4比Netty3慢的原因

Couple years ago, I join to a project to implement a

extremely fast RPC framework on the top of the most popular network

libraries on jvm. It achieved up to 173 Kqps by grizzly, netty3's

is about 170 Kqps. After some investigation, we found the reason

that grizzly has its own memory allocation algorithm at that time.

One year ago, I tried netty4 for expecting a even better

performance since it's already add jemalloc like memory allocation.

But unfortunately, the result was much worse than netty3.I believed

the most important problem there is netty4 strictly limit user how

to use thread.

Because it's a generic rpc framework, we couldn't

know the concrete rpc method is blocking or not, so we assume that

blocking is normality. We used 3 thread pool in netty3, boss pool,

io pool to do marshalling/unmarshallings, and business pool for

application-layer processing. It gained a good performance.

However, in netty4, EventLoopGroup is inherit from ExecutorService.

Which means thread scheduling is handled by netty's builtin

EventLoopGroup. The NioEventLoopGroup service runnable tasks in a

round-robin fashion, if one of the tasks take a long time, it will

block all queued on that ordinal. We can't benefit from some

advanced thread scheduling pools like ForkJoinPool. I think this is

major reason why netty4 is slower in my case.

正文(必填)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值