Zuul 2系列[1]之启动过程
2019-08-08 18:20:42 1 举报
zuul 2 源码分析
作者其他创作
大纲/内容
A6
ZuulFilterChainHandler
nextStage;
PassportItem
stop();
HttpBodySizeRecordingChannelHandler
Passport
HashSet<PassportState> statesAdded;
putFilter(File file);
A5
PassportState
ClientResponseWriter
A2: 创建boss&work
SampleServerStartup
incrementStateCounter(PassportState state);
SessionContext context;
endpoint
ServerChannelMetrics
IdleStateHandler
time;
getFilterChainRunner();
CountingCurrentPassport
LinkedList<PassportItem> history;
右边这部分本图尚未涉及
ZUUL
什么是 Passport1. CurrentPassport以ch.attr(CHANNEL_ATTR).set(passport)的方式绑定在 每个channel 上.2. 每个 channel只有一个 passport.3. 每次状态变化都会盖戳.4. CountingCurrentPassport 对一些状态做了全局计数.5. 有点像Dapper(Google的生产环境下的分布式系统跟踪平台)里的 traceID.
ServerGroup
ServerStatusHeaderHandler
ElbProxyProtocolChannelHandler
HttpRequestInfo
pipeline
A4
HttpServerCodec
add(PassportState state);
requestFilters
A7
HttpRequestMessageImpl
SourceAddressChannelHandler
rateLimitingChannelHandler
A8: create
PassportStateServerHandler
ZuulFilter newInstance(Class clazz);
CurrentPassport
A3: init
HttpRequestMessage
PassportStateHttpServerHandler
ZuulMessage
TCP
setupServerBootstrap();1. 标准的 netty server 的启动过程2. bossgroup/workgroup从ServerGroup里取.
ZuulServerChannelInitializer
ServerGroup serverGroup;
BaseZuulChannelInitializer
Http1ConnectionExpiryHandler
TIMEOUT
ChannelGroup channels;
EventLoopGroup clientToProxyWorkerPool
initChannel(Channel ch);
HTTP
HttpMetricsChannelHandler
choosePortsAndChannels();
load
EurekaClient discoveryClient;
A1: 创建 server
addZuulHandlers()
perEventLoopRequestsMetricsHandler
responseFilters
perEventLoopMetricsHandler
requestFilterChain;
ClientRequestReceiver
responseFilterChain;
HttpServerLifecycleChannelHandler
getFiltersByType();
BaseServerStartup
LoggingHandler
init();
requestFilterChain
start();启动所有给定端口服务
ChannelInitializer extends ChannelInboundHandlerAdapter
EventLoopGroup clientToProxyBossPool
ZuulMessageImpl
Server
passportLoggingHandler
ZuulFilter getFilter();
FilterLoader
SessionContext
addZuulFilterChainHandler( pipeline)
EventLoopConfig eventLoopConfig;
Server server;
Http1ConnectionCloseHandler
StripUntrustedProxyHeadersHandler
responseFilterChain
Zuul 2系列[1]之启动过程: 左侧链路
FilterFactory
channelRead();
FilterRegistry
endPoint
CloseOnIdleStateHandler
HTTP1
0 条评论
回复 删除
下一页