Netty_草稿图
2024-02-22 17:24:34   4  举报             
     
         
 Netty草稿图
    作者其他创作
 大纲/内容
 ChannelHandler
    EventLoop
  Chunk
  入站Handler
  Entry
  ChannelPipeline
  业务处理
  MemoryRegionCache
  channel
  Bootstrap
  ServerBootstrap
  网络编程中的作用
  连接到远程主机和端口
  绑定到一个本地端口
  EventLoopGroup的数目
  1
  2
  加密(出)
  2049
  压缩(出)Handler
  7
  .....
  Context
  16
  KryoEncoder/Decoder
  读空闲检测
  解压(入)Handler
  11
  6
  MemoryRegionCache-2<<13
  出站事件
  ChannelOutboundHandlerAdapter
  3.如果就是相同的线程,则你在EventLoop中,可以直接执行任务
  0
  HeartBeatHandler
  4095
  Page0
  ChannelInboundHandlerAdapter
  2048
  Thread
  Channel
  出站Handler
  <<interface>>ChannelHandler
  在EventLoop中?
  channel:eventLoop().execute(Task)
  512
  心跳请求
  16M
  8k
  Service Consumer(Client)
  在
  网络
  <<interface>>ChannelInboundHandler
  5
  ChannelB的ChannelPipeline
  3
  客户端
  PoolThreadCache
  MemoryRegionCache-2<<9
  具有3个EventLoop的EventLoopGroup
  memoryMap
  8K
  序列化
  q......
  10
  MemoryRegionCache-32
  queue长度为64
  授权(入)Handler
  入站事件
  MemoryRegionCache-2<<11
  4.发起调用
  ....
  Queue
  处理心跳应答
  read/write
  1024
  入队
  ..........
  半包解码
  Service Provider
  2.在把任务传递给execute方法之后,执行检查以确定当前调用线程是否就是分配给EventLoop的那个线程
  31
  qinit
  ...............
  MemoryRegionCache-496
  depthMap
  应用程序
  解密(入)Handler
  9
  ......
  Q25
  MemoryRegionCache-2<<10
  ChannelHandlerAdapter
  半包编码
  2051
  执行
  握手请求
  BusiHandler
  channel.wirte()channelPipeline.write()
  任务
  32
  1.将要在EventLoop执行的任务
  ServerChannel
  MemoryRegionCache-2<<12
  MemoryRegionCache-2<<14
  12
  接受新的连接
  不在
  Service Provider(Provider)
  ctx.write()
  具有4个EventLoop的EventLoopGroup
  MemoryregionCache
  tinySubPagePools<32B>
  服务端
  Q75
  写空闲检测
  心跳应答
  2050
  Socket
  认证审查
  注册中心1.自启动
  反序列化
  使用EventLoopGroup所提供的EventLoop
  PoolArena
  名称
  类型
  长度
  描述
  md5
  String
  变长
  消息体摘要,缺省MD5摘要
  msgID
  Long
  64
  消息的ID
  Type
  Byte
  8
  0:业务请求消息1:业务响应消息2:业务ONE_WAY消息3:握手请求消息4.握手应答消息5:心跳请求消息6:心跳应答消息
  Priority
  消息优先级:0~255
  Attachment
  可选字段,用于扩展消息头
  ...........
  q100
  Q50
  业务数据
  已接受的子Channel
  <<interface>>ChannelOutboundHandler
  Page2047
  MemoryRegionCache-2<<15
  1025
  创建Channel
  LoginAuthHandler
  4
  LengthFieldBasedFrameDecoder
  QINIT
  queue长度为256
  心跳
  ChannelA的ChannelPipeline
  认证申请
  q0
  Channel.write()channelPipeline.write()
  2048个Page区域由memoryMap和depthMap来维护
  Q0
  握手应答
  tinySubPagePools<16B>
  ReadTimeouhandler
  4.如果线程不是EventLoop的那个线程,则将任务放入队列以便EventLoop下一次处理它的事件时执行
  每个EventLoop将处理分配给它的所有Channel的所有事件和任务。每个EventLoop都和一个Thread相关联
  在整个声明周期内部都使用EnvetLoop处理I/O事件
  MemoryRegionCache-48
  MemoryRegionCache-16
  Q100
  header
  Header
  消息头定义
  body
  Object
  消息的内容
  将Channel注册到EventLoop
  性能监控
  queue长度为512
  PoolChunk
  所有的EventLoop都有这个EventLoopGroup分配,有3个正在使用的EventLoop
  2.注册
   
 
 
 
 
  0 条评论
 下一页
  
   
   
   
   
  
  
  
  
  
  
  
  
 