netty是什么液肌?
Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.
netty是一個(gè)異步的事件驅(qū)動(dòng)(不同的階段硅堆,對(duì)應(yīng)不同的回調(diào)方法)的網(wǎng)絡(luò)框架維護(hù)著高性能協(xié)議的服務(wù)器端和客戶(hù)端的快速開(kāi)發(fā)虑凛。
Netty is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients. It greatly simplifies and streamlines network programming such as TCP and UDP socket server.
Netty是一個(gè)非阻塞的io客戶(hù)端服務(wù)端的框架可以快速并且簡(jiǎn)單的開(kāi)發(fā)網(wǎng)絡(luò)應(yīng)用比如說(shuō)客戶(hù)端和服務(wù)端的協(xié)議。它極大的簡(jiǎn)化了網(wǎng)絡(luò)編程流程比如說(shuō)tcp或者udp socket服務(wù)器。
'Quick and easy' doesn't mean that a resulting application will suffer from a maintainability or a performance issue. Netty has been designed carefully with the experiences earned from the implementation of a lot of protocols such as FTP, SMTP, HTTP, and various binary and text-based legacy protocols. As a result, Netty has succeeded to find a way to achieve ease of development, performance, stability, and flexibility without a compromise.
快速和簡(jiǎn)單并不意味著由此產(chǎn)生的應(yīng)用程序?qū)⒁馐艿娇删S護(hù)性或者性能問(wèn)題的困擾。Netty精簡(jiǎn)的設(shè)計(jì)從一些的協(xié)議比如說(shuō)FTP踢故,STMP,HTTP和一些基于二進(jìn)制的傳統(tǒng)協(xié)議獲取的經(jīng)驗(yàn)惹苗。因此殿较,Netty成功的發(fā)現(xiàn)一種方式去實(shí)現(xiàn)輕松的開(kāi)發(fā),性能桩蓉,穩(wěn)定和靈妥協(xié)斜脂。活性而不需要任何的.
特征(Features)
設(shè)計(jì)
Unified API for various transport types - blocking and non-blocking socket
統(tǒng)一的api基于不同的傳輸類(lèi)型-阻塞和非阻塞的socket.
Based on a flexible and extensible event model which allows clear separation of concerns.
基于靈活的可擴(kuò)展的時(shí)間模型触机,允許明確的關(guān)注分離.
Highly customizable thread model - single thread, one or more thread pools such as SEDA
高度可定制的線程模型-單線程,一個(gè)或多個(gè)線程池比如說(shuō)SEDA.
SEDA(Staged Event-Driven Architecture)的核心思想是把一個(gè)請(qǐng)求處理過(guò)程分成幾個(gè)Stage玷或,不同資源消耗的Stage使用不同數(shù)量的線程來(lái)處理儡首,Stage間使用事件驅(qū)動(dòng)的異步通信模式。
True connectionless datagram socket support (since 3.1).
真正的無(wú)連接的數(shù)據(jù)報(bào)socket支持(基于3.1版本).
使用簡(jiǎn)單
- Well-documented Javadoc, user guide and examples
詳細(xì)的用戶(hù)java文檔偏友,用戶(hù)指南和demo - No additional dependencies, JDK 5 (Netty 3.x) or 6 (Netty 4.x) is enough
不需要額外的依賴(lài)蔬胯,JDK 5 (Netty 3.x版本) 或者 6 (Netty 4.x版本)就足夠了 - Note: Some components such as HTTP/2 might have more requirements. Please refer to the Requirements page for more information.
注意:一些組件比如說(shuō)HTTP/2可能需要一些額外的依賴(lài)。
性能
- Better throughput, lower latency
更好的吞吐量位他,低延遲 - Less resource consumption
資源消耗減少 - Minimized unnecessary memory copy.
不必要的內(nèi)存拷貝(零拷貝).
安全
Complete SSL/TLS and StartTLS support氛濒。
完全的SSl/tls 和 StartTLS的支持。
- core(核心模塊):Extensible Event Model(可擴(kuò)展的事件模型),Universal Communication API(通用的通訊API),Zero-Copy-Capable Rich Byte Buffer(零拷貝的字節(jié)緩沖區(qū))
- Transport Services(傳輸服務(wù)): Socket & Datagram,HTTp Tunnel,In-Vm Pipe
- Protocol Support(協(xié)議支持): HTTP & WebSocket,SSl.StartTLS,Google Protobuf,zlib/gzip Compression,Large File Transfer,RTSP(和流媒體有關(guān)),Legacy Text.Binary Protocols with Unit Testability
關(guān)于netty5廢棄的原因
netty5的主要變化是使用了ForkJoinPool使得程序變得異常復(fù)雜鹅髓,但是性能卻沒(méi)有得到可見(jiàn)的提升舞竿,并且維護(hù)多個(gè)版本的代碼更新是個(gè)耗費(fèi)精力的事情,所以廢棄了netty5的主分支窿冯。
參考資料
netty官網(wǎng)