netty文章收藏

 

1.林峯的關於netty文章

不錯,遇到問題反覆看了幾遍總有啓發,還說收藏記錄一下。html

http://www.infoq.com/cn/nettyjava

Netty案例集錦之多線程篇(續)做者 李林鋒 發佈於 2015年11月25日 9編程

Netty案例集錦之多線程篇做者 李林鋒 發佈於 2015年9月3日 14api

Netty系列之Netty編解碼框架分析做者 李林鋒 發佈於 2015年4月29日 22安全

Netty版本升級血淚史之線程篇做者 李林鋒 發佈於 2015年2月7日 18網絡

Netty系列之Netty百萬級推送服務設計要點做者 李林鋒 發佈於 2015年1月4日 31多線程

Netty系列之Netty併發編程分析做者 李林鋒 發佈於 2014年10月24日 17併發

Netty系列之Netty 服務端建立做者 李林鋒 發佈於 2014年9月11日 20框架

Netty系列之Netty安全性做者 李林鋒 發佈於 2014年8月8日 11async

Netty系列之Netty線程模型做者 李林鋒 發佈於 2014年7月11日 25

Netty系列之Netty可靠性分析做者 李林鋒 發佈於 2014年6月19日 29

Netty系列之Netty高性能之道做者 李林鋒 發佈於 2014年5月30日 48

 

2.網絡排查:

http://www.cnblogs.com/Security-Darren/p/4700387.html

 

3.netty源碼細節

http://xw-z1985.iteye.com/category/260393
 

5.耗時業務邏輯線程處理(還在看,可能有不對的地方)

要關注3個地方的線程處理:

a.BOSS線程:處理鏈接創建(服務端纔有)

b.worker線程:處理IO、解碼(read等)

c.一個channel發了多個消息的,消息併發處理(初步看是用本身實現的業務線程池)

 

知乎的討論:

https://www.zhihu.com/question/35487154(ExecutionHandler是netty3的東西,4已經去掉)

 

EventLoop:其本質是一個用來處理IO事件的線程,EventLoopGroup 其本質是一個線程池。一個EventLoop會對應着一個線程,一個EventLoop能夠和多個Channel綁定,處理多個Channel的IO事件;可是一個Channel在整個生命週期內只會被一個EventLoop處理

http://blog.csdn.net/suifeng3051/article/details/28861883

 

官方文檔:(解決了IO worker線程不堵塞的問題,但看源碼一個handler只綁定一個線程,並不能解決handler處理的效率問題,例如一個鏈接發的消息不少,可是handler消息處理並不會併發執行)

https://netty.io/4.1/api/io/netty/channel/ChannelPipeline.html

static final EventExecutorGroup group = new DefaultEventExecutorGroup}(16); 
ChannelPipeline pipeline = ch.pipeline(); 
pipeline.addLast("decoder", new MyProtocolDecoder()); 
pipeline.addLast("encoder", new MyProtocolEncoder()); 
// Tell the pipeline to run MyBusinessLogicHandler's event handler methods 
// in a different thread than an I/O thread so that the I/O thread is not blocked by
// a time-consuming task. If your business logic is fully asynchronous or finished 
// very quickly, you don't need to specify a group.
pipeline.addLast(group, "handler", new MyBusinessLogicHandler());

 

AbstractChannelHandlerContext(DefaultChannelPipeline pipeline, EventExecutorGroup group, String name,
                                  boolean inbound, boolean outbound) {

        if (name == null) {
            throw new NullPointerException("name");
        }

        channel = pipeline.channel;
        this.pipeline = pipeline;
        this.name = name;

        if (group != null) {
            // Pin one of the child executors once and remember it so that the same child executor
            // is used to fire events for the same channel.
            EventExecutor childExecutor = pipeline.childExecutors.get(group);
            if (childExecutor == null) {
                childExecutor = group.next();
                pipeline.childExecutors.put(group, childExecutor);
            }
            executor = childExecutor;
        } else {
            executor = null;
        }

        this.inbound = inbound;
        this.outbound = outbound;
    }



 

最後固然不能忘了官方文檔:

http://netty.io/wiki/user-guide-for-4.x.html

http://netty.io/wiki/related-articles.html

相關文章
相關標籤/搜索