7

java | 粘包 & 半包分析

 1 year ago
source link: https://benpaodewoniu.github.io/2023/01/27/java210/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

粘包 & 半包分析

姑苏城外一茅屋,万树梅花月满天

从各个层面分析两种现象产生的原因。

  • 应用层: ByteBuf 设置太大,netty 默认 1024
  • 滑动窗口:滑动窗口设置过大
  • Nagle 算法
  • 应用层: ByteBuf 设置太小
  • 滑动窗口:滑动窗口滑动过程中,正好切分数据
  • 超过 MSS 限制
    • 链路层,对数据包的大小有限制
    • 环回地址的大小远大于网络层的大小

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK