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. 获取android手机联系人信息

    package com.yarin.android.Examples_04_04; import android.app.Activity; import android.database.Curso ...

  2. component object model(组件对象模型)

    通常,COM是以 win32动态链接库(dll)或可执行文件(exe)的形式发布. 在COM中,接口就是一切,对于客户来说,一个组件就是一个接口集.COM接口是一个包含一个函数指针数组的内存结构. 组 ...

  3. eclipse中build path 中JDK与java compiler compliance level的问题(转)

    roject facets做什么用? http://baike.baidu.com/view/6257360.htm,其实我感觉,就是让我们在创建项目时候,可以独立定义一个有一个模板供我们使用,在里面 ...

  4. Nagios监控memcached

    下载地址: http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz http: ...

  5. css动态样式

    一种 var style=document.createElement("style"); style.type="text/css"; style.appen ...

  6. zoj 3647 Gao the Grid

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4837 先求出从所有点随机找出三个点的组合数,然后去掉共线的,平行好去掉,斜线就 ...

  7. Special Pythagorean triplet

    这个比较简单,慢慢进入状态. A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = ...

  8. mySql控制流程的函数

    1.select case value then result else value end; 在第一个方案的返回结果中, value=compare-value.而第二个方案的返回结果是第一种情况的 ...

  9. ETL工具框架开源软件

    http://www.oschina.net/project/tag/453/etl 开源ETL工具 Kettle Talend KETL CloverETL Apatar Scriptella ET ...

  10. 牛逼的 弹出层 layer !!!

    功能强大,实用,操作方便,文档齐全. http://layer.layui.com/api.html 常用功能代码: <!doctype html> <html> <he ...