study link: http://netty.io/3.6/guide/#architecture

应用场景:

  • Chat server that requires persistent connections and server push technology (e.g. Comet)

  • Media streaming server that needs to keep the connection open until the whole media is streamed (e.g. 2 hours of video)

  • File server that allows the uploading of large files without memory pressure (e.g. uploading 1GB per request)

  • Scalable mash-up client that connects to tens of thousands of 3rd party web services asynchronously

高级特性:

1. Codec (means encode and decode - usually you need to codec the requests from socket stream)

2. SSL (secure socket layer) / TLS (transport layer security) support

3.  HTTP easy implementation

4. webSocket support

5. Google Protocol Buffer Integration - binary protocol ?!

powerful architecture. It is composed of three components - buffer, channel, and event model- and all advanced features are built on top of the three core components


Guide:
Request will be read by Channel into ChannelBuffer
Meanwhile it will publish the ChannelEvent to the ChannelHandlers in the ChannelPipeline
ChannelEvent.getChannel()
Response will be generated by ChannelHandlers into ChannelBuffer, lastly write into Channel back to client

* new NioServerSocketChannelFactory( Executors.newCachedThreadPool()

无界线程池,可以进行自动线程回收。

在JDK帮助文档中,有如此一段话: “强烈建议程序员使用较为方便的 Executors 工厂方法 Executors.newCachedThreadPool()(无界线程池,可以进行自动线程回收)、Executors.newFixedThreadPool(int)(固定大小线程池)和 Executors.newSingleThreadExecutor()(单个后台线程),它们均为大多数使用场景预定义了设置。”

More details about ThreadPool tech, you can check http://dongxuan.iteye.com/blog/901689

newFixedThreadPool          newSingleThreadExecutor           newCachedThreadPool

学习 Netty 3.x的更多相关文章

  1. Netty学习——Netty和Protobuf的整合(二)

    Netty学习——Netty和Protobuf的整合(二) 这程序是有瑕疵的,解码器那里不通用,耦合性太强,有两个很明显的问题,但是要怎么解决呢?如:再加一个内部类型 Person2,之前的代码就不能 ...

  2. Netty学习——Netty和Protobuf的整合(一)

    Netty学习——Netty和Protobuf的整合 Protobuf作为序列化的工具,将序列化后的数据,通过Netty来进行在网络上的传输 1.将proto文件里的java包的位置修改一下,然后再执 ...

  3. 深入学习Netty(1)——传统BIO编程

    前言 之前看过Dubbo源码,Nacos等源码都涉及到了Netty,虽然遇到的时候查查资料,后面自己也有私下学习Netty并实践,但始终没有形成良好的知识体系,Netty对想要在Java开发上不断深入 ...

  4. 深入学习Netty(2)——传统NIO编程

    前言 学习Netty编程,避免不了从了解Java 的NIO编程开始,这样才能通过比较让我们对Netty有更深的了解,才能知道Netty大大的好处.传统的NIO编程code起来比较麻烦,甚至有遗留Bug ...

  5. 深入学习Netty(3)——传统AIO编程

    前言 之前已经整理过了BIO.NIO两种I/O的相关博文,每一种I/O都有其特点,但相对开发而言,肯定是要又高效又简单的I/O编程才是真正需要的,在之前的NIO博文(深入学习Netty(2)--传统N ...

  6. 深入学习Netty(4)——Netty编程入门

    前言 从学习过BIO.NIO.AIO编程之后,就能很清楚Netty编程的优势,为什么选择Netty,而不是传统的NIO编程.本片博文是Netty的一个入门级别的教程,同时结合时序图与源码分析,以便对N ...

  7. 深入学习Netty(5)——Netty是如何解决TCP粘包/拆包问题的?

    前言 学习Netty避免不了要去了解TCP粘包/拆包问题,熟悉各个编解码器是如何解决TCP粘包/拆包问题的,同时需要知道TCP粘包/拆包问题是怎么产生的. 在此博文前,可以先学习了解前几篇博文: 深入 ...

  8. netty04(重点来了、指定某个客户端发信息或者群发)小声嘀咕~~我也是从零开始学得、、、想学习netty的又不知道怎么下手的童鞋们~~

    还是和上几篇一样,先给出前面笔记的连接,有没看的可以去看看再来! netty01   . netty02  .netty03 看到这里.你基本上可以使用netty接受信息和根据对应的信息返回信息了 接 ...

  9. 【Netty4】深入学习Netty

    Netty is an asynchronous event-driven network application framework  for rapid development of mainta ...

随机推荐

  1. DNN模块开发之利器篇:七种武器

    我们在进行DNN模块开发时经常需要调用Dotnetnuke.dll中的方法函数,模块开发用到DNN的方法函数会让你的开发更加得心应手,下面我们就来介绍一下.   1) PortalModuleBase ...

  2. MD5加密类

    public class MD5Util { public static String getMD5(String s) { char hexDigits[] = {'0', '1', '2', '3 ...

  3. android获取在res文件下的图片资源

    //得到该图片的id(name 是该图片的名字,"drawable" 是该图片存放的目录,getPackageName()是应用程序的包) int resID = getResou ...

  4. iOS 网络与多线程--2.同步Get方式的网络请求(阻塞)

    通过Get请求方式同步获取网络数据.一旦发送同步请求,程序将停止用户交互,直至服务器返回数据. 之后在视图控制器文件(ViewController.m)内添加以下代码 在viewDidLoad函数内添 ...

  5. JAVA-2-DATA

    import java.util.*; public class Ch0310 { public static void main(String[] args) { // TODO 自动生成的方法存根 ...

  6. 使用 HTML5 设计辅助功能

    使用 HTML5 设计辅助功能 Rajesh Lal 下载代码示例 如果您真的对面向广大受众感兴趣,将需要为网站设计辅助功能. 辅助功能使网页更易于访问.更易于使用,可供每个人浏览. 通常,使用最新的 ...

  7. V9 二次开发技术篇之 模型数据库

    应V9粉丝的建议,本人今天讲一下 MVC中的M 数据库模型 首先 在 phpcms\model  建一个模型文件test_model.class.php <?phpdefined('IN_PHP ...

  8. php设计模式 1单例模式

    之前很长时间之前就学习过设计模式,但是因为在实践中很少应用,所以忽略了,但现在却意识到设计模式很重要的,程序设计简介高效冗余性代码少. 今天开始把前几天学习的几个设计模式整理一下,首先当然是单例模式. ...

  9. ANDROID 自动生成动态表格for

    简单的栗子去了解这个自动生成的动态的控件(自动生成表格) /cs-Layout/res/layout/activity_main.xml <LinearLayout xmlns:android= ...

  10. windows 下安装使用ipython

    转自:https://my.oschina.net/u/1431433/blog/189337 1. 下载安装Python 下载: python-3.3.3.amd64.msi (救在Python.o ...